@kehto/paja 0.21.2 → 0.21.3
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/README.md +5 -0
- package/dist/browser-host.js +16 -6
- package/dist/browser-host.js.map +1 -1
- package/dist/{chunk-LGPTNOM7.js → chunk-HG2CUTQC.js} +1 -1
- package/dist/chunk-HG2CUTQC.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-LGPTNOM7.js.map +0 -1
package/README.md
CHANGED
|
@@ -397,6 +397,11 @@ boundary and is advertised because each request may provide server locations
|
|
|
397
397
|
without a host default. For example, reads accept
|
|
398
398
|
`blossom:<hash>.gbc?xs=cdn.example&as=<pubkey>&sz=32768` and
|
|
399
399
|
`blossom:sha256:<hash>.gbc?xs=cdn.example&sz=32768`.
|
|
400
|
+
Internal event-reference keys and synthesized references use `blossom:<hash>`.
|
|
401
|
+
Napplet-supplied resource cache keys remain unchanged, as NAP-RESOURCE does not
|
|
402
|
+
require URL canonicalization. Actual `sha256:` alias reads/server-resolution
|
|
403
|
+
requests emit `KEHTO_COMPAT_BLOSSOM_SHA256` once per host module lifetime, with
|
|
404
|
+
replacement guidance and no URL/hash payload. Canonical requests stay quiet.
|
|
400
405
|
Repeated `xs` and `as` are supported without an observed event. Paja accepts only
|
|
401
406
|
public-looking HTTPS origin hints (scheme-less domains use HTTPS), discards
|
|
402
407
|
invalid/private literals, and deduplicates them. Unlike BUD-10's suggested HTTP
|
package/dist/browser-host.js
CHANGED
|
@@ -12663,12 +12663,20 @@ function parsePajaBlossomUri(value) {
|
|
|
12663
12663
|
const servers = [];
|
|
12664
12664
|
for (const server of params.getAll("xs")) appendHint(servers, server);
|
|
12665
12665
|
const hash = match[1].toLowerCase();
|
|
12666
|
-
return { hash, canonical: `blossom
|
|
12666
|
+
return { hash, canonical: `blossom:${hash}`, extension: match[2], servers, authors, expectedSize };
|
|
12667
12667
|
}
|
|
12668
12668
|
function appendHint(target, value) {
|
|
12669
12669
|
if (target.length < MAX_HINTS && !target.includes(value)) target.push(value);
|
|
12670
12670
|
}
|
|
12671
12671
|
|
|
12672
|
+
// src/browser-blossom-compat.ts
|
|
12673
|
+
var warned = false;
|
|
12674
|
+
function warnLegacyBlossomPrefix(value) {
|
|
12675
|
+
if (warned || !/^blossom:sha256:/i.test(value)) return;
|
|
12676
|
+
warned = true;
|
|
12677
|
+
console.warn("[KEHTO_COMPAT_BLOSSOM_SHA256] Replace blossom:sha256:<hash> with blossom:<hash>; preserve any extension and hints. Warning shown once per host module lifetime.");
|
|
12678
|
+
}
|
|
12679
|
+
|
|
12672
12680
|
// src/browser-resource.ts
|
|
12673
12681
|
var PAJA_RESOURCE_MAX_BYTES = 10 * 1024 * 1024;
|
|
12674
12682
|
var PAJA_RESOURCE_MAX_URLS = 100;
|
|
@@ -12809,6 +12817,7 @@ async function fetchBlossomResource(value, signal, requestServers, windowId, opt
|
|
|
12809
12817
|
if (!parsed) {
|
|
12810
12818
|
throw new ResourceServiceError("invalid-request", "invalid Blossom URI");
|
|
12811
12819
|
}
|
|
12820
|
+
warnLegacyBlossomPrefix(value);
|
|
12812
12821
|
if (parsed.expectedSize !== void 0 && parsed.expectedSize > PAJA_RESOURCE_MAX_BYTES) throw resourceTooLarge();
|
|
12813
12822
|
const expectedHash = parsed.hash;
|
|
12814
12823
|
const configuredServers = await options.getBlossomServers?.({ url: value, windowId }) ?? [];
|
|
@@ -15570,7 +15579,7 @@ function nappletNamespacePrelude(domains, normalizeIntentUri2) {
|
|
|
15570
15579
|
const legacy = /* @__PURE__ */ new Map();
|
|
15571
15580
|
const pending = [];
|
|
15572
15581
|
let draining = false;
|
|
15573
|
-
let
|
|
15582
|
+
let warned2 = false;
|
|
15574
15583
|
function drain() {
|
|
15575
15584
|
if (draining) return;
|
|
15576
15585
|
draining = true;
|
|
@@ -15581,8 +15590,8 @@ function nappletNamespacePrelude(domains, normalizeIntentUri2) {
|
|
|
15581
15590
|
const [delivery] = pending.splice(index, 1);
|
|
15582
15591
|
const canonical = handlers.size > 0;
|
|
15583
15592
|
const recipients = canonical ? [...handlers] : [...legacy.entries()].filter(([, topic]) => topic === delivery.convention).map(([handler]) => handler);
|
|
15584
|
-
if (!canonical && !
|
|
15585
|
-
|
|
15593
|
+
if (!canonical && !warned2) {
|
|
15594
|
+
warned2 = true;
|
|
15586
15595
|
console.warn("[KEHTO_COMPAT_INTENT_INC] Intent delivered to a legacy INC listener. Migrate to window.napplet.intent.onDelivery. See docs/compatibility.md.");
|
|
15587
15596
|
}
|
|
15588
15597
|
for (const handler of recipients) {
|
|
@@ -18702,6 +18711,7 @@ function createPajaBlossomEventResolver(options) {
|
|
|
18702
18711
|
async function getServers(url, windowId) {
|
|
18703
18712
|
const parsed = parseBlossomReference(url);
|
|
18704
18713
|
if (!parsed) return [];
|
|
18714
|
+
warnLegacyBlossomPrefix(url);
|
|
18705
18715
|
const canonical = parsed.url;
|
|
18706
18716
|
const contexts = canonical && windowId ? windows.get(windowId)?.get(canonical) ?? [] : [];
|
|
18707
18717
|
const servers = [...parsed.servers];
|
|
@@ -18823,7 +18833,7 @@ function extractEventResourceLocations(event) {
|
|
|
18823
18833
|
if ((tag[0] === "resource" || tag[0] === "r") && typeof tag[1] === "string") {
|
|
18824
18834
|
add(tag[1]);
|
|
18825
18835
|
} else if (tag[0] === "blossom" && typeof tag[1] === "string") {
|
|
18826
|
-
add(HEX_642.test(tag[1]) ? `blossom
|
|
18836
|
+
add(HEX_642.test(tag[1]) ? `blossom:${tag[1]}` : tag[1]);
|
|
18827
18837
|
}
|
|
18828
18838
|
}
|
|
18829
18839
|
const content = parseEventContent(event.content);
|
|
@@ -18838,7 +18848,7 @@ function extractEventResourceLocations(event) {
|
|
|
18838
18848
|
continue;
|
|
18839
18849
|
}
|
|
18840
18850
|
if (!isRecord5(entry)) continue;
|
|
18841
|
-
const value = stringValue(entry.uri) ?? stringValue(entry.url) ?? stringValue(entry.resource) ?? (isBlossomRecord(entry) && isHash(entry.sha256) ? `blossom
|
|
18851
|
+
const value = stringValue(entry.uri) ?? stringValue(entry.url) ?? stringValue(entry.resource) ?? (isBlossomRecord(entry) && isHash(entry.sha256) ? `blossom:${String(entry.sha256)}` : void 0);
|
|
18842
18852
|
add(value, [...contentServers, ...stringList2(entry.servers)], stringList2(entry.authors));
|
|
18843
18853
|
}
|
|
18844
18854
|
}
|