From 558513871c230096aa0dec0e05a641f2cb1ca225 Mon Sep 17 00:00:00 2001 From: Melvin Carvalho Date: Sat, 16 May 2026 08:46:27 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20ship=20/account.html=20=E2=80=94=20post?= =?UTF-8?q?-sign-in=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After sign-in, signin.html now redirects to /account.html instead of /. The new dashboard mirrors the Pivot / sc.net pattern: - WebID display (clickable link to the profile resource) - Pod URL - Explore buttons for /profile/, /public/, /private/, /inbox/, /settings/ — direct nav, no probe required since the user is already authenticated - Sign out button — calls session.logout(), redirects to / - Footer credit pointing at jspod + solid-oidc The page is auth-state-aware via solid-oidc: - Active session → full dashboard - No session → "You're not signed in. [Sign in]" with a button pointing at /signin.html - restore() failure → silently treated as "no session" (same "Missing refresh data" handling as signin.html) Public-read ACL (account.html.acl) so the page itself loads before / without any session. Welcome.html also gets an "Account" button alongside Sign in so signed-in returning visitors have a clear route back. Files: - account.html (~5 KB, single file) - account.html.acl - signin.html — post-success redirect → /account.html - welcome.html — Account button added next to Sign in - index.js — always-overwrite copy for both new files - package.json — files whitelist + 0.0.18 bump Refs #1 --- account.html | 121 +++++++++++++++++++++++++++++++++++++++++++++++ account.html.acl | 23 +++++++++ index.js | 11 +++++ package.json | 4 +- signin.html | 4 +- welcome.html | 1 + 6 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 account.html create mode 100644 account.html.acl diff --git a/account.html b/account.html new file mode 100644 index 0000000..ef8858a --- /dev/null +++ b/account.html @@ -0,0 +1,121 @@ + + + + + +Your account — Solid pod + + + +
+

Your account

+

Loading session…

+ + + + + +
+ + +
+ + + diff --git a/account.html.acl b/account.html.acl new file mode 100644 index 0000000..704c8ef --- /dev/null +++ b/account.html.acl @@ -0,0 +1,23 @@ +{ + "@context": { + "acl": "http://www.w3.org/ns/auth/acl#", + "foaf": "http://xmlns.com/foaf/0.1/" + }, + "@graph": [ + { + "@id": "#public", + "@type": "acl:Authorization", + "acl:agentClass": { + "@id": "foaf:Agent" + }, + "acl:accessTo": { + "@id": "./account.html" + }, + "acl:mode": [ + { + "@id": "acl:Read" + } + ] + } + ] +} diff --git a/index.js b/index.js index dc326bd..248927f 100755 --- a/index.js +++ b/index.js @@ -484,6 +484,17 @@ ready.then((ok) => { const signinAclDst = join(options.root, 'signin.html.acl'); if (existsSync(signinAclSrc)) copyFileSync(signinAclSrc, signinAclDst); + // account.html — post-sign-in dashboard. Same overwrite + public- + // read pattern as signin.html. Both pages render their useful + // state from a restored solid-oidc session; signed-out visitors + // see a "sign in" prompt rather than a blank page. + const acctSrc = join(__dirname, 'account.html'); + const acctDst = join(options.root, 'account.html'); + if (existsSync(acctSrc)) copyFileSync(acctSrc, acctDst); + const acctAclSrc = join(__dirname, 'account.html.acl'); + const acctAclDst = join(options.root, 'account.html.acl'); + if (existsSync(acctAclSrc)) copyFileSync(acctAclSrc, acctAclDst); + const linksSrc = join(__dirname, 'links.jsonld'); const linksDst = join(options.root, 'public', 'links.jsonld'); if (existsSync(linksSrc) && !existsSync(linksDst)) { diff --git a/package.json b/package.json index 99480a2..235d8a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jspod", - "version": "0.0.17", + "version": "0.0.18", "description": "JavaScript Solid Pod - Just works, batteries included", "type": "module", "main": "index.js", @@ -14,6 +14,8 @@ "welcome.html", "signin.html", "signin.html.acl", + "account.html", + "account.html.acl", "links.jsonld" ], "scripts": { diff --git a/signin.html b/signin.html index f0eb80c..95a864e 100644 --- a/signin.html +++ b/signin.html @@ -71,7 +71,7 @@

Signing in…

await session.handleRedirectFromLogin(); titleEl.textContent = 'Signed in'; ledeEl.textContent = 'WebID: ' + (session.webId || '(none)') + '. Redirecting…'; - setTimeout(() => { window.location.href = './'; }, 800); + setTimeout(() => { window.location.href = './account.html'; }, 800); } else { // Try to restore a prior session. solid-oidc throws "Missing // refresh data" on a clean first visit — that's fine, it just @@ -86,7 +86,7 @@

Signing in…

if (restored) { titleEl.textContent = 'Already signed in'; ledeEl.textContent = 'WebID: ' + session.webId + '. Redirecting…'; - setTimeout(() => { window.location.href = './'; }, 400); + setTimeout(() => { window.location.href = './account.html'; }, 400); } else { await session.login(idp, redirectUri); } diff --git a/welcome.html b/welcome.html index 889c8eb..29ea02d 100644 --- a/welcome.html +++ b/welcome.html @@ -36,6 +36,7 @@

Your Solid pod

+Account