+88
-16
package-lock.json
+88
-16
package-lock.json
···
33
33
"@supabase/supabase-js": "^2.43.2",
34
34
"@tiptap/core": "^2.11.5",
35
35
"@types/mdx": "^2.0.13",
36
-
"@upstash/redis": "^1.35.0",
37
36
"@vercel/analytics": "^1.5.0",
38
37
"@vercel/sdk": "^1.3.1",
39
38
"babel-plugin-react-compiler": "^19.1.0-rc.1",
···
43
42
"feed": "^5.0.1",
44
43
"fractional-indexing": "^3.2.0",
45
44
"hono": "^4.7.11",
45
+
"ioredis": "^5.6.1",
46
46
"linkifyjs": "^4.2.0",
47
47
"multiformats": "^13.3.2",
48
48
"next": "15.3.2",
···
2305
2305
"dependencies": {
2306
2306
"@swc/helpers": "^0.5.0"
2307
2307
}
2308
+
},
2309
+
"node_modules/@ioredis/commands": {
2310
+
"version": "1.2.0",
2311
+
"resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz",
2312
+
"integrity": "sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==",
2313
+
"license": "MIT"
2308
2314
},
2309
2315
"node_modules/@ipld/dag-cbor": {
2310
2316
"version": "7.0.3",
···
6170
6176
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
6171
6177
"integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ=="
6172
6178
},
6173
-
"node_modules/@upstash/redis": {
6174
-
"version": "1.35.0",
6175
-
"resolved": "https://registry.npmjs.org/@upstash/redis/-/redis-1.35.0.tgz",
6176
-
"integrity": "sha512-WUm0Jz1xN4DBDGeJIi2Y0kVsolWRB2tsVds4SExaiLg4wBdHFMB+8IfZtBWr+BP0FvhuBr5G1/VLrJ9xzIWHsg==",
6177
-
"license": "MIT",
6178
-
"dependencies": {
6179
-
"uncrypto": "^0.1.3"
6180
-
}
6181
-
},
6182
6179
"node_modules/@vercel/analytics": {
6183
6180
"version": "1.5.0",
6184
6181
"resolved": "https://registry.npmjs.org/@vercel/analytics/-/analytics-1.5.0.tgz",
···
7188
7185
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
7189
7186
"engines": {
7190
7187
"node": ">=6"
7188
+
}
7189
+
},
7190
+
"node_modules/cluster-key-slot": {
7191
+
"version": "1.1.2",
7192
+
"resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz",
7193
+
"integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==",
7194
+
"license": "Apache-2.0",
7195
+
"engines": {
7196
+
"node": ">=0.10.0"
7191
7197
}
7192
7198
},
7193
7199
"node_modules/cmd-shim": {
···
7556
7562
"node": ">=0.4.0"
7557
7563
}
7558
7564
},
7565
+
"node_modules/denque": {
7566
+
"version": "2.1.0",
7567
+
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
7568
+
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
7569
+
"license": "Apache-2.0",
7570
+
"engines": {
7571
+
"node": ">=0.10"
7572
+
}
7573
+
},
7559
7574
"node_modules/depd": {
7560
7575
"version": "2.0.0",
7561
7576
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
···
10530
10545
"tslib": "^2.8.0"
10531
10546
}
10532
10547
},
10548
+
"node_modules/ioredis": {
10549
+
"version": "5.6.1",
10550
+
"resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.6.1.tgz",
10551
+
"integrity": "sha512-UxC0Yv1Y4WRJiGQxQkP0hfdL0/5/6YvdfOOClRgJ0qppSarkhneSa6UvkMkms0AkdGimSH3Ikqm+6mkMmX7vGA==",
10552
+
"license": "MIT",
10553
+
"dependencies": {
10554
+
"@ioredis/commands": "^1.1.1",
10555
+
"cluster-key-slot": "^1.1.0",
10556
+
"debug": "^4.3.4",
10557
+
"denque": "^2.1.0",
10558
+
"lodash.defaults": "^4.2.0",
10559
+
"lodash.isarguments": "^3.1.0",
10560
+
"redis-errors": "^1.2.0",
10561
+
"redis-parser": "^3.0.0",
10562
+
"standard-as-callback": "^2.1.0"
10563
+
},
10564
+
"engines": {
10565
+
"node": ">=12.22.0"
10566
+
},
10567
+
"funding": {
10568
+
"type": "opencollective",
10569
+
"url": "https://opencollective.com/ioredis"
10570
+
}
10571
+
},
10533
10572
"node_modules/ipaddr.js": {
10534
10573
"version": "2.2.0",
10535
10574
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz",
···
11315
11354
"url": "https://github.com/sponsors/sindresorhus"
11316
11355
}
11317
11356
},
11357
+
"node_modules/lodash.defaults": {
11358
+
"version": "4.2.0",
11359
+
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
11360
+
"integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==",
11361
+
"license": "MIT"
11362
+
},
11318
11363
"node_modules/lodash.includes": {
11319
11364
"version": "4.3.0",
11320
11365
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
11321
11366
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
11367
+
"license": "MIT"
11368
+
},
11369
+
"node_modules/lodash.isarguments": {
11370
+
"version": "3.1.0",
11371
+
"resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz",
11372
+
"integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==",
11322
11373
"license": "MIT"
11323
11374
},
11324
11375
"node_modules/lodash.isboolean": {
···
14400
14451
"url": "https://opencollective.com/unified"
14401
14452
}
14402
14453
},
14454
+
"node_modules/redis-errors": {
14455
+
"version": "1.2.0",
14456
+
"resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz",
14457
+
"integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==",
14458
+
"license": "MIT",
14459
+
"engines": {
14460
+
"node": ">=4"
14461
+
}
14462
+
},
14463
+
"node_modules/redis-parser": {
14464
+
"version": "3.0.0",
14465
+
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz",
14466
+
"integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==",
14467
+
"license": "MIT",
14468
+
"dependencies": {
14469
+
"redis-errors": "^1.0.0"
14470
+
},
14471
+
"engines": {
14472
+
"node": ">=4"
14473
+
}
14474
+
},
14403
14475
"node_modules/redlock": {
14404
14476
"version": "5.0.0-beta.2",
14405
14477
"resolved": "https://registry.npmjs.org/redlock/-/redlock-5.0.0-beta.2.tgz",
···
15296
15368
"as-table": "^1.0.36",
15297
15369
"get-source": "^2.0.12"
15298
15370
}
15371
+
},
15372
+
"node_modules/standard-as-callback": {
15373
+
"version": "2.1.0",
15374
+
"resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz",
15375
+
"integrity": "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==",
15376
+
"license": "MIT"
15299
15377
},
15300
15378
"node_modules/statuses": {
15301
15379
"version": "2.0.1",
···
16204
16282
"funding": {
16205
16283
"url": "https://github.com/sponsors/ljharb"
16206
16284
}
16207
-
},
16208
-
"node_modules/uncrypto": {
16209
-
"version": "0.1.3",
16210
-
"resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz",
16211
-
"integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",
16212
-
"license": "MIT"
16213
16285
},
16214
16286
"node_modules/undici": {
16215
16287
"version": "6.21.2",
+1
-1
package.json
+1
-1
package.json
···
43
43
"@supabase/supabase-js": "^2.43.2",
44
44
"@tiptap/core": "^2.11.5",
45
45
"@types/mdx": "^2.0.13",
46
-
"@upstash/redis": "^1.35.0",
47
46
"@vercel/analytics": "^1.5.0",
48
47
"@vercel/sdk": "^1.3.1",
49
48
"babel-plugin-react-compiler": "^19.1.0-rc.1",
···
53
52
"feed": "^5.0.1",
54
53
"fractional-indexing": "^3.2.0",
55
54
"hono": "^4.7.11",
55
+
"ioredis": "^5.6.1",
56
56
"linkifyjs": "^4.2.0",
57
57
"multiformats": "^13.3.2",
58
58
"next": "15.3.2",
+4
-12
src/atproto-oauth.ts
+4
-12
src/atproto-oauth.ts
···
3
3
NodeSavedSession,
4
4
NodeSavedState,
5
5
RuntimeLock,
6
-
Session,
7
6
} from "@atproto/oauth-client-node";
8
7
import { JoseKey } from "@atproto/jwk-jose";
9
8
import { oauth_metadata } from "app/api/oauth/[route]/oauth-metadata";
10
9
import { supabaseServerClient } from "supabase/serverClient";
11
10
12
-
import { Redis } from "@upstash/redis";
11
+
import Client from "ioredis";
13
12
import Redlock from "redlock";
14
13
export async function createOauthClient() {
15
14
let keyset =
···
19
18
])
20
19
: undefined;
21
20
let requestLock: RuntimeLock | undefined;
22
-
if (
23
-
process.env.NODE_ENV === "production" &&
24
-
process.env.KV_REST_API_URL &&
25
-
process.env.KV_REST_API_TOKEN
26
-
) {
27
-
const redis = new Redis({
28
-
url: process.env.KV_REST_API_URL,
29
-
token: process.env.KV_REST_API_TOKEN,
30
-
});
31
-
const redlock = new Redlock([redis]);
21
+
if (process.env.NODE_ENV === "production" && process.env.REDIS_URL) {
22
+
const client = new Client(process.env.REDIS_URL);
23
+
const redlock = new Redlock([client]);
32
24
requestLock = async (key, fn) => {
33
25
// 30 seconds should be enough. Since we will be using one lock per user id
34
26
// we can be quite liberal with the lock duration here.