Pithos: pithos.sia/app is the app's front door

pithos.sia itself is the website, so people had no obvious address to
type for the app. /app (and /app/<page>) now opens Pithos in Theseus and
through the website's Open my Pithos; it is no longer read as an S3 user
named app.
This commit is contained in:
Local Dev 2026-10-05 02:04:06 +02:00
parent 3490dcf4c4
commit 251f95cdee
3 changed files with 5 additions and 0 deletions

View file

@ -960,6 +960,7 @@ export function handoffRoute(p) {
if (!segs.length || segs.some((x) => !/^[A-Za-z0-9._~%=-]{1,120}$/.test(x))) return '#/overview';
const pages = ['overview', 'users', 'buckets', 'account', 'settings', 'logs'];
if (segs[0] === 'drives') return '#/buckets';
if (segs[0] === 'app') return segs.length > 1 ? handoffRoute('/' + segs.slice(1).join('/')) : '#/overview';
if (pages.includes(segs[0])) return `#/${segs.join('/')}`;
return `#/u/${segs.join('/')}`; // /<user>/<drive>/<folder>
}

View file

@ -17,6 +17,8 @@ test('website paths become app routes, and odd ones go to Overview', () => {
assert.equal(handoffRoute('/backup-agent/nightly-backups/2026'), '#/u/backup-agent/nightly-backups/2026');
assert.equal(handoffRoute('/settings'), '#/settings');
assert.equal(handoffRoute('/drives'), '#/buckets');
assert.equal(handoffRoute('/app'), '#/overview');
assert.equal(handoffRoute('/app/settings'), '#/settings');
assert.equal(handoffRoute('/a/<script>'), '#/overview');
assert.equal(handoffRoute('/a/b"onload'), '#/overview');
});

View file

@ -221,6 +221,8 @@ function currentRoute() {
const segs = location.pathname.split('/').filter(Boolean);
if (!segs.length) return [];
const first = decodeURIComponent(segs[0]);
// pithos.sia/app: the app's front door (the bare pithos.sia is the website)
if (first === 'app') return segs.slice(1);
if (first === 'drives') return ['buckets'];
if (views[first]) return segs;
if (state.selectedUser !== first) { state.selectedUser = first; try { localStorage.setItem('pithos.user', first); } catch {} }