fedipod-server 0.14.0 → 0.14.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.
- package/lib/core/intake/activities.mjs +10 -2
- package/lib/core/intake/index.mjs +1 -1
- package/lib/core/intake/notes.mjs +4 -2
- package/lib/core/social.mjs +17 -6
- package/lib/gateway/front-core.mjs +8 -1
- package/lib/pod/inbox.mjs +4 -1
- package/package.json +1 -1
- package/web/app/agent.mjs +5 -1
- package/web/app/dist/sw.js +18 -12
- package/web/app/dist/sw.js.map +2 -2
- package/web/app/site/sw.js +18 -12
package/web/app/site/sw.js
CHANGED
|
@@ -57393,7 +57393,7 @@ async function onUndo(intake, activity, actor, { trusted = false } = {}) {
|
|
|
57393
57393
|
await intake.republish({ followers: true });
|
|
57394
57394
|
intake.log(`unfollowed by ${actor}`);
|
|
57395
57395
|
}
|
|
57396
|
-
async function onCreate(intake, activity, actor) {
|
|
57396
|
+
async function onCreate(intake, activity, actor, { trusted = false } = {}) {
|
|
57397
57397
|
const objectId = typeof activity.object === "string" ? activity.object : activity.object?.id;
|
|
57398
57398
|
if (!objectId) return "Create without object id";
|
|
57399
57399
|
if (intake.store.isBlocked(objectId)) return `blocked domain (${objectId})`;
|
|
@@ -57402,7 +57402,8 @@ async function onCreate(intake, activity, actor) {
|
|
|
57402
57402
|
if (!intake.concernsUs(envelope, actor)) return `not addressed to us (${objectId})`;
|
|
57403
57403
|
const ingested = intake.store.getStatuses().some((x) => x.noteId === objectId && (x.kind === "timeline" || x.kind === "mention"));
|
|
57404
57404
|
if (!ingested) {
|
|
57405
|
-
const
|
|
57405
|
+
const inline = trusted && typeof activity.object === "object" && activity.object?.id === objectId ? activity.object : null;
|
|
57406
|
+
const rejected = await intake.ingestNote(objectId, actor, { inline });
|
|
57406
57407
|
if (rejected) return rejected;
|
|
57407
57408
|
}
|
|
57408
57409
|
if (intake.config.kind === "group") await intake.amplify(objectId, { activity });
|
|
@@ -57616,8 +57617,8 @@ function referencesOurObject(intake, activity) {
|
|
|
57616
57617
|
if (refs.some((r) => r.startsWith(intake.urls.notes))) return true;
|
|
57617
57618
|
return intake.config.kind === "group" && refs.some((r) => intake.store.getStatuses().some((s) => s.noteId === r));
|
|
57618
57619
|
}
|
|
57619
|
-
async function ingestNote(intake, objectId, actor, { via } = {}) {
|
|
57620
|
-
const note = await intake.fetchAP(objectId);
|
|
57620
|
+
async function ingestNote(intake, objectId, actor, { via, inline = null } = {}) {
|
|
57621
|
+
const note = inline || await intake.fetchAP(objectId);
|
|
57621
57622
|
if (!note) return `object fetch failed (${objectId})`;
|
|
57622
57623
|
if (note.id !== objectId || !isContentType(note.type)) return `object not verifiable content (${objectId}, ${note.type})`;
|
|
57623
57624
|
const { attachmentsOf: attachmentsOf3, titledContent: titledContent2 } = await Promise.resolve().then(() => (init_wire(), wire_exports));
|
|
@@ -63143,7 +63144,7 @@ var Intake = class {
|
|
|
63143
63144
|
case "Undo":
|
|
63144
63145
|
return this.onUndo(activity, actor, { trusted });
|
|
63145
63146
|
case "Create":
|
|
63146
|
-
return this.onCreate(activity, actor);
|
|
63147
|
+
return this.onCreate(activity, actor, { trusted });
|
|
63147
63148
|
case "Accept":
|
|
63148
63149
|
return this.onAccept(activity, actor, { trusted });
|
|
63149
63150
|
case "Like":
|
|
@@ -64122,7 +64123,7 @@ __export(social_exports, {
|
|
|
64122
64123
|
});
|
|
64123
64124
|
init_node_crypto();
|
|
64124
64125
|
init_wire();
|
|
64125
|
-
async function lookupWebFinger(acct) {
|
|
64126
|
+
async function lookupWebFinger(acct, { fetchImpl = null } = {}) {
|
|
64126
64127
|
const clean = String(acct || "").replace(/^acct:/, "");
|
|
64127
64128
|
const at = clean.lastIndexOf("@");
|
|
64128
64129
|
if (at < 1) return null;
|
|
@@ -64130,9 +64131,8 @@ async function lookupWebFinger(acct) {
|
|
|
64130
64131
|
if (!host || /[/\\?#]/.test(host)) return null;
|
|
64131
64132
|
const { safeFetch: safeFetch2, readCapped: readCapped3 } = await Promise.resolve().then(() => (init_safefetch(), safefetch_exports));
|
|
64132
64133
|
const url = `https://${host}/.well-known/webfinger?resource=${encodeURIComponent(`acct:${clean}`)}`;
|
|
64133
|
-
const
|
|
64134
|
-
|
|
64135
|
-
}).catch(() => null);
|
|
64134
|
+
const headers = { accept: "application/jrd+json, application/json" };
|
|
64135
|
+
const res = await (fetchImpl ? fetchImpl(url, { headers }) : safeFetch2(url, { headers })).catch(() => null);
|
|
64136
64136
|
if (!res || res.status >= 400) return null;
|
|
64137
64137
|
let jrd2;
|
|
64138
64138
|
try {
|
|
@@ -64168,13 +64168,15 @@ async function resolveHandle(agent2, handle7) {
|
|
|
64168
64168
|
const clean = String(handle7 || "").replace(/^@/, "");
|
|
64169
64169
|
if (!/^[^@]+@[^@]+$/.test(clean)) throw new Error("handle must look like user@host");
|
|
64170
64170
|
if (agent2.store.isBlocked("https://" + clean.split("@")[1] + "/")) throw new Error("domain is blocked");
|
|
64171
|
-
const
|
|
64171
|
+
const remote = agent2.intake?.deliverer?.signedFetch ? (u, i) => agent2.intake.deliverer.signedFetch(u, i) : null;
|
|
64172
|
+
const lookup2 = (a) => lookupWebFinger(a, { fetchImpl: remote });
|
|
64173
|
+
const jrd2 = await lookup2("acct:" + clean);
|
|
64172
64174
|
const self2 = selfLink(jrd2);
|
|
64173
64175
|
if (!self2?.href) throw new Error(`webfinger found no actor for ${clean}`);
|
|
64174
64176
|
const doc = await agent2.intake.fetchAP(self2.href);
|
|
64175
64177
|
if (!doc?.id) throw new Error(`actor document unusable for ${clean}`);
|
|
64176
64178
|
if (agent2.store.isBlocked(doc.id)) throw new Error("actor is blocked");
|
|
64177
|
-
await confirmDelegation(clean.slice(clean.lastIndexOf("@") + 1), doc);
|
|
64179
|
+
await confirmDelegation(clean.slice(clean.lastIndexOf("@") + 1), doc, lookup2);
|
|
64178
64180
|
await cacheCounts(agent2, doc);
|
|
64179
64181
|
return doc;
|
|
64180
64182
|
}
|
|
@@ -69764,7 +69766,11 @@ var BrowserAgent = class _BrowserAgent {
|
|
|
69764
69766
|
deliverer: this.deliverer,
|
|
69765
69767
|
publicKeyPem: keys.rsaPublicPem,
|
|
69766
69768
|
assertionKey: null,
|
|
69767
|
-
log: this.log
|
|
69769
|
+
log: this.log,
|
|
69770
|
+
// Who a post names, resolved — the same lookup the installed agent
|
|
69771
|
+
// gives its publisher. Without it no mention from the browser ever
|
|
69772
|
+
// resolved: a direct message went to nobody, a mention notified no one.
|
|
69773
|
+
resolveMention: (h) => resolveHandle(this, h)
|
|
69768
69774
|
});
|
|
69769
69775
|
this.atproto = new BrowserAtproto({ store: this.store, actorId: this.urls.actor, log: this.log });
|
|
69770
69776
|
this.publisher.atproto = this.atproto;
|