diff --git a/eslint.config.mjs b/eslint.config.mjs index 476c33675..8dbefd284 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -300,7 +300,8 @@ export default [ 'n/no-unsupported-features/node-builtins': [ 'error', { - version: '>=22.16.0', + version: '^22.16.0 || ^24.0.0', + allowExperimental: true, ignores: [], }, ], diff --git a/lib/routes/twitter/api/web-api/api.ts b/lib/routes/twitter/api/web-api/api.ts index 31c5378c0..738b0d811 100644 --- a/lib/routes/twitter/api/web-api/api.ts +++ b/lib/routes/twitter/api/web-api/api.ts @@ -4,8 +4,7 @@ import cache from '@/utils/cache'; import { twitterGot, paginationTweets, gatherLegacyFromData } from './utils'; import InvalidParameterError from '@/errors/types/invalid-parameter'; import ofetch from '@/utils/ofetch'; -import { Decoder } from '@toondepauw/node-zstd'; -const decoder = new Decoder(); +import { zstdDecompressSync } from 'node:zlib'; const fetchThirdPartyApi = async (endpoint: string, params: Record) => { const response = await ofetch.raw(`${config.twitter.thirdPartyApi}${endpoint}`, { @@ -18,7 +17,7 @@ const fetchThirdPartyApi = async (endpoint: string, params: Record) let body = Buffer.from(response._data as ArrayBuffer); if (encoding.includes('zstd')) { - body = await decoder.decode(body); + body = zstdDecompressSync(body); } return JSON.parse(body.toString('utf-8')); diff --git a/lib/routes/twitter/api/web-api/utils.ts b/lib/routes/twitter/api/web-api/utils.ts index 2c2955b58..d6d524dbd 100644 --- a/lib/routes/twitter/api/web-api/utils.ts +++ b/lib/routes/twitter/api/web-api/utils.ts @@ -10,8 +10,7 @@ import logger from '@/utils/logger'; import ofetch from '@/utils/ofetch'; import proxy from '@/utils/proxy'; import login from './login'; -import { Decoder } from '@toondepauw/node-zstd'; -const decoder = new Decoder(); +import { zstdDecompressSync } from 'node:zlib'; let authTokenIndex = 0; @@ -26,7 +25,7 @@ const fetchThirdPartyTimeline = async (endpoint: string, params: Record=9.0.0' - '@toondepauw/node-zstd-darwin-arm64@1.2.0': - resolution: {integrity: sha512-fdBGlRSrf19M1+IJ98aJCLK6/HKQRnRlhE5i6EZ7kVfD2r6h5Bq9NqHAmQ5MgwtmfB9VMmiIrQAMIxKVeT54pg==} - engines: {node: '>= 14'} - cpu: [arm64] - os: [darwin] - - '@toondepauw/node-zstd-darwin-x64@1.2.0': - resolution: {integrity: sha512-ZVu4zkQUgCQ8z1lLd7/LZzIYDKL48tPguIN8L4SRfLuWWlTq2/4OT6AmchztDbe5soLCDuw64t5X5otDvgsGJA==} - engines: {node: '>= 14'} - cpu: [x64] - os: [darwin] - - '@toondepauw/node-zstd-freebsd-x64@1.2.0': - resolution: {integrity: sha512-kDK+l3uP7htiWvM/klY32siEGIBk3K5Da4/DcXV2q/Vp+Ph86FWpQRzC46wJIpJB60xEU67pxFGLBH/8/RB02g==} - engines: {node: '>= 14'} - cpu: [x64] - os: [freebsd] - - '@toondepauw/node-zstd-linux-arm64-gnu@1.2.0': - resolution: {integrity: sha512-KteUWam7McA0moNiRgu7KSgPu3FE+KXuh3ObqWoco5JK53Sp4Pgr/q1IYsdN6TYYbgJMkJpof62NIbyi6tnVfg==} - engines: {node: '>= 14'} - cpu: [arm64] - os: [linux] - - '@toondepauw/node-zstd-linux-arm64-musl@1.2.0': - resolution: {integrity: sha512-KjbGOXvPmorhWGD4kEVjdBz/gJgUOw1Eu0xziBwsq03URrI0XSDAY6YiJZpZtGnSjm7XonEpnBZcVwXH1HZz3Q==} - engines: {node: '>= 14'} - cpu: [arm64] - os: [linux] - - '@toondepauw/node-zstd-linux-x64-gnu@1.2.0': - resolution: {integrity: sha512-qNJDZGd/jplK/1J+8V87dYdrviAxNt1iwI/SQ0JR3HTz5Jdbu+BnVB9oMklCc/bGWa8zTkiZkl/EwA3gtbpo+Q==} - engines: {node: '>= 14'} - cpu: [x64] - os: [linux] - - '@toondepauw/node-zstd-linux-x64-musl@1.2.0': - resolution: {integrity: sha512-Cw1qnMXde8caitDMbk0vWrqnVHTSK+JB/Dp3XnZghQjBrD7JLj2qNzh0eTkxNFa+nijbo8HyyslWGswCugYZCw==} - engines: {node: '>= 14'} - cpu: [x64] - os: [linux] - - '@toondepauw/node-zstd-win32-x64-msvc@1.2.0': - resolution: {integrity: sha512-7cD2/R7DLZHMxHTsQNtOX3vJCT4qd74a3nWjYYthJ89gqXwwEoC8BwttQxvHd0qCZ3S/cZ/BYoTikXMwMNmCEg==} - engines: {node: '>= 14'} - cpu: [x64] - os: [win32] - - '@toondepauw/node-zstd@1.2.0': - resolution: {integrity: sha512-vVDvPUstF9gKEX+Kqp654bL+4UNus6pkmY8mlcJQpIw/Sn6sO9fl1PEwxB0d0unH5PmVfBUicf1lOXu74OLrCg==} - engines: {node: '>= 14'} - '@tootallnate/quickjs-emscripten@0.23.0': resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} @@ -8260,41 +8205,6 @@ snapshots: estraverse: 5.3.0 picomatch: 4.0.3 - '@toondepauw/node-zstd-darwin-arm64@1.2.0': - optional: true - - '@toondepauw/node-zstd-darwin-x64@1.2.0': - optional: true - - '@toondepauw/node-zstd-freebsd-x64@1.2.0': - optional: true - - '@toondepauw/node-zstd-linux-arm64-gnu@1.2.0': - optional: true - - '@toondepauw/node-zstd-linux-arm64-musl@1.2.0': - optional: true - - '@toondepauw/node-zstd-linux-x64-gnu@1.2.0': - optional: true - - '@toondepauw/node-zstd-linux-x64-musl@1.2.0': - optional: true - - '@toondepauw/node-zstd-win32-x64-msvc@1.2.0': - optional: true - - '@toondepauw/node-zstd@1.2.0': - optionalDependencies: - '@toondepauw/node-zstd-darwin-arm64': 1.2.0 - '@toondepauw/node-zstd-darwin-x64': 1.2.0 - '@toondepauw/node-zstd-freebsd-x64': 1.2.0 - '@toondepauw/node-zstd-linux-arm64-gnu': 1.2.0 - '@toondepauw/node-zstd-linux-arm64-musl': 1.2.0 - '@toondepauw/node-zstd-linux-x64-gnu': 1.2.0 - '@toondepauw/node-zstd-linux-x64-musl': 1.2.0 - '@toondepauw/node-zstd-win32-x64-msvc': 1.2.0 - '@tootallnate/quickjs-emscripten@0.23.0': {} '@tybys/wasm-util@0.10.1':