fedipod 1.5.0 → 1.7.0

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.
Files changed (41) hide show
  1. package/README.md +5 -5
  2. package/architecture.md +4 -4
  3. package/cli.md +7 -0
  4. package/{installed-agent.md → device-agent.md} +6 -4
  5. package/gateway.md +1 -1
  6. package/groups.md +2 -2
  7. package/gui.md +2 -2
  8. package/lib/client/masto/index.mjs +7 -1
  9. package/lib/client/masto/timelines.mjs +1 -1
  10. package/lib/client/oidc-auth.mjs +5 -3
  11. package/lib/core/publisher/index.mjs +1 -1
  12. package/lib/core/wire.mjs +4 -1
  13. package/lib/device/admin/routes/gateway.mjs +1 -1
  14. package/lib/device/admin/routes/lifecycle.mjs +1 -1
  15. package/lib/device/admin/routes/setup.mjs +20 -1
  16. package/lib/device/admin/surface.mjs +25 -17
  17. package/lib/device/cli/commands/setup.mjs +53 -21
  18. package/lib/device/setup.mjs +105 -25
  19. package/lib/gateway/front-core.mjs +23 -11
  20. package/lib/pod/root.mjs +12 -1
  21. package/lib/server/embed.mjs +23 -6
  22. package/package.json +2 -2
  23. package/run-agent.mjs +1 -1
  24. package/vendor/gate.cjs +5 -2
  25. package/web/admin/setup/index.html +25 -2
  26. package/web/admin/setup/setup.js +30 -1
  27. package/web/app/README.md +2 -2
  28. package/web/app/admin-facade.mjs +1 -1
  29. package/web/app/agent.mjs +3 -3
  30. package/web/app/boot.mjs +2 -2
  31. package/web/app/dist/boot.js +43 -31
  32. package/web/app/dist/boot.js.map +3 -3
  33. package/web/app/dist/sw.js +4 -4
  34. package/web/app/dist/sw.js.map +2 -2
  35. package/web/app/index.html +1 -1
  36. package/web/app/signup.mjs +5 -3
  37. package/web/app/site/admin/setup/index.html +25 -2
  38. package/web/app/site/admin/setup/setup.js +30 -1
  39. package/web/app/site/boot.js +1 -1
  40. package/web/app/site/index.html +1 -1
  41. package/web/app/site/sw.js +3 -3
@@ -33208,6 +33208,47 @@ async function provisionKey(pod, { stateUrl, keysUrl, envelope }) {
33208
33208
  await pod.putJson(keysUrl, envelope, "application/json");
33209
33209
  }
33210
33210
 
33211
+ // lib/pod/root.mjs
33212
+ var OWNER_LOOKUP_MS = 5e3;
33213
+ var PUBLIC_DOC_MAX_BYTES = 1024 * 1024;
33214
+ async function podLayout(fetchImpl, providerOrigin, { timeoutMs = OWNER_LOOKUP_MS } = {}) {
33215
+ let origin;
33216
+ try {
33217
+ origin = new URL(providerOrigin).origin;
33218
+ } catch {
33219
+ return null;
33220
+ }
33221
+ let res;
33222
+ try {
33223
+ res = await fetchImpl(
33224
+ `${origin}/.well-known/solid`,
33225
+ { headers: { accept: "text/turtle" }, signal: AbortSignal.timeout(timeoutMs) }
33226
+ );
33227
+ } catch {
33228
+ return null;
33229
+ }
33230
+ if (res.status === 501) return "host";
33231
+ if (res.status !== 200) return null;
33232
+ let body = "";
33233
+ try {
33234
+ body = await readCapped(res, 64 * 1024);
33235
+ } catch {
33236
+ return null;
33237
+ }
33238
+ return /ns\/pim\/space#Storage|pim:Storage/u.test(body) ? "path" : null;
33239
+ }
33240
+ async function resourceExists(fetchImpl, url, { timeoutMs = OWNER_LOOKUP_MS } = {}) {
33241
+ try {
33242
+ const res = await fetchImpl(
33243
+ url,
33244
+ { headers: { accept: "application/activity+json" }, signal: AbortSignal.timeout(timeoutMs) }
33245
+ );
33246
+ return !!res && res.status === 200;
33247
+ } catch {
33248
+ return false;
33249
+ }
33250
+ }
33251
+
33211
33252
  // web/app/idb-kv.mjs
33212
33253
  var DB = "fedipod-accounts";
33213
33254
  function open() {
@@ -33310,6 +33351,7 @@ async function signUp(answers, { onStep = () => {
33310
33351
  acct.running("checking your pod");
33311
33352
  const head = await fetch(brought, { method: "HEAD" }).catch(() => null);
33312
33353
  if (!head || head.status >= 400) throw new Error(`the pod at ${brought} did not answer (HTTP ${head?.status || "no response"})`);
33354
+ if (await resourceExists(fetch, actorUrlFor(brought))) throw new Error("The pod already hosts a FediPod account. If you want a second account, put it on a different pod.");
33313
33355
  prog.pod = brought;
33314
33356
  acct.skip("using the pod you brought");
33315
33357
  }
@@ -33321,7 +33363,7 @@ async function signUp(answers, { onStep = () => {
33321
33363
  const pathPod = new URL(pod).pathname !== "/";
33322
33364
  const fronted = pathPod || wantsFront;
33323
33365
  if (fronted && !frontOrigin) {
33324
- throw new Error(`${pod} is a path on a shared host, so its address must live at a gateway, and this page has none.`);
33366
+ throw new Error(`${pod} is a suffix-based host, so its address must live at a gateway, and this page has none.`);
33325
33367
  }
33326
33368
  if (pathPod && !wantsFront) await assertFrontNameFree(frontOrigin, handle);
33327
33369
  const actorUrl = actorUrlFor(pod);
@@ -33450,36 +33492,6 @@ function podBaseOfWebId(webId) {
33450
33492
  return `${u.origin}${dir.endsWith("/") ? dir : dir + "/"}`;
33451
33493
  }
33452
33494
 
33453
- // lib/pod/root.mjs
33454
- var OWNER_LOOKUP_MS = 5e3;
33455
- var PUBLIC_DOC_MAX_BYTES = 1024 * 1024;
33456
- async function podLayout(fetchImpl, providerOrigin, { timeoutMs = OWNER_LOOKUP_MS } = {}) {
33457
- let origin;
33458
- try {
33459
- origin = new URL(providerOrigin).origin;
33460
- } catch {
33461
- return null;
33462
- }
33463
- let res;
33464
- try {
33465
- res = await fetchImpl(
33466
- `${origin}/.well-known/solid`,
33467
- { headers: { accept: "text/turtle" }, signal: AbortSignal.timeout(timeoutMs) }
33468
- );
33469
- } catch {
33470
- return null;
33471
- }
33472
- if (res.status === 501) return "host";
33473
- if (res.status !== 200) return null;
33474
- let body = "";
33475
- try {
33476
- body = await readCapped(res, 64 * 1024);
33477
- } catch {
33478
- return null;
33479
- }
33480
- return /ns\/pim\/space#Storage|pim:Storage/u.test(body) ? "path" : null;
33481
- }
33482
-
33483
33495
  // web/app/oidc-session.mjs
33484
33496
  var DB2 = "fedipod-oidc";
33485
33497
  var STORE = "session";