javascript-solid-server 0.0.185 → 0.0.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +5 -188
- package/.github/CODEOWNERS +27 -0
- package/CONTRIBUTING.md +98 -0
- package/LICENSING.md +30 -0
- package/README.md +2 -1
- package/package.json +1 -1
- package/src/handlers/container.js +24 -16
- package/src/server.js +87 -9
- package/src/ui/server-root.html +70 -0
- package/src/ui/server-root.js +173 -0
- package/src/wac/parser.js +50 -9
- package/test/error-handler.test.js +82 -0
- package/test/server-root.test.js +192 -0
- package/test/wac.test.js +234 -1
- package/.claude/scheduled_tasks.lock +0 -1
|
@@ -141,6 +141,7 @@
|
|
|
141
141
|
"Bash(DATA_ROOT=/tmp/jss-git-test/data node:*)",
|
|
142
142
|
"Bash(git remote set-url:*)",
|
|
143
143
|
"Bash(for:*)",
|
|
144
|
+
"Bash(^/**\" | head -1 | sed ''''s/.*\\* //'''')\")",
|
|
144
145
|
"Bash(if [ ! -d \"node-solid-server\" ])",
|
|
145
146
|
"Bash(then git clone --depth 1 https://github.com/nodeSolidServer/node-solid-server.git)",
|
|
146
147
|
"Bash(node test-local-nss2.js:*)",
|
|
@@ -225,195 +226,11 @@
|
|
|
225
226
|
"Bash(gh api:*)",
|
|
226
227
|
"Bash(gh pr comment:*)",
|
|
227
228
|
"Bash(git pull:*)",
|
|
228
|
-
"Bash(
|
|
229
|
+
"Bash(NODE_OPTIONS=\"--test-name-pattern='should allow any authenticated'\" npm test:*)",
|
|
229
230
|
"Bash(node --test:*)",
|
|
230
|
-
"Bash(
|
|
231
|
-
"Bash(
|
|
232
|
-
"Bash(timeout
|
|
233
|
-
"Bash(timeout 90 bash -c:*)",
|
|
234
|
-
"Bash(git commit -m \"$\\(cat <<''EOF''\nsecurity: add ACL check on WebSocket subscription requests\n\nCheck WAC read permission before allowing subscription to prevent\ninformation leakage via notifications. Unauthorized subscriptions\nnow receive ''err <url> forbidden'' response.\n\nSecurity improvements:\n- Check ACL read access before allowing subscription\n- Validate URLs are on this server \\(prevents SSRF-like probing\\)\n- Add subscription limit and URL length validation\n\nFixes #62\nEOF\n\\)\")",
|
|
235
|
-
"Bash(gh repo fork:*)",
|
|
236
|
-
"Bash(timeout 180 npm test:*)",
|
|
237
|
-
"Bash(git show:*)",
|
|
238
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline -30 -- \"test/integration/acl-tls-test.mjs\" \"test-esm/integration/acl-tls-test.js\")",
|
|
239
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --follow -30 -- \"test/integration/acl-tls-test.mjs\")",
|
|
240
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show 778095ad --stat)",
|
|
241
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show 778095ad)",
|
|
242
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show b183c7a0)",
|
|
243
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --before=\"2019-10-29\" --after=\"2019-10-01\" -20)",
|
|
244
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server show 1a92a912 --stat)",
|
|
245
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --all --grep=jaxoncreed)",
|
|
246
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --author=\"jaxoncreed\" -30)",
|
|
247
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --author=\"[Dd]mitri\" -20)",
|
|
248
|
-
"Bash(git -C /home/melvin/remote/github.com/nodeSolidServer/node-solid-server log --oneline --all --grep=\"oidc\" -20)",
|
|
249
|
-
"Bash(npm install)",
|
|
250
|
-
"Bash(timeout 60 npx mocha:*)",
|
|
251
|
-
"Bash(timeout 120 npx mocha:*)",
|
|
252
|
-
"Bash(timeout 30 npx mocha:*)",
|
|
253
|
-
"Bash(openssl x509:*)",
|
|
254
|
-
"Bash(gh pr checks:*)",
|
|
255
|
-
"Bash(gh run view:*)",
|
|
256
|
-
"Bash(gh pr edit:*)",
|
|
257
|
-
"WebFetch(domain:patch-diff.githubusercontent.com)",
|
|
258
|
-
"Bash(git rebase:*)",
|
|
259
|
-
"Bash(timeout 10 npm start)",
|
|
260
|
-
"Bash(node bin/jss.js start:*)",
|
|
261
|
-
"Bash(ssh solid.social \"cd /var/www/jss && git pull && pm2 restart jss\")",
|
|
262
|
-
"Bash(ssh solid.social:*)",
|
|
263
|
-
"Bash(git -C /tmp/lws-server log --oneline --all -20)",
|
|
264
|
-
"Bash(git -C /tmp/lws-server branch -a)",
|
|
265
|
-
"Bash(git -C /tmp/lws-server show-branch -a)",
|
|
266
|
-
"WebFetch(domain:web-platform-tests.org)",
|
|
267
|
-
"Bash(file:*)",
|
|
268
|
-
"WebFetch(domain:karate.apache.org)",
|
|
269
|
-
"WebFetch(domain:restfulapi.net)",
|
|
270
|
-
"Bash(npm run test:jss:*)",
|
|
271
|
-
"Bash(node /home/melvin/remote/github.com/JavaScriptSolidServer/JavaScriptSolidServer/bin/jss.js start:*)",
|
|
272
|
-
"Bash(VERBOSE=true npm run test:jss:*)",
|
|
273
|
-
"Bash(npm whoami:*)",
|
|
274
|
-
"Bash(node bin/lws-test.js:*)",
|
|
275
|
-
"Bash(timeout 2 node:*)",
|
|
276
|
-
"Bash(node index.js:*)",
|
|
277
|
-
"Bash(timeout 3 npx lws-server@0.0.3:*)",
|
|
278
|
-
"Bash(npx lws-server@0.0.3)",
|
|
279
|
-
"Bash(node /tmp/jssd/verify-spacing.js:*)",
|
|
280
|
-
"Bash(gh run list:*)",
|
|
281
|
-
"Bash(pm2 startup:*)",
|
|
282
|
-
"Bash(npm run build:*)",
|
|
283
|
-
"Bash(npx esbuild:*)",
|
|
284
|
-
"Bash(gzip:*)",
|
|
285
|
-
"Bash(sort:*)",
|
|
286
|
-
"Bash(echo __NEW_LINE_496cf3994d374e5c__ echo '1. jsonld \\(277 KB\\) - used by:' grep -r \"from ['''']jsonld\" src/ --include=*.ts --include=*.js 2)",
|
|
287
|
-
"Bash(/dev/null __NEW_LINE_496cf3994d374e5c__ echo echo '2. readable-stream \\(180 KB\\) - used by:' grep -r readable-stream node_modules/n3/package.json node_modules/jsonld/package.json)",
|
|
288
|
-
"Bash(head -3 __NEW_LINE_496cf3994d374e5c__ echo echo '3. n3 \\(156 KB\\) - used by:' grep -r \"from ['''']n3\" src/ --include=*.ts --include=*.js 2)",
|
|
289
|
-
"Bash(/dev/null __NEW_LINE_496cf3994d374e5c__ echo echo '4. @xmldom/xmldom \\(136 KB\\) - used by:' grep -r xmldom src/ --include=*.ts --include=*.js 2)",
|
|
290
|
-
"Bash(/dev/null __NEW_LINE_496cf3994d374e5c__ echo echo '5. @frogcat/ttl2jsonld \\(135 KB\\) - used by:' grep -r ttl2jsonld src/ --include=*.ts --include=*.js)",
|
|
291
|
-
"Bash(echo \"\" __NEW_LINE_b9f7c85f1ada8a30__ echo \"1. jsonld \\(277 KB\\):\" grep -rn \"jsonld\" src/ --include=\"*.ts\" --include=\"*.js\")",
|
|
292
|
-
"Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"2. n3 \\(156 KB\\):\" grep -rn \"from ''''n3''''\" src/ --include=\"*.ts\" --include=\"*.js\")",
|
|
293
|
-
"Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"3. @xmldom \\(136 KB\\):\" grep -rn \"xmldom\" src/ --include=\"*.ts\" --include=\"*.js\")",
|
|
294
|
-
"Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"4. @frogcat/ttl2jsonld \\(135 KB\\):\" grep -rn \"ttl2jsonld\" src/ --include=\"*.ts\" --include=\"*.js\")",
|
|
295
|
-
"Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"5. cross-fetch \\(20 KB\\):\" grep -rn \"cross-fetch\" src/ --include=\"*.ts\" --include=\"*.js\")",
|
|
296
|
-
"Bash(head -5 __NEW_LINE_b9f7c85f1ada8a30__ echo \"\" echo \"6. solid-namespace \\(3 KB\\):\" grep -rn \"solid-namespace\" src/ --include=\"*.ts\" --include=\"*.js\")",
|
|
297
|
-
"Bash(echo __NEW_LINE_fbfd1802fc51eb60__ echo '1. jsonld \\(277 KB\\):' grep -n jsonld src/*.ts src/*.js)",
|
|
298
|
-
"Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '2. n3 \\(156 KB\\):' grep -n ''n3'' src/*.ts src/*.js)",
|
|
299
|
-
"Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '3. @xmldom \\(136 KB\\):' grep -n xmldom src/*.ts src/*.js)",
|
|
300
|
-
"Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '4. @frogcat/ttl2jsonld \\(135 KB\\):' grep -n ttl2jsonld src/*.ts src/*.js)",
|
|
301
|
-
"Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '5. cross-fetch \\(20 KB\\):' grep -n cross-fetch src/*.ts src/*.js)",
|
|
302
|
-
"Bash(grep -E \"import|require\" __NEW_LINE_fbfd1802fc51eb60__ echo echo '6. solid-namespace \\(3 KB\\):' grep -n solid-namespace src/*.ts src/*.js)",
|
|
303
|
-
"Bash(npm run build:all:*)",
|
|
304
|
-
"Bash(git status:*)",
|
|
305
|
-
"Bash(npm run lint-fix:*)",
|
|
306
|
-
"Bash(npm uninstall:*)",
|
|
307
|
-
"Bash(npm search:*)",
|
|
308
|
-
"Bash(npm run lint:*)",
|
|
309
|
-
"Bash(npm run typecheck:*)",
|
|
310
|
-
"Bash(du:*)",
|
|
311
|
-
"Bash(for pkg in activitystreams-pane chat-pane contacts-pane folder-pane issue-pane meeting-pane profile-pane source-pane pane-registry)",
|
|
312
|
-
"Bash(do du -sh node_modules/$pkg)",
|
|
313
|
-
"Bash(for pkg in solid-ui solid-logic react react-dom lodash core-js @inrupt marked dompurify)",
|
|
314
|
-
"Bash(npm why:*)",
|
|
315
|
-
"Bash(for pkg in activitystreams-pane chat-pane contacts-pane folder-pane issue-pane meeting-pane profile-pane source-pane)",
|
|
316
|
-
"Bash(wc -l echo 'Brings: mime-types \\(we already removed this pattern\\)' echo echo '=== profile-pane unique deps ===')",
|
|
317
|
-
"Bash(npm run build-prod:*)",
|
|
318
|
-
"Bash(ln:*)",
|
|
319
|
-
"WebFetch(domain:remotestorage.io)",
|
|
320
|
-
"Bash(gh issue create --title \"Feature: --public flag to skip WAC and allow open access\" --body \"$\\(cat << ''ENDOFFILE''\n## Summary\n\nAdd a `--public` flag that disables WAC \\(Web Access Control\\) checks, allowing unauthenticated read/write access to all resources. This enables JSS to be used as a simple file server similar to `npx serve`, but with REST write capabilities.\n\n**Difficulty**: 15/100 \n**Estimated Effort**: 2-4 hours \n**Dependencies**: None\n\n---\n\n## Motivation\n\nCurrently, JSS requires either:\n1. ACL files to grant access, or\n2. Authentication via Solid-OIDC\n\nThis makes it impossible to use JSS as a simple \"just serve this folder\" tool like `npx serve`. The `--public` flag would enable:\n\n1. **Quick local development** - No auth setup needed\n2. **Simple file sharing** - LAN file server with write support\n3. **jsserve wrapper** - Foundation for `npx jsserve` \\(see future issue\\)\n4. **WebDAV alternative** - Simple REST-based file server\n5. **Testing/demos** - Quick Solid server without auth complexity\n\n---\n\n## Proposed Implementation\n\n### CLI Flag\n\n```bash\njss start --public # Open read/write, no auth\njss start --public --read-only # Open read, no writes \\(like npx serve\\)\n```\n\n### Environment Variable\n\n```bash\nJSS_PUBLIC=true jss start\n```\n\n### Config File\n\n```json\n{\n \"public\": true\n}\n```\n\n---\n\n## Implementation Details\n\n### 1. Add flag to CLI \\(`bin/jss.js`\\)\n\n```javascript\n.option\\(''--public'', ''Allow unauthenticated access to all resources \\(disables WAC\\)''\\)\n.option\\(''--read-only'', ''Disable PUT/DELETE methods \\(read-only mode\\)''\\)\n```\n\n### 2. Add to config \\(`src/config.js`\\)\n\n```javascript\nconst DEFAULTS = {\n // ... existing ...\n public: false,\n readOnly: false,\n};\n\n// Environment variable mapping\nif \\(process.env.JSS_PUBLIC\\) {\n config.public = process.env.JSS_PUBLIC === ''true'';\n}\nif \\(process.env.JSS_READ_ONLY\\) {\n config.readOnly = process.env.JSS_READ_ONLY === ''true'';\n}\n```\n\n### 3. Skip WAC when public \\(`src/auth/middleware.js`\\)\n\n```javascript\nexport async function authorize\\(request, reply\\) {\n // Public mode - skip all auth/WAC checks\n if \\(request.config?.public\\) {\n return; // Allow request to proceed\n }\n \n // ... existing WAC logic ...\n}\n```\n\n### 4. Block writes when read-only \\(`src/handlers/resource.js`, `src/handlers/container.js`\\)\n\n```javascript\n// At start of PUT/DELETE handlers\nif \\(request.config?.readOnly\\) {\n return reply.code\\(405\\).send\\({ \n error: ''Method Not Allowed'',\n message: ''Server is in read-only mode''\n }\\);\n}\n```\n\n---\n\n## Behavior Matrix\n\n| Flag Combination | GET | PUT/DELETE | Auth Required |\n|------------------|-----|------------|---------------|\n| \\(default\\) | ACL | ACL | Yes \\(if ACL requires\\) |\n| `--public` | ✅ Allow | ✅ Allow | No |\n| `--public --read-only` | ✅ Allow | ❌ Block | No |\n| `--read-only` \\(no public\\) | ACL | ❌ Block | Yes |\n\n---\n\n## Security Considerations\n\n### Warning on Startup\n\nWhen `--public` is enabled, show a clear warning:\n\n```\n⚠️ WARNING: Server running in PUBLIC mode\n All files are readable and writable without authentication.\n Do not use in production or expose to the internet.\n```\n\n### Binding to localhost by default?\n\nConsider: When `--public` is set, should the default host be `localhost` instead of `0.0.0.0`?\n\n```javascript\nif \\(config.public && !explicitHostSet\\) {\n config.host = ''localhost''; // Safer default for public mode\n}\n```\n\nUser can override with `--public --host 0.0.0.0` if they explicitly want network access.\n\n---\n\n## Examples\n\n### Local Development\n```bash\n# Quick Solid-compatible file server for development\njss start --public --port 3000 --root ./test-data\n```\n\n### Read-Only File Sharing\n```bash\n# Share files on LAN, no writes allowed\njss start --public --read-only --host 0.0.0.0 --root ~/shared\n```\n\n### Testing Solid Apps\n```bash\n# Test app without auth complexity\njss start --public --root ./fixtures\nnpm test\n```\n\n---\n\n## Files to Modify\n\n| File | Changes |\n|------|---------|\n| `bin/jss.js` | Add `--public` and `--read-only` options \\(~5 LOC\\) |\n| `src/config.js` | Add defaults and env var mapping \\(~10 LOC\\) |\n| `src/auth/middleware.js` | Skip WAC when public \\(~5 LOC\\) |\n| `src/handlers/resource.js` | Block writes when read-only \\(~5 LOC\\) |\n| `src/handlers/container.js` | Block writes when read-only \\(~5 LOC\\) |\n| **Total** | **~30 LOC** |\n\n---\n\n## Testing\n\n```javascript\ndescribe\\(''--public flag'', \\(\\) => {\n it\\(''should allow unauthenticated GET'', async \\(\\) => {\n const server = await createServer\\({ public: true, root: tmpDir }\\);\n const res = await request\\(server\\).get\\(''/file.txt''\\);\n expect\\(res.status\\).toBe\\(200\\);\n }\\);\n\n it\\(''should allow unauthenticated PUT'', async \\(\\) => {\n const server = await createServer\\({ public: true, root: tmpDir }\\);\n const res = await request\\(server\\)\n .put\\(''/new-file.txt''\\)\n .send\\(''content''\\);\n expect\\(res.status\\).toBe\\(201\\);\n }\\);\n\n it\\(''should block PUT when read-only'', async \\(\\) => {\n const server = await createServer\\({ public: true, readOnly: true, root: tmpDir }\\);\n const res = await request\\(server\\)\n .put\\(''/new-file.txt''\\)\n .send\\(''content''\\);\n expect\\(res.status\\).toBe\\(405\\);\n }\\);\n}\\);\n```\n\n---\n\n## Related Issues\n\n- Future: `jsserve` package \\(thin wrapper using this flag\\)\n- #100 - Production Readiness \\(this is a dev/convenience feature\\)\n\n---\n\n## Open Questions\n\n1. Should `--public` default to `localhost` binding for safety?\n2. Should there be a `--public-read` \\(read-only public\\) shorthand?\n3. Should `--public` disable IdP/login UI entirely, or just make it optional?\nENDOFFILE\n\\)\")",
|
|
321
|
-
"Bash(npx serve --help:*)",
|
|
322
|
-
"Bash(npm exec serve:*)",
|
|
323
|
-
"Bash(npm link)",
|
|
324
|
-
"Bash(npm link:*)",
|
|
325
|
-
"Bash(git push)",
|
|
326
|
-
"Bash(ulimit:*)",
|
|
327
|
-
"Bash(gh label:*)",
|
|
328
|
-
"Bash(mongosh --eval \"db.runCommand\\({ ping: 1 }\\)\" 2>&1 | head -5)",
|
|
329
|
-
"Bash(which jss && jss --version 2>&1)",
|
|
330
|
-
"Bash(jss start --help 2>&1 | grep -i mongo)",
|
|
331
|
-
"Bash(grep -A5 '\"\"files\"\"' package.json)",
|
|
332
|
-
"Bash(mkdir -p /tmp/wt-check)",
|
|
333
|
-
"Bash(npm init:*)",
|
|
334
|
-
"WebFetch(domain:webtorrent.io)",
|
|
335
|
-
"Bash(TORRENT=/home/melvin/.claude/projects/-home-melvin-remote-github-com-JavaScriptSolidServer-JavaScriptSolidServer/a05da419-92b7-4056-93b8-e97b2035d4ae/tool-results/webfetch-1774004425803-fce7mx.bin npx -y parse-torrent $TORRENT)",
|
|
336
|
-
"Bash(gh issue:*)",
|
|
337
|
-
"Bash(sed -i 's|Settings/|settings/|g' src/server.js src/handlers/container.js src/webid/profile.js)",
|
|
338
|
-
"Bash(sed -i 's|// Settings folder|// settings folder|' src/handlers/container.js)",
|
|
339
|
-
"WebFetch(domain:www.x402.org)",
|
|
340
|
-
"Bash(jss start:*)",
|
|
341
|
-
"Read(//tmp/**)",
|
|
342
|
-
"Bash(sed -i 's/\"currency\": \"sats\"/\"currency\": \"tbtc4\"/g' /home/melvin/articles/solid-402.html /home/melvin/articles/solid-pay.html /home/melvin/articles/solid-balance.html)",
|
|
343
|
-
"Bash(sed -i 's/\"currency\":\"sats\"/\"currency\":\"tbtc4\"/g' /home/melvin/articles/solid-402.html /home/melvin/articles/solid-pay.html /home/melvin/articles/solid-balance.html)",
|
|
344
|
-
"WebFetch(domain:lists.w3.org)",
|
|
345
|
-
"Bash(git:*)",
|
|
346
|
-
"Bash(npm publish:*)",
|
|
347
|
-
"WebFetch(domain:git-mark.com)",
|
|
348
|
-
"WebFetch(domain:w3id.org)",
|
|
349
|
-
"WebFetch(domain:webledgers.github.io)",
|
|
350
|
-
"Bash(\\\\\"git config:*)",
|
|
351
|
-
"Read(//usr/local/lib/node_modules/gitmark-test/**)",
|
|
352
|
-
"WebFetch(domain:nip98.com)",
|
|
353
|
-
"WebFetch(domain:htmlpreview.github.io)",
|
|
354
|
-
"WebFetch(domain:timbl.solidcommunity.net)",
|
|
355
|
-
"Read(//home/melvin/remote/github.com/solid-helper/core/**)",
|
|
356
|
-
"Bash(curl -s https://www.gnu.org/licenses/agpl-3.0.txt)",
|
|
357
|
-
"Bash(cat LICENSE.full)",
|
|
358
|
-
"Bash(rm LICENSE.full)",
|
|
359
|
-
"Bash(awk -F: '{print $1,$2}')",
|
|
360
|
-
"Bash(awk -F: '{print $1}')",
|
|
361
|
-
"WebFetch(domain:www.gitfork.app)",
|
|
362
|
-
"Bash(JSS_SINGLE_USER_PASSWORD=hunter2 timeout 3 node bin/jss.js start --port 4581 --root /tmp/jss-103 --single-user --single-user-name alice --idp)",
|
|
363
|
-
"Bash(JSS_SINGLE_USER_PASSWORD=hunter2 timeout 2 node bin/jss.js start --port 4581 --root /tmp/jss-103 --single-user-name alice --idp)",
|
|
364
|
-
"Bash(JSS_SINGLE_USER_PASSWORD=hunter2 timeout 3 node bin/jss.js start --port 4581 --root /tmp/jss-103-sanity --single-user-name alice --single-user --idp)",
|
|
365
|
-
"Bash(pm2 jlist *)",
|
|
366
|
-
"Bash(jss --version)",
|
|
367
|
-
"Bash(cp -a ~/main/me ~/main/me.backup-pre-348)",
|
|
368
|
-
"Bash(cp -a ~/main/.idp/accounts ~/main/.idp/accounts.backup-pre-348)",
|
|
369
|
-
"Bash(mv ~/main/me.backup-pre-348 ~/main.backup-me-pre-348)",
|
|
370
|
-
"Bash(mv ~/main/.idp/accounts.backup-pre-348 ~/main.backup-accounts-pre-348)",
|
|
371
|
-
"Bash(shopt -s dotglob)",
|
|
372
|
-
"Bash(mv ~/main/me/* ~/main/)",
|
|
373
|
-
"Bash(shopt -u dotglob)",
|
|
374
|
-
"Bash(rmdir ~/main/me)",
|
|
375
|
-
"Bash(rm /tmp/dup-issue.md)",
|
|
376
|
-
"Bash(rm -rf /tmp/losos-fix)",
|
|
377
|
-
"Bash(terser losos/shell.js -m -c)",
|
|
378
|
-
"Bash(terser losos/html.js -m -c)",
|
|
379
|
-
"Bash(terser losos/store.js -m -c)",
|
|
380
|
-
"Bash(terser losos/registry.js -m -c)",
|
|
381
|
-
"Bash(terser losos/losos.js -m -c)",
|
|
382
|
-
"Bash(DATA_ROOT=/tmp/whatever node --test test/url.test.js)",
|
|
383
|
-
"Bash(gh run *)",
|
|
384
|
-
"Bash(command -v flutter)",
|
|
385
|
-
"Bash(flutter --version)",
|
|
386
|
-
"Bash(command -v adb)",
|
|
387
|
-
"Bash(command -v node)",
|
|
388
|
-
"Bash(rm -rf /tmp/jss-mobile-test)",
|
|
389
|
-
"Bash(mkdir -p /tmp/jss-mobile-test)",
|
|
390
|
-
"Bash(JSS_SINGLE_USER_PASSWORD=test1234 node bin/jss.js start --single-user --port 4444 --root /tmp/jss-mobile-test --idp)",
|
|
391
|
-
"Bash(./scripts/bundle-jss.sh 0.0.169)",
|
|
392
|
-
"Bash(JSS_SINGLE_USER_PASSWORD=test1234 node assets/nodejs-project/bin/jss.js start --single-user --port 4446 --host 127.0.0.1 --root /tmp/jss-bundle-smoke --idp)",
|
|
393
|
-
"Bash(flutter create *)",
|
|
394
|
-
"Bash(flutter pub *)",
|
|
395
|
-
"WebFetch(domain:pub.dev)",
|
|
396
|
-
"WebFetch(domain:nodejs-mobile.github.io)",
|
|
397
|
-
"WebFetch(domain:bare.pears.com)",
|
|
398
|
-
"Bash(command -v gradle)",
|
|
399
|
-
"Bash(gradle --version)",
|
|
400
|
-
"Bash(java -version)",
|
|
401
|
-
"Bash(./gradlew --version)",
|
|
402
|
-
"Bash(./gradlew :app:tasks --no-daemon --warning-mode=none)",
|
|
403
|
-
"Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:tasks --no-daemon)",
|
|
404
|
-
"Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:processDebugResources --no-daemon)",
|
|
405
|
-
"Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:compileDebugKotlin --no-daemon)",
|
|
406
|
-
"Bash(./scripts/fetch-libnode.sh v18.20.4)",
|
|
407
|
-
"Bash(ANDROID_HOME=/home/melvin/Android/Sdk ANDROID_SDK_ROOT=/home/melvin/Android/Sdk ./gradlew :app:assembleDebug --no-daemon)",
|
|
408
|
-
"Bash(/home/melvin/Android/Sdk/platform-tools/adb devices *)",
|
|
409
|
-
"Bash(command -v chromium chromium-browser google-chrome firefox playwright)",
|
|
410
|
-
"Bash(/usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --hide-scrollbars --window-size=480,800 --screenshot=/tmp/consent-preview.png file:///tmp/consent-preview.html)",
|
|
411
|
-
"Bash(cp /tmp/consent-preview.html ~/consent-preview.html)",
|
|
412
|
-
"Read(//home/melvin/**)",
|
|
413
|
-
"Bash(/usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --hide-scrollbars --window-size=520,900 --screenshot=consent.png file:///home/melvin/consent-preview.html)",
|
|
414
|
-
"Bash(sed -i '0,/\"version\": \"0.0.181\"/{s/\"version\": \"0.0.181\"/\"version\": \"0.0.182\"/}' package-lock.json)",
|
|
415
|
-
"WebFetch(domain:losos.org)",
|
|
416
|
-
"Bash(sed -i '0,/\"version\": \"0.0.183\"/{s/\"version\": \"0.0.183\"/\"version\": \"0.0.184\"/}' package-lock.json)"
|
|
231
|
+
"Bash(git commit -m \"$\\(cat <<''EOF''\ntest: add coverage for acl:AuthenticatedAgent\n\nAdd test to verify that acl:AuthenticatedAgent works correctly:\n- Denies anonymous/unauthenticated access\n- Allows the resource owner\n- Allows ANY authenticated user \\(key distinction from private ACLs\\)\n\nFixes #58\nEOF\n\\)\")",
|
|
232
|
+
"Bash(timeout 60 node --test:*)",
|
|
233
|
+
"Bash(timeout 45 node --test:*)"
|
|
417
234
|
]
|
|
418
235
|
}
|
|
419
236
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CODEOWNERS — paths that auto-request review from the listed owners.
|
|
2
|
+
#
|
|
3
|
+
# GitHub matches paths in order. The most specific match for a given
|
|
4
|
+
# file wins. The catch-all `*` pattern at the top covers everything
|
|
5
|
+
# else; the path-specific entries below document review responsibility
|
|
6
|
+
# for security-sensitive surfaces explicitly.
|
|
7
|
+
#
|
|
8
|
+
# Format reference:
|
|
9
|
+
# https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
|
10
|
+
|
|
11
|
+
# Default — all files
|
|
12
|
+
* @melvincarvalho
|
|
13
|
+
|
|
14
|
+
# Auth / security-sensitive paths
|
|
15
|
+
/src/auth/ @melvincarvalho
|
|
16
|
+
/src/idp/ @melvincarvalho
|
|
17
|
+
/src/utils/ssrf.js @melvincarvalho
|
|
18
|
+
|
|
19
|
+
# CLI and release surface
|
|
20
|
+
/bin/ @melvincarvalho
|
|
21
|
+
/package.json @melvincarvalho
|
|
22
|
+
/package-lock.json @melvincarvalho
|
|
23
|
+
|
|
24
|
+
# Legal / policy substrate
|
|
25
|
+
/LICENSE @melvincarvalho
|
|
26
|
+
/CONTRIBUTING.md @melvincarvalho
|
|
27
|
+
/.github/ @melvincarvalho
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Contributing to JSS
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing to JavaScript Solid Server (JSS).
|
|
4
|
+
This document covers the conventions the project already follows. Aim is
|
|
5
|
+
*reference card*, not tutorial — one screen, scannable.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/JavaScriptSolidServer/JavaScriptSolidServer
|
|
11
|
+
cd JavaScriptSolidServer
|
|
12
|
+
npm install
|
|
13
|
+
npm test # ~40s, 780+ tests
|
|
14
|
+
node bin/jss.js # run a local pod
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
The project follows a strict **issue → branch → PR → merge → pull** sequence.
|
|
20
|
+
No direct commits to `gh-pages` (the default branch).
|
|
21
|
+
|
|
22
|
+
1. Open an issue describing the change (or pick an existing one)
|
|
23
|
+
2. Branch: `git checkout -b issue-<number>-short-slug`
|
|
24
|
+
3. Commit with a descriptive title + multi-paragraph body explaining the *why*
|
|
25
|
+
(see existing history for the cadence)
|
|
26
|
+
4. Open a PR linked to the issue
|
|
27
|
+
5. Address Copilot review iteratively until clean (the project leans heavily
|
|
28
|
+
on automated review passes)
|
|
29
|
+
6. Squash-merge, delete branch, `git pull`
|
|
30
|
+
|
|
31
|
+
## Code style
|
|
32
|
+
|
|
33
|
+
- **ESM only**, Node ≥ 22 LTS
|
|
34
|
+
- **No native modules** — runs unmodified on Termux, postmarketOS,
|
|
35
|
+
Cloudflare Workers
|
|
36
|
+
- **JSDoc** on public exports; inline `//` comments explain *why*, not *what*
|
|
37
|
+
- **Tests via `node --test`** — no test framework dependency
|
|
38
|
+
- **No build step** — the source you read is the source that runs
|
|
39
|
+
|
|
40
|
+
## AI-assistance disclosure
|
|
41
|
+
|
|
42
|
+
JSS welcomes thoughtfully-prepared contributions, including those drafted
|
|
43
|
+
with AI assistance. To keep provenance clear:
|
|
44
|
+
|
|
45
|
+
- **Disclose AI assistance** in the PR description. Indicate one of:
|
|
46
|
+
- hand-authored
|
|
47
|
+
- AI-assisted with substantive human review
|
|
48
|
+
- substantially AI-generated
|
|
49
|
+
- **Share prompts** for substantial AI-generated portions (in the PR
|
|
50
|
+
description or a linked artifact) so reviewers can assess scope.
|
|
51
|
+
- **Authorship responsibility** — code review, follow-up, and licence
|
|
52
|
+
obligations stay with the contributor regardless of AI involvement.
|
|
53
|
+
- **Per-contributor flexibility** — established contributors with a
|
|
54
|
+
consistent disclosure history may agree streamlined arrangements
|
|
55
|
+
with the maintainer.
|
|
56
|
+
|
|
57
|
+
This is consistent with [NLnet's generative-AI policy for funded
|
|
58
|
+
projects](https://nlnet.nl/foundation/policies/generativeAI/) and
|
|
59
|
+
general open-source provenance best practice; it is not a JSS-specific
|
|
60
|
+
imposition.
|
|
61
|
+
|
|
62
|
+
A PR template (`.github/pull_request_template.md`) carries the same
|
|
63
|
+
checklist so every PR captures the disclosure inline.
|
|
64
|
+
|
|
65
|
+
## Forks and downstream distribution
|
|
66
|
+
|
|
67
|
+
JSS is AGPL-3.0. Forks are welcome.
|
|
68
|
+
|
|
69
|
+
The licence terms set the boundary: **§5(a)** requires a prominent
|
|
70
|
+
modification notice on conveyed (deployed, published, or distributed)
|
|
71
|
+
modified versions, with a relevant date. Forks operating a public
|
|
72
|
+
deployment are encouraged to surface this notice on the deployment
|
|
73
|
+
itself — about page, footer, response headers, or equivalent — so
|
|
74
|
+
downstream users have visible provenance.
|
|
75
|
+
|
|
76
|
+
If you are forking and want to ensure §5(a) compliance, please open an
|
|
77
|
+
issue or ping the maintainer; happy to advise on how to apply the
|
|
78
|
+
notice cleanly.
|
|
79
|
+
|
|
80
|
+
## Licence and CLA
|
|
81
|
+
|
|
82
|
+
JSS is licensed under AGPL-3.0 (see `LICENSE`). All contributions are
|
|
83
|
+
accepted under the same licence by default.
|
|
84
|
+
|
|
85
|
+
A Contributor Licence Agreement is being drafted and will be required
|
|
86
|
+
for substantial contributions ahead of the `0.1` release; details and
|
|
87
|
+
process will be published as part of that milestone work. Until then,
|
|
88
|
+
the GitHub commit-via-PR flow constitutes acceptance of the project
|
|
89
|
+
licence for the contributed change.
|
|
90
|
+
|
|
91
|
+
## Where to ask
|
|
92
|
+
|
|
93
|
+
- **Bugs / feature requests:** the GitHub issue tracker
|
|
94
|
+
- **Security issues:** see `SECURITY.md` (forthcoming) for the
|
|
95
|
+
responsible-disclosure path
|
|
96
|
+
- **General questions:** ping the maintainer via the project's issue
|
|
97
|
+
tracker; conversational venues are intentionally not listed here so
|
|
98
|
+
the canonical record stays on GitHub
|
package/LICENSING.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Licensing
|
|
2
|
+
|
|
3
|
+
JSS is distributed under the GNU Affero General Public License v3.0
|
|
4
|
+
(AGPL-3.0) — see [LICENSE](./LICENSE) for the full text.
|
|
5
|
+
|
|
6
|
+
The AGPL-3.0 is appropriate for most use cases, including
|
|
7
|
+
network-deployed Solid servers (single-user, multi-user, agentic),
|
|
8
|
+
community projects, research deployments, and commercial deployments
|
|
9
|
+
compatible with AGPL terms (including §13 source-availability
|
|
10
|
+
obligations on network-deployed modified versions, and §5(a)
|
|
11
|
+
modification notice requirements).
|
|
12
|
+
|
|
13
|
+
## Commercial licensing
|
|
14
|
+
|
|
15
|
+
Commercial licensing is also available for organisations whose
|
|
16
|
+
deployment requirements are incompatible with AGPL-3.0 — for example:
|
|
17
|
+
|
|
18
|
+
- Organisations whose internal policies forbid AGPL substrate
|
|
19
|
+
- Network-deployed services where source-availability obligations
|
|
20
|
+
(AGPL §13) cannot be satisfied
|
|
21
|
+
- Embedded or OEM redistribution in proprietary products
|
|
22
|
+
- Integration with proprietary stacks where copyleft contamination
|
|
23
|
+
is a concern
|
|
24
|
+
|
|
25
|
+
Custom-licensed deployments are negotiable per-case. Terms typically
|
|
26
|
+
include an annual or multi-year license fee, defined deployment scope
|
|
27
|
+
(per server / per organisation / per use case), and a patent grant.
|
|
28
|
+
|
|
29
|
+
To inquire about commercial licensing, contact
|
|
30
|
+
`melvincarvalho@gmail.com` with subject prefix `[JSS LICENSING]`.
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { initializeQuota, checkQuota, updateQuotaUsage } from '../storage/quota.
|
|
|
3
3
|
import { getAllHeaders } from '../ldp/headers.js';
|
|
4
4
|
import { isContainer, getEffectiveUrlPath, getPodName } from '../utils/url.js';
|
|
5
5
|
import { generateProfile, generatePreferences, generateTypeIndex, serialize } from '../webid/profile.js';
|
|
6
|
-
import { generateOwnerAcl, generatePrivateAcl, generateInboxAcl, generatePublicFolderAcl, serializeAcl } from '../wac/parser.js';
|
|
6
|
+
import { generateOwnerAcl, generatePrivateAcl, generateInboxAcl, generatePublicFolderAcl, serializeAcl, relativizeOwnerWebId } from '../wac/parser.js';
|
|
7
7
|
import { createToken } from '../auth/token.js';
|
|
8
8
|
import { canAcceptInput, toJsonLd, RDF_TYPES } from '../rdf/conneg.js';
|
|
9
9
|
import { emitChange } from '../notifications/events.js';
|
|
@@ -193,34 +193,42 @@ export async function createPodStructure(name, webId, podUri, issuer, defaultQuo
|
|
|
193
193
|
const privateTypeIndex = generateTypeIndex(`${podUri}settings/privateTypeIndex.jsonld`, { listed: false });
|
|
194
194
|
await storage.write(`${podPath}settings/privateTypeIndex.jsonld`, serialize(privateTypeIndex));
|
|
195
195
|
|
|
196
|
-
// Create default ACL files
|
|
197
|
-
//
|
|
198
|
-
|
|
196
|
+
// Create default ACL files. Each .acl is written inside the container it
|
|
197
|
+
// protects, so `acl:accessTo` is always './' (resolved against the .acl's
|
|
198
|
+
// own URL by the parser — see #428).
|
|
199
|
+
//
|
|
200
|
+
// The owner WebID is also written relatively (#430), derived from the
|
|
201
|
+
// absolute `webId` and the .acl's location within the pod by
|
|
202
|
+
// `relativizeOwnerWebId`. This works for any profile layout (modern
|
|
203
|
+
// `profile/card.jsonld#me`, legacy `profile/card#me`, custom shapes) and
|
|
204
|
+
// falls back to the absolute WebID for foreign owners. Together this
|
|
205
|
+
// keeps the on-disk pod portable across hostnames.
|
|
206
|
+
const owner = aclBase => relativizeOwnerWebId(webId, podUri, aclBase);
|
|
207
|
+
|
|
208
|
+
const rootAcl = generateOwnerAcl('./', owner(''), true);
|
|
199
209
|
await storage.write(`${podPath}.acl`, serializeAcl(rootAcl));
|
|
200
210
|
|
|
201
|
-
|
|
202
|
-
const privateAcl = generatePrivateAcl(`${podUri}private/`, webId);
|
|
211
|
+
const privateAcl = generatePrivateAcl('./', owner('private/'));
|
|
203
212
|
await storage.write(`${podPath}private/.acl`, serializeAcl(privateAcl));
|
|
204
213
|
|
|
205
|
-
|
|
206
|
-
const settingsAcl = generatePrivateAcl(`${podUri}settings/`, webId);
|
|
214
|
+
const settingsAcl = generatePrivateAcl('./', owner('settings/'));
|
|
207
215
|
await storage.write(`${podPath}settings/.acl`, serializeAcl(settingsAcl));
|
|
208
216
|
|
|
209
|
-
// publicTypeIndex: public read, overrides the private default inherited
|
|
210
|
-
|
|
217
|
+
// publicTypeIndex: public read, overrides the private default inherited
|
|
218
|
+
// from /settings/. This is a resource ACL (lives at .../publicTypeIndex.jsonld.acl),
|
|
219
|
+
// whose base URL is /settings/ — same depth as `settings/.acl` for the
|
|
220
|
+
// owner reference.
|
|
221
|
+
const publicTypeIndexAcl = generateOwnerAcl('./publicTypeIndex.jsonld', owner('settings/'), false);
|
|
211
222
|
await storage.write(`${podPath}settings/publicTypeIndex.jsonld.acl`, serializeAcl(publicTypeIndexAcl));
|
|
212
223
|
|
|
213
|
-
|
|
214
|
-
const inboxAcl = generateInboxAcl(`${podUri}inbox/`, webId);
|
|
224
|
+
const inboxAcl = generateInboxAcl('./', owner('inbox/'));
|
|
215
225
|
await storage.write(`${podPath}inbox/.acl`, serializeAcl(inboxAcl));
|
|
216
226
|
|
|
217
|
-
|
|
218
|
-
const publicAcl = generatePublicFolderAcl(`${podUri}public/`, webId);
|
|
227
|
+
const publicAcl = generatePublicFolderAcl('./', owner('public/'));
|
|
219
228
|
await storage.write(`${podPath}public/.acl`, serializeAcl(publicAcl));
|
|
220
229
|
|
|
221
|
-
// Profile folder: owner full, public read (with inheritance)
|
|
222
230
|
// Profile documents must be publicly readable for WebID verification
|
|
223
|
-
const profileAcl = generatePublicFolderAcl(
|
|
231
|
+
const profileAcl = generatePublicFolderAcl('./', owner('profile/'));
|
|
224
232
|
await storage.write(`${podPath}profile/.acl`, serializeAcl(profileAcl));
|
|
225
233
|
|
|
226
234
|
// Initialize storage quota if configured
|
package/src/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Fastify from 'fastify';
|
|
2
2
|
import rateLimit from '@fastify/rate-limit';
|
|
3
3
|
import { readFile } from 'fs/promises';
|
|
4
|
+
import { STATUS_CODES } from 'node:http';
|
|
4
5
|
import { join, dirname } from 'path';
|
|
5
6
|
import { fileURLToPath } from 'url';
|
|
6
7
|
import { handleGet, handleHead, handlePut, handleDelete, handleOptions, handlePatch } from './handlers/resource.js';
|
|
@@ -27,6 +28,7 @@ import { webrtcPlugin } from './webrtc/index.js';
|
|
|
27
28
|
import { tunnelPlugin } from './tunnel/index.js';
|
|
28
29
|
import { terminalPlugin } from './terminal/index.js';
|
|
29
30
|
import { registerErrorHandler } from './utils/error-handler.js';
|
|
31
|
+
import { seedServerRoot } from './ui/server-root.js';
|
|
30
32
|
|
|
31
33
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
32
34
|
|
|
@@ -169,6 +171,32 @@ export function createServer(options = {}) {
|
|
|
169
171
|
}
|
|
170
172
|
// Default Fastify behavior for other client errors
|
|
171
173
|
socket.destroy(err);
|
|
174
|
+
},
|
|
175
|
+
// Catch Fastify-internal errors that fire BEFORE any user hook
|
|
176
|
+
// runs — notably FST_ERR_BAD_URL on malformed percent-encoding
|
|
177
|
+
// (`%g1`, truncated `%E0%`, invalid UTF-8). Without this, Fastify
|
|
178
|
+
// writes the 400 response directly via `res.writeHead` and the
|
|
179
|
+
// browser sees a CORS error (no Access-Control-Allow-*) instead
|
|
180
|
+
// of the real status. #376.
|
|
181
|
+
frameworkErrors: (err, request, reply) => {
|
|
182
|
+
// ALWAYS apply CORS headers — matches the rest of the server's
|
|
183
|
+
// behavior (every successful response sets CORS via the global
|
|
184
|
+
// onRequest hook). getCorsHeaders defaults Allow-Origin to `*`
|
|
185
|
+
// when the request didn't send an Origin header.
|
|
186
|
+
const cors = getCorsHeaders(request.headers?.origin);
|
|
187
|
+
for (const [k, v] of Object.entries(cors)) reply.header(k, v);
|
|
188
|
+
const statusCode = err.statusCode ?? 400;
|
|
189
|
+
reply.code(statusCode).type('application/json').send({
|
|
190
|
+
// Use the HTTP status text (e.g. "Bad Request" for 400)
|
|
191
|
+
// rather than err.name (which for FastifyError is the
|
|
192
|
+
// unhelpful string "FastifyError"). Matches Fastify's
|
|
193
|
+
// default error-body shape that pre-fix clients were
|
|
194
|
+
// parsing.
|
|
195
|
+
error: STATUS_CODES[statusCode] || 'Error',
|
|
196
|
+
code: err.code,
|
|
197
|
+
message: err.message,
|
|
198
|
+
statusCode,
|
|
199
|
+
});
|
|
172
200
|
}
|
|
173
201
|
};
|
|
174
202
|
|
|
@@ -735,6 +763,48 @@ export function createServer(options = {}) {
|
|
|
735
763
|
fastify.options('/', handleOptions);
|
|
736
764
|
fastify.post('/', writeRateLimit, handlePost);
|
|
737
765
|
|
|
766
|
+
// Server-root landing page: seed /index.html and a public-read /.acl
|
|
767
|
+
// on first start (skip-if-exists, so operator-provided files are
|
|
768
|
+
// preserved). See #433 / #276. Skipped in read-only deployments so
|
|
769
|
+
// startup never mutates DATA_ROOT.
|
|
770
|
+
if (!options.readOnly) {
|
|
771
|
+
fastify.addHook('onReady', async () => {
|
|
772
|
+
// A missing or unreadable package.json (some production bundles
|
|
773
|
+
// omit it) shouldn't block seeding; fall back to "unknown".
|
|
774
|
+
let version = 'unknown';
|
|
775
|
+
try {
|
|
776
|
+
const pkg = await readFile(join(__dirname, '..', 'package.json'), 'utf8');
|
|
777
|
+
({ version } = JSON.parse(pkg));
|
|
778
|
+
} catch (err) {
|
|
779
|
+
fastify.log.warn({ err }, 'Failed to read package.json version; seeding server root with version=unknown');
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
try {
|
|
783
|
+
await seedServerRoot({
|
|
784
|
+
version,
|
|
785
|
+
singleUser,
|
|
786
|
+
idp: idpEnabled,
|
|
787
|
+
singleUserName,
|
|
788
|
+
enabled: {
|
|
789
|
+
idp: idpEnabled,
|
|
790
|
+
nostr: nostrEnabled,
|
|
791
|
+
webrtc: webrtcEnabled,
|
|
792
|
+
activitypub: activitypubEnabled,
|
|
793
|
+
git: gitEnabled,
|
|
794
|
+
pay: payEnabled,
|
|
795
|
+
notifications: notificationsEnabled,
|
|
796
|
+
mashlib: mashlibEnabled,
|
|
797
|
+
mongo: mongoEnabled,
|
|
798
|
+
tunnel: tunnelEnabled,
|
|
799
|
+
terminal: terminalEnabled
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
} catch (err) {
|
|
803
|
+
fastify.log.warn({ err }, 'Failed to seed server root');
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
|
|
738
808
|
// Single-user mode: create pod on startup if it doesn't exist
|
|
739
809
|
if (singleUser) {
|
|
740
810
|
fastify.addHook('onReady', async () => {
|
|
@@ -914,7 +984,7 @@ export function createServer(options = {}) {
|
|
|
914
984
|
*/
|
|
915
985
|
async function createRootPodStructure(webId, podUri, issuer, displayName) {
|
|
916
986
|
const { generateProfile, generatePreferences, generateTypeIndex, serialize } = await import('./webid/profile.js');
|
|
917
|
-
const { generateOwnerAcl, generatePrivateAcl, generateInboxAcl, generatePublicFolderAcl, serializeAcl } = await import('./wac/parser.js');
|
|
987
|
+
const { generateOwnerAcl, generatePrivateAcl, generateInboxAcl, generatePublicFolderAcl, serializeAcl, relativizeOwnerWebId } = await import('./wac/parser.js');
|
|
918
988
|
|
|
919
989
|
// Create directories at root
|
|
920
990
|
await storage.createContainer('/inbox/');
|
|
@@ -937,27 +1007,35 @@ export function createServer(options = {}) {
|
|
|
937
1007
|
const privateTypeIndex = generateTypeIndex(`${podUri}settings/privateTypeIndex.jsonld`, { listed: false });
|
|
938
1008
|
await storage.write('/settings/privateTypeIndex.jsonld', serialize(privateTypeIndex));
|
|
939
1009
|
|
|
940
|
-
// ACL files
|
|
941
|
-
|
|
1010
|
+
// ACL files. Both `accessTo` (#428) and `acl:agent` (#430) are written
|
|
1011
|
+
// relatively so the on-disk pod isn't host-locked to whichever interface
|
|
1012
|
+
// the server happened to bind on first start. The owner WebID is
|
|
1013
|
+
// derived from the absolute `webId` and each .acl's location by
|
|
1014
|
+
// `relativizeOwnerWebId`, so any current or future profile layout
|
|
1015
|
+
// (modern `profile/card.jsonld#me`, legacy `profile/card#me`, etc.)
|
|
1016
|
+
// produces the correct relative IRI without hardcoding.
|
|
1017
|
+
const owner = aclBase => relativizeOwnerWebId(webId, podUri, aclBase);
|
|
1018
|
+
|
|
1019
|
+
const rootAcl = generateOwnerAcl('./', owner(''), true);
|
|
942
1020
|
await storage.write('/.acl', serializeAcl(rootAcl));
|
|
943
1021
|
|
|
944
|
-
const privateAcl = generatePrivateAcl(
|
|
1022
|
+
const privateAcl = generatePrivateAcl('./', owner('private/'));
|
|
945
1023
|
await storage.write('/private/.acl', serializeAcl(privateAcl));
|
|
946
1024
|
|
|
947
|
-
const settingsAcl = generatePrivateAcl(
|
|
1025
|
+
const settingsAcl = generatePrivateAcl('./', owner('settings/'));
|
|
948
1026
|
await storage.write('/settings/.acl', serializeAcl(settingsAcl));
|
|
949
1027
|
|
|
950
1028
|
// publicTypeIndex: public read, overrides the private default inherited from /settings/
|
|
951
|
-
const publicTypeIndexAcl = generateOwnerAcl(
|
|
1029
|
+
const publicTypeIndexAcl = generateOwnerAcl('./publicTypeIndex.jsonld', owner('settings/'), false);
|
|
952
1030
|
await storage.write('/settings/publicTypeIndex.jsonld.acl', serializeAcl(publicTypeIndexAcl));
|
|
953
1031
|
|
|
954
|
-
const inboxAcl = generateInboxAcl(
|
|
1032
|
+
const inboxAcl = generateInboxAcl('./', owner('inbox/'));
|
|
955
1033
|
await storage.write('/inbox/.acl', serializeAcl(inboxAcl));
|
|
956
1034
|
|
|
957
|
-
const publicAcl = generatePublicFolderAcl(
|
|
1035
|
+
const publicAcl = generatePublicFolderAcl('./', owner('public/'));
|
|
958
1036
|
await storage.write('/public/.acl', serializeAcl(publicAcl));
|
|
959
1037
|
|
|
960
|
-
const profileAcl = generatePublicFolderAcl(
|
|
1038
|
+
const profileAcl = generatePublicFolderAcl('./', owner('profile/'));
|
|
961
1039
|
await storage.write('/profile/.acl', serializeAcl(profileAcl));
|
|
962
1040
|
|
|
963
1041
|
// Note: Quota not initialized for root-level pods (no user directory)
|