pithos.sia: /l/<id>/<name> opens the public link at navigate.st/sia

This commit is contained in:
Local Dev 2026-10-06 00:13:11 +02:00
parent 7eb61b703a
commit fac9f77af2

View file

@ -392,6 +392,9 @@
(function () { (function () {
var inTheseus = location.hostname === 'pithos.sia'; var inTheseus = location.hostname === 'pithos.sia';
var path = location.pathname.replace(/^\/bns\/pithos\.sia(?=\/|$)/, '').replace(/^\/pithos(?=\/|$)/, '') || '/'; var path = location.pathname.replace(/^\/bns\/pithos\.sia(?=\/|$)/, '').replace(/^\/pithos(?=\/|$)/, '') || '/';
// pithos.sia/l/<id>/<name>: a public link; the file lives at navigate.st/sia
var link = /^\/l\/([A-Za-z0-9_-]{4,64}(?:\/.*)?)$/.exec(path);
if (link) { location.replace('https://navigate.st/sia/' + link[1] + location.search); return; }
var sitePage = /^\/(index\.html|vs(\.html)?|docs(\/.*)?|llms\.txt)?$/.test(path); var sitePage = /^\/(index\.html|vs(\.html)?|docs(\/.*)?|llms\.txt)?$/.test(path);
var appPath = sitePage ? '/' : path; var appPath = sitePage ? '/' : path;
var href = inTheseus ? (sitePage ? '/app' : path) : 'http://127.0.0.1:47621/open?path=' + encodeURIComponent(appPath); var href = inTheseus ? (sitePage ? '/app' : path) : 'http://127.0.0.1:47621/open?path=' + encodeURIComponent(appPath);