Skip to content

Commit 7333638

Browse files
feat: seed /public/links.jsonld on first run (#13)
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
1 parent 26633de commit 7333638

3 files changed

Lines changed: 47 additions & 6 deletions

File tree

index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,26 @@ const ready = waitForReady(browserUrl);
431431
// landing page. Tracked upstream in a separate issue. Doing this
432432
// after readiness avoids a race where JSS's init might rewrite the
433433
// file on top of ours.
434+
//
435+
// Also seed pod-data/public/links.jsonld on first start so the /public/
436+
// tile lands the user on something tangible instead of an empty
437+
// container listing. This one is skip-if-exists (it's user content
438+
// — never overwrite a customized version).
434439
ready.then((ok) => {
435440
if (!ok) return;
436-
const src = join(__dirname, 'welcome.html');
437-
const dst = join(options.root, 'index.html');
438441
try {
439-
if (existsSync(src)) copyFileSync(src, dst);
442+
const indexSrc = join(__dirname, 'welcome.html');
443+
const indexDst = join(options.root, 'index.html');
444+
if (existsSync(indexSrc)) copyFileSync(indexSrc, indexDst);
445+
446+
const linksSrc = join(__dirname, 'links.jsonld');
447+
const linksDst = join(options.root, 'public', 'links.jsonld');
448+
if (existsSync(linksSrc) && !existsSync(linksDst)) {
449+
copyFileSync(linksSrc, linksDst);
450+
}
440451
} catch {
441-
// best-effort: if we can't write, the user just sees JSS's default
452+
// best-effort: failures are silent; user falls back to whatever
453+
// JSS already wrote (or nothing for links.jsonld).
442454
}
443455
});
444456

links.jsonld

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"@context": {
3+
"schema": "http://schema.org/",
4+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#"
5+
},
6+
"@id": "",
7+
"@type": "schema:WebPage",
8+
"rdfs:label": "Links — places to take your Solid pod next",
9+
"rdfs:comment": "A few starting points. Click any URI to navigate.",
10+
"schema:hasPart": [
11+
{
12+
"@id": "https://solid-apps.github.io/pilot/",
13+
"rdfs:label": "Pilot — a minimal Solid data browser"
14+
},
15+
{
16+
"@id": "https://solidproject.org/apps",
17+
"rdfs:label": "Browse more Solid apps"
18+
},
19+
{
20+
"@id": "https://github.com/JavaScriptSolidServer/jspod",
21+
"rdfs:label": "jspod source"
22+
},
23+
{
24+
"@id": "https://github.com/JavaScriptSolidServer/JavaScriptSolidServer",
25+
"rdfs:label": "JavaScriptSolidServer (the substrate jspod builds on)"
26+
}
27+
]
28+
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspod",
3-
"version": "0.0.14",
3+
"version": "0.0.15",
44
"description": "JavaScript Solid Pod - Just works, batteries included",
55
"type": "module",
66
"main": "index.js",
@@ -11,7 +11,8 @@
1111
"index.js",
1212
"data-browser.js",
1313
"data-browser.css",
14-
"welcome.html"
14+
"welcome.html",
15+
"links.jsonld"
1516
],
1617
"scripts": {
1718
"start": "node index.js"

0 commit comments

Comments
 (0)