From 88d3a5b2ecdaaf877ca61a43ee6b1ff9ebd0488d Mon Sep 17 00:00:00 2001 From: Melvin Carvalho Date: Sat, 16 May 2026 07:55:47 +0200 Subject: [PATCH] feat: seed /public/links.jsonld on first run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After sign-in, the new /public/ tile on the welcome page used to land the user on an empty container (just an LDP listing of the .acl file). This adds a small JSON-LD doc with a couple of useful outbound links — Pilot (Solid app to use) and a directory of more Solid apps — plus the jspod / JSS source repos. Skip-if-exists, so user customizations to /public/links.jsonld survive jspod restarts. Lives alongside the existing welcome.html overwrite logic; both fire after waitForReady resolves. The data browser renders the file as a cream-card with each URI as a clickable link — the page is the data, the data is the navigation. Bumps jspod to 0.0.15. Refs #1 --- index.js | 20 ++++++++++++++++---- links.jsonld | 28 ++++++++++++++++++++++++++++ package.json | 5 +++-- 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 links.jsonld diff --git a/index.js b/index.js index 294e317..bf7cf42 100755 --- a/index.js +++ b/index.js @@ -431,14 +431,26 @@ const ready = waitForReady(browserUrl); // landing page. Tracked upstream in a separate issue. Doing this // after readiness avoids a race where JSS's init might rewrite the // file on top of ours. +// +// Also seed pod-data/public/links.jsonld on first start so the /public/ +// tile lands the user on something tangible instead of an empty +// container listing. This one is skip-if-exists (it's user content +// — never overwrite a customized version). ready.then((ok) => { if (!ok) return; - const src = join(__dirname, 'welcome.html'); - const dst = join(options.root, 'index.html'); try { - if (existsSync(src)) copyFileSync(src, dst); + const indexSrc = join(__dirname, 'welcome.html'); + const indexDst = join(options.root, 'index.html'); + if (existsSync(indexSrc)) copyFileSync(indexSrc, indexDst); + + const linksSrc = join(__dirname, 'links.jsonld'); + const linksDst = join(options.root, 'public', 'links.jsonld'); + if (existsSync(linksSrc) && !existsSync(linksDst)) { + copyFileSync(linksSrc, linksDst); + } } catch { - // best-effort: if we can't write, the user just sees JSS's default + // best-effort: failures are silent; user falls back to whatever + // JSS already wrote (or nothing for links.jsonld). } }); diff --git a/links.jsonld b/links.jsonld new file mode 100644 index 0000000..8f1af34 --- /dev/null +++ b/links.jsonld @@ -0,0 +1,28 @@ +{ + "@context": { + "schema": "http://schema.org/", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#" + }, + "@id": "", + "@type": "schema:WebPage", + "rdfs:label": "Links — places to take your Solid pod next", + "rdfs:comment": "A few starting points. Click any URI to navigate.", + "schema:hasPart": [ + { + "@id": "https://solid-apps.github.io/pilot/", + "rdfs:label": "Pilot — a minimal Solid data browser" + }, + { + "@id": "https://solidproject.org/apps", + "rdfs:label": "Browse more Solid apps" + }, + { + "@id": "https://github.com/JavaScriptSolidServer/jspod", + "rdfs:label": "jspod source" + }, + { + "@id": "https://github.com/JavaScriptSolidServer/JavaScriptSolidServer", + "rdfs:label": "JavaScriptSolidServer (the substrate jspod builds on)" + } + ] +} diff --git a/package.json b/package.json index cba46ec..371c699 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jspod", - "version": "0.0.14", + "version": "0.0.15", "description": "JavaScript Solid Pod - Just works, batteries included", "type": "module", "main": "index.js", @@ -11,7 +11,8 @@ "index.js", "data-browser.js", "data-browser.css", - "welcome.html" + "welcome.html", + "links.jsonld" ], "scripts": { "start": "node index.js"