@fedify/fedify 0.8.0-dev.156 → 0.8.0-dev.163
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.
Potentially problematic release.
This version of @fedify/fedify might be problematic. Click here for more details.
- package/README.md +3 -3
- package/esm/mod.js +0 -2
- package/esm/runtime/docloader.js +26 -5
- package/package.json +1 -1
- package/types/mod.d.ts +0 -2
- package/types/mod.d.ts.map +1 -1
- package/types/runtime/docloader.d.ts.map +1 -1
package/README.md
CHANGED
@@ -35,13 +35,12 @@ If you want to know more about the project, please take a look at the following
|
|
35
35
|
resources:
|
36
36
|
|
37
37
|
- [Tutorial](https://fedify.dev/tutorial)
|
38
|
-
- [Manual](https://fedify.dev/manual)
|
39
|
-
([Unstable](https://unstable.fedify.dev/manual))
|
40
38
|
- [API reference][JSR]
|
41
39
|
- [Examples](https://github.com/dahlia/fedify/tree/main/examples)
|
42
40
|
|
43
41
|
If you have any questions, suggestions, or feedback, please feel free to
|
44
|
-
join our [Matrix chat space][Matrix] or [GitHub Discussions].
|
42
|
+
join our [Matrix chat space][Matrix] or [GitHub Discussions]. Or tag
|
43
|
+
[#Fedify] in the fediverse!
|
45
44
|
|
46
45
|
[^1]: You may already know some of the networks in the fediverse, such as
|
47
46
|
[Mastodon], [Lemmy], [Pixelfed], [PeerTube], and so on.
|
@@ -64,6 +63,7 @@ join our [Matrix chat space][Matrix] or [GitHub Discussions].
|
|
64
63
|
[HTTP Signatures]: https://tools.ietf.org/html/draft-cavage-http-signatures-12
|
65
64
|
[NodeInfo]: https://nodeinfo.diaspora.software/
|
66
65
|
[GitHub Discussions]: https://github.com/dahlia/fedify/discussions
|
66
|
+
[#Fedify]: https://elk.zone/mastodon.social/tags/fedify
|
67
67
|
[Mastodon]: https://joinmastodon.org/
|
68
68
|
[Lemmy]: https://join-lemmy.org/
|
69
69
|
[Pixelfed]: https://pixelfed.org/
|
package/esm/mod.js
CHANGED
@@ -25,8 +25,6 @@
|
|
25
25
|
*
|
26
26
|
* - [GitHub](https://github.com/dahlia/fedify)
|
27
27
|
* - [Tutorial](https://fedify.dev/tutorial)
|
28
|
-
* - [Manual](https://fedify.dev/manual)
|
29
|
-
* ([Unstable](https://unstable.fedify.dev/manual))
|
30
28
|
* - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
|
31
29
|
*
|
32
30
|
* [ActivityPub]: https://www.w3.org/TR/activitypub/
|
package/esm/runtime/docloader.js
CHANGED
@@ -28,7 +28,7 @@ function createRequest(url) {
|
|
28
28
|
headers: {
|
29
29
|
Accept: "application/activity+json, application/ld+json",
|
30
30
|
},
|
31
|
-
redirect: "
|
31
|
+
redirect: "manual",
|
32
32
|
});
|
33
33
|
}
|
34
34
|
function logRequest(request) {
|
@@ -67,7 +67,17 @@ async function getRemoteDocument(url, response) {
|
|
67
67
|
export async function fetchDocumentLoader(url) {
|
68
68
|
const request = createRequest(url);
|
69
69
|
logRequest(request);
|
70
|
-
const response = await fetch(request
|
70
|
+
const response = await fetch(request, {
|
71
|
+
// Since Bun has a bug that ignores the `Request.redirect` option,
|
72
|
+
// to work around it we specify `redirect: "manual"` here too:
|
73
|
+
// https://github.com/oven-sh/bun/issues/10754
|
74
|
+
redirect: "manual",
|
75
|
+
});
|
76
|
+
// Follow redirects manually to get the final URL:
|
77
|
+
if (response.status >= 300 && response.status < 400 &&
|
78
|
+
response.headers.has("Location")) {
|
79
|
+
return fetchDocumentLoader(response.headers.get("Location"));
|
80
|
+
}
|
71
81
|
return getRemoteDocument(url, response);
|
72
82
|
}
|
73
83
|
/**
|
@@ -82,13 +92,24 @@ export async function fetchDocumentLoader(url) {
|
|
82
92
|
*/
|
83
93
|
export function getAuthenticatedDocumentLoader(identity) {
|
84
94
|
validateCryptoKey(identity.privateKey);
|
85
|
-
|
95
|
+
async function load(url) {
|
86
96
|
let request = createRequest(url);
|
87
97
|
request = await sign(request, identity.privateKey, identity.keyId);
|
88
98
|
logRequest(request);
|
89
|
-
const response = await fetch(request
|
99
|
+
const response = await fetch(request, {
|
100
|
+
// Since Bun has a bug that ignores the `Request.redirect` option,
|
101
|
+
// to work around it we specify `redirect: "manual"` here too:
|
102
|
+
// https://github.com/oven-sh/bun/issues/10754
|
103
|
+
redirect: "manual",
|
104
|
+
});
|
105
|
+
// Follow redirects manually to get the final URL:
|
106
|
+
if (response.status >= 300 && response.status < 400 &&
|
107
|
+
response.headers.has("Location")) {
|
108
|
+
return load(response.headers.get("Location"));
|
109
|
+
}
|
90
110
|
return getRemoteDocument(url, response);
|
91
|
-
}
|
111
|
+
}
|
112
|
+
return load;
|
92
113
|
}
|
93
114
|
/**
|
94
115
|
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
package/package.json
CHANGED
package/types/mod.d.ts
CHANGED
@@ -25,8 +25,6 @@
|
|
25
25
|
*
|
26
26
|
* - [GitHub](https://github.com/dahlia/fedify)
|
27
27
|
* - [Tutorial](https://fedify.dev/tutorial)
|
28
|
-
* - [Manual](https://fedify.dev/manual)
|
29
|
-
* ([Unstable](https://unstable.fedify.dev/manual))
|
30
28
|
* - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
|
31
29
|
*
|
32
30
|
* [ActivityPub]: https://www.w3.org/TR/activitypub/
|
package/types/mod.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG,CAC/C,QAAQ,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAA;CAAE,KACpD,cAAc,CAAC;AAEpB;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACH,GAAG,EAAE,GAAG,CAAC;IAET;;;;;OAKG;gBACS,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;CAKhD;AAwDD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,cAAc,CAAC,
|
1
|
+
{"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,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