fedipod 1.47.0 → 1.48.1

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.
@@ -32544,55 +32544,6 @@ var REL = {
32544
32544
  };
32545
32545
 
32546
32546
  // lib/pod/urls.mjs
32547
- function apUrls(remotePod, root, { publicBase = null } = {}) {
32548
- if (!root) throw new Error("apUrls: a container root is required \u2014 the caller states it, this library does not guess");
32549
- const base = remotePod.endsWith("/") ? remotePod : remotePod + "/";
32550
- const home = base + (root.endsWith("/") ? root : root + "/");
32551
- const face = publicBase ? publicBase.endsWith("/") ? publicBase : publicBase + "/" : home;
32552
- const urls = {
32553
- base,
32554
- home,
32555
- webfinger: base + ".well-known/webfinger",
32556
- actor: face + "ap/actor",
32557
- inbox: face + "ap/inbox/",
32558
- outbox: face + "ap/outbox",
32559
- followers: face + "ap/followers",
32560
- following: face + "ap/following",
32561
- notes: face + "ap/notes/",
32562
- privateNotes: face + "ap/private/",
32563
- featured: face + "ap/featured",
32564
- // FEP-1b12: the moderator roster a recipient validates announced
32565
- // moderation against. Published only when moderators are configured.
32566
- moderators: face + "ap/moderators",
32567
- // FEP-4ccd and FEP-c648: follows in limbo and the block list, as
32568
- // collections. They live in the private container so the owner-only ACL
32569
- // is inherited, not re-stated per document.
32570
- pendingFollowers: face + "ap/private/pending-followers",
32571
- pendingFollowing: face + "ap/private/pending-following",
32572
- blocked: face + "ap/private/blocked",
32573
- // The outbox as its owner reads it (every message, §5.1) and what the
32574
- // owner has liked (§5.5): the owner's alone, so they sit here too — and
32575
- // at the pod's own address even for a fronted identity, because the owner
32576
- // reads them there, with a credential the pod checks.
32577
- ownOutbox: home + "ap/private/outbox",
32578
- liked: home + "ap/private/liked",
32579
- // The inbox as its owner reads it (§5.2): what the account received,
32580
- // kept by the drain as a paged collection beside the archive.
32581
- ownInbox: home + "ap/private/inbox",
32582
- profileHtml: face + "ap/profile.html",
32583
- // Media stays on the pod even when fronted: attachment urls are not
32584
- // identity-checked by remotes, and proxying blobs would be pure cost.
32585
- media: home + "ap/media/",
32586
- state: home + "ap-state/"
32587
- };
32588
- if (publicBase) {
32589
- urls.podHome = home;
32590
- urls.publicHome = face;
32591
- urls.toPod = (u) => typeof u === "string" && u.startsWith(face) ? home + u.slice(face.length) : u;
32592
- urls.toPublic = (u) => typeof u === "string" && u.startsWith(home) ? face + u.slice(home.length) : u;
32593
- }
32594
- return urls;
32595
- }
32596
32547
  function podBaseOfWebId(webId) {
32597
32548
  const u = new URL(webId);
32598
32549
  u.hash = "";
@@ -33048,6 +32999,33 @@ var PodTransport = class {
33048
32999
  await this.writeAboutWebId(podBase, { inserts: missing, deletes: stale });
33049
33000
  return true;
33050
33001
  }
33002
+ /**
33003
+ * The account taken out of the WebID profile again, as linkAccountInProfile
33004
+ * wrote it: the foaf:account link, what the profile says of the actor, and
33005
+ * `outbox` when it is the one named. From every document of the profile that
33006
+ * holds any of it, each write checked. Returns how many documents changed.
33007
+ */
33008
+ async unlinkAccountInProfile({ actorUrl, outbox = null }) {
33009
+ const me = namedNode2(this.webId);
33010
+ const actor = namedNode2(actorUrl);
33011
+ let changed = 0;
33012
+ for (const d of await this.profileDocs(podBaseOfWebId(this.webId))) {
33013
+ if (!d.g) continue;
33014
+ const gone = [
33015
+ ...d.g.statementsMatching(me, FOAF("account"), actor),
33016
+ ...d.g.statementsMatching(actor, RDF3("type"), FOAF("OnlineAccount")),
33017
+ ...d.g.statementsMatching(actor, RDF3("type"), AS("Person")),
33018
+ ...d.g.statementsMatching(actor, RDF3("type"), AS("Group")),
33019
+ ...d.g.statementsMatching(actor, FOAF("accountName"), null),
33020
+ ...outbox ? d.g.statementsMatching(me, AS("outbox"), namedNode2(outbox)) : []
33021
+ ].map((st2) => [st2.subject, st2.predicate, st2.object]);
33022
+ if (!gone.length) continue;
33023
+ const status = await this.writeRdfChecked(d.url, d.g, { deletes: gone, mustDescribe: d.profile ? this.webId : null });
33024
+ if (status >= 300) throw new Error(`not written: ${d.url} \u2192 ${status}`);
33025
+ changed++;
33026
+ }
33027
+ return changed;
33028
+ }
33051
33029
  /**
33052
33030
  * An N3 Patch of exactly these statements, or false when the pod will not
33053
33031
  * take one and the caller should write the document instead.
@@ -33727,7 +33705,7 @@ async function moveIn(answers, { session, onStep = () => {
33727
33705
  return { config, address: `@${handle}@${new URL(origin).host}`, movedFrom: config.movedFrom };
33728
33706
  }
33729
33707
 
33730
- // packages/fedipod-bb/src/setup.mjs
33708
+ // node_modules/fedipod-bb/src/setup.mjs
33731
33709
  var setup_exports = {};
33732
33710
  __export(setup_exports, {
33733
33711
  ROOT: () => ROOT,
@@ -33740,7 +33718,7 @@ __export(setup_exports, {
33740
33718
  writeForumConfig: () => writeForumConfig
33741
33719
  });
33742
33720
 
33743
- // lib/pod/containers.mjs
33721
+ // node_modules/fedipod/lib/pod/containers.mjs
33744
33722
  var KEEP = { keep: true };
33745
33723
  var KEEP_CT = "application/json";
33746
33724
  var keepUrl = (base) => `${base}.keep`;
@@ -33986,7 +33964,58 @@ var node_crypto_default = {
33986
33964
  scryptSync
33987
33965
  };
33988
33966
 
33989
- // packages/fedipod-bb/src/urls.mjs
33967
+ // node_modules/fedipod/lib/pod/urls.mjs
33968
+ function apUrls2(remotePod, root, { publicBase = null } = {}) {
33969
+ if (!root) throw new Error("apUrls: a container root is required \u2014 the caller states it, this library does not guess");
33970
+ const base = remotePod.endsWith("/") ? remotePod : remotePod + "/";
33971
+ const home = base + (root.endsWith("/") ? root : root + "/");
33972
+ const face = publicBase ? publicBase.endsWith("/") ? publicBase : publicBase + "/" : home;
33973
+ const urls = {
33974
+ base,
33975
+ home,
33976
+ webfinger: base + ".well-known/webfinger",
33977
+ actor: face + "ap/actor",
33978
+ inbox: face + "ap/inbox/",
33979
+ outbox: face + "ap/outbox",
33980
+ followers: face + "ap/followers",
33981
+ following: face + "ap/following",
33982
+ notes: face + "ap/notes/",
33983
+ privateNotes: face + "ap/private/",
33984
+ featured: face + "ap/featured",
33985
+ // FEP-1b12: the moderator roster a recipient validates announced
33986
+ // moderation against. Published only when moderators are configured.
33987
+ moderators: face + "ap/moderators",
33988
+ // FEP-4ccd and FEP-c648: follows in limbo and the block list, as
33989
+ // collections. They live in the private container so the owner-only ACL
33990
+ // is inherited, not re-stated per document.
33991
+ pendingFollowers: face + "ap/private/pending-followers",
33992
+ pendingFollowing: face + "ap/private/pending-following",
33993
+ blocked: face + "ap/private/blocked",
33994
+ // The outbox as its owner reads it (every message, §5.1) and what the
33995
+ // owner has liked (§5.5): the owner's alone, so they sit here too — and
33996
+ // at the pod's own address even for a fronted identity, because the owner
33997
+ // reads them there, with a credential the pod checks.
33998
+ ownOutbox: home + "ap/private/outbox",
33999
+ liked: home + "ap/private/liked",
34000
+ // The inbox as its owner reads it (§5.2): what the account received,
34001
+ // kept by the drain as a paged collection beside the archive.
34002
+ ownInbox: home + "ap/private/inbox",
34003
+ profileHtml: face + "ap/profile.html",
34004
+ // Media stays on the pod even when fronted: attachment urls are not
34005
+ // identity-checked by remotes, and proxying blobs would be pure cost.
34006
+ media: home + "ap/media/",
34007
+ state: home + "ap-state/"
34008
+ };
34009
+ if (publicBase) {
34010
+ urls.podHome = home;
34011
+ urls.publicHome = face;
34012
+ urls.toPod = (u) => typeof u === "string" && u.startsWith(face) ? home + u.slice(face.length) : u;
34013
+ urls.toPublic = (u) => typeof u === "string" && u.startsWith(home) ? face + u.slice(home.length) : u;
34014
+ }
34015
+ return urls;
34016
+ }
34017
+
34018
+ // node_modules/fedipod-bb/src/urls.mjs
33990
34019
  var ROOT = "fedipod-bb/";
33991
34020
  var SLUG = /^[a-z0-9][a-z0-9-]{0,62}$/u;
33992
34021
  var isSlug = (s) => typeof s === "string" && SLUG.test(s);
@@ -33996,7 +34025,7 @@ var cacheKey = (postId) => node_crypto_default.createHash("sha256").update(Strin
33996
34025
  function forumUrls(remotePod, root = ROOT, { publicBase = null, front = null, handle = null } = {}) {
33997
34026
  const origin = front ? String(front).replace(/\/$/u, "") : null;
33998
34027
  if (origin && !handle) throw new Error("forumUrls: a fronted forum needs its handle");
33999
- const site = apUrls(remotePod, root, { publicBase: publicBase || (origin ? `${origin}/u/${handle}/` : null) });
34028
+ const site = apUrls2(remotePod, root, { publicBase: publicBase || (origin ? `${origin}/u/${handle}/` : null) });
34000
34029
  const face = site.actor.slice(0, -"ap/actor".length);
34001
34030
  site.front = origin;
34002
34031
  site.categories = face + "ap/categories";
@@ -34015,7 +34044,7 @@ function forumUrls(remotePod, root = ROOT, { publicBase = null, front = null, ha
34015
34044
  return site;
34016
34045
  }
34017
34046
  function categoryUrls(remotePod, root, { publicBase = null, forumInbox = null } = {}) {
34018
- const urls = apUrls(remotePod, root, { publicBase });
34047
+ const urls = apUrls2(remotePod, root, { publicBase });
34019
34048
  const face = urls.actor.slice(0, -"ap/actor".length);
34020
34049
  urls.forumInbox = forumInbox || urls.inbox;
34021
34050
  urls.topics = face + "ap/topics";
@@ -34034,7 +34063,7 @@ function categoryUrls(remotePod, root, { publicBase = null, forumInbox = null }
34034
34063
  return urls;
34035
34064
  }
34036
34065
 
34037
- // packages/fedipod-bb/src/provision.mjs
34066
+ // node_modules/fedipod-bb/src/provision.mjs
34038
34067
  async function provisionForum(remote, site, { moderatorWebIds = [] } = {}) {
34039
34068
  await provisionPrivate(remote, site);
34040
34069
  await provisionPublic(remote, site.notes);
@@ -34054,7 +34083,7 @@ async function provisionCategory(remote, cat, { memberWebIds = null } = {}) {
34054
34083
  }
34055
34084
  }
34056
34085
 
34057
- // packages/fedipod-bb/src/setup.mjs
34086
+ // node_modules/fedipod-bb/src/setup.mjs
34058
34087
  function forumConfig(existing = {}, {
34059
34088
  remotePod,
34060
34089
  root = ROOT,
@@ -34390,7 +34419,7 @@ async function readIssuer(actorUrl, fetchImpl = fetch) {
34390
34419
  }
34391
34420
  }
34392
34421
 
34393
- // lib/session/oidc-session.mjs
34422
+ // node_modules/fediverse-session/oidc-session.mjs
34394
34423
  var STORE = "session";
34395
34424
  var b64u = (buf) => btoa(String.fromCharCode(...new Uint8Array(buf))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
34396
34425
  var enc = (o) => b64u(new TextEncoder().encode(JSON.stringify(o)));