forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1diff --git a/dist/index.js b/dist/index.js
2index 7b40a89..4b8d430 100644
3--- a/dist/index.js
4+++ b/dist/index.js
5@@ -1,4 +1,21 @@
6 "use strict";
7+// polyfill throwIfAborted which seems to be missing in react-native, but ky
8+// uses it
9+//
10+// Fun fact, AbortSignal here is just a react-native polyfill, too:
11+// https://github.com/facebook/react-native/blob/838d26d7b534133e75c7fa673dfc849b0e64c9d3/packages/react-native/Libraries/Core/setUpXHR.js#L38
12+//
13+// Unfortunately it doesn't have a `reason`
14+//
15+// ref: https://github.com/tjmehta/fast-abort-controller/blob/42588908035d1512f90e7299a2c70dfb708f9620/src/FastAbortSignal.ts#L39
16+if (!AbortSignal.prototype.throwIfAborted) {
17+ AbortSignal.prototype.throwIfAborted = function() {
18+ if (this.aborted) {
19+ throw new Error('Aborted')
20+ }
21+ }
22+}
23+
24 var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
25 if (k2 === undefined) k2 = k;
26 var desc = Object.getOwnPropertyDescriptor(m, k);
27@@ -15,7 +32,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
28 };
29 Object.defineProperty(exports, "__esModule", { value: true });
30 exports.FetchResponseError = exports.FetchRequestError = exports.FetchError = void 0;
31-require("core-js/modules/es.symbol.dispose");
32+if (typeof Symbol.dispose === 'undefined') {
33+ Symbol.dispose = Symbol('Symbol.dispose');
34+}
35 __exportStar(require("@atproto-labs/did-resolver"), exports);
36 var fetch_1 = require("@atproto-labs/fetch");
37 Object.defineProperty(exports, "FetchError", { enumerable: true, get: function () { return fetch_1.FetchError; } });
38diff --git a/dist/oauth-server-agent.js b/dist/oauth-server-agent.js
39index 239cb0e..e98b656 100644
40--- a/dist/oauth-server-agent.js
41+++ b/dist/oauth-server-agent.js
42@@ -169,10 +169,16 @@ class OAuthServerAgent {
43 * @returns The user's PDS URL (the resource server for the user)
44 */
45 async verifyIssuer(sub) {
46+ const AbortSignal_timeout = (delay) => {
47+ const controller = new AbortController();
48+ const timeout = setTimeout(() => controller.abort(), delay);
49+ return controller.signal;
50+ };
51+
52 const resolved = await this.oauthResolver.resolveFromIdentity(sub, {
53 noCache: true,
54 allowStale: false,
55- signal: AbortSignal.timeout(10e3),
56+ signal: AbortSignal_timeout(10e3),
57 });
58 if (this.issuer !== resolved.metadata.issuer) {
59 // Best case scenario; the user switched PDS. Worst case scenario; a bad
60diff --git a/dist/session-getter.js b/dist/session-getter.js
61index 5d41957..f279a0c 100644
62--- a/dist/session-getter.js
63+++ b/dist/session-getter.js
64@@ -237,11 +237,17 @@ class SessionGetter extends simple_store_1.CachedGetter {
65 */
66 async get(sub, options) {
67 const session = await this.runtime.usingLock(`@atproto-oauth-client-${sub}`, async () => {
68+ const AbortSignal_timeout = (delay) => {
69+ const controller = new AbortController();
70+ const timeout = setTimeout(() => controller.abort(), delay);
71+ return controller.signal;
72+ };
73+
74 const env_1 = { stack: [], error: void 0, hasError: false };
75 try {
76 // Make sure, even if there is no signal in the options, that the
77 // request will be cancelled after at most 30 seconds.
78- const signal = AbortSignal.timeout(30e3);
79+ const signal = AbortSignal_timeout(30e3);
80 const abortController = __addDisposableResource(env_1, (0, util_js_1.combineSignals)([options?.signal, signal]), false);
81 return await super.get(sub, {
82 ...options,