diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 1380db8..6f4fdbe 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -1,9 +1,9 @@ name: "Generate missing routes" on: schedule: - - cron: "0 0 * * *" + # Offset to reduce unnecessary load on GitHub Actions + - cron: "26 0 */2 * *" push: - branches: [ "**" ] jobs: generate: @@ -12,12 +12,12 @@ jobs: strategy: matrix: - node-version: [18.x] + node-version: [22.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' @@ -28,4 +28,4 @@ jobs: - run: git config user.email github-actions@github.com - run: git add . - run: git diff-index --quiet HEAD || git commit -m "Update state" - - run: git push \ No newline at end of file + - run: git push diff --git a/missing.json b/missing.json index 7b56a58..58fba4e 100644 --- a/missing.json +++ b/missing.json @@ -1,16 +1,16 @@ { - "missing": 480, + "missing": 533, "spacebar": 154, - "discord": 611, + "discord": 663, "routes": [ "/:id/:id/update-gaming-stats", "/:id/force-send-prompt", "/:id/gaming-stats", "/activities/:id/:id", - "/activities/:id/attachment", "/activities/:id/test-mode", "/activities/shelf", "/activities/statistics/applications/:id", + "/app-recommendations", "/application-directory-static/applications/:id", "/application-directory-static/applications/:id/similar", "/application-directory-static/categories", @@ -18,29 +18,41 @@ "/application-directory-static/search", "/application-directory/applications/:id/embed", "/application-directory/collection-items/:id/:id.:id", + "/applications-with-assets", + "/applications/:id/activities/:id/instances/:id/leave", "/applications/:id/app-assets/:id.:id", "/applications/:id/app-icons/:id.png", + "/applications/:id/application-command-index", + "/applications/:id/attachment", "/applications/:id/branches", "/applications/:id/branches", "/applications/:id/branches/:id/builds/:id/size", "/applications/:id/branches/:id/builds/live", "/applications/:id/branches/:id/storage", + "/applications/:id/disclosures", "/applications/:id/external-assets", "/applications/:id/guilds/:id/commands/:id/permissions", "/applications/:id/payment-payout-groups", "/applications/:id/public", + "/applications/:id/store-layout", "/applications/:id/subscription-group-listings/:id", "/applications/:id/transfer", + "/applications/games-supplemental", "/applications/public", "/applications/shelf", "/applications/trending/global", "/attachments/:id", + "/attachments/refresh-urls", "/attachments/report-false-positive", + "/attachments/sender-report-false-positive", "/auth/authorize-ip", + "/auth/conditional/finish", + "/auth/conditional/start", "/auth/handoff", "/auth/handoff/exchange", - "/auth/mfa/sms", + "/auth/mfa/:id", "/auth/mfa/sms/send", + "/auth/passwordless/start", "/auth/register/phone", "/auth/sessions", "/auth/sessions/debug/notifications", @@ -57,10 +69,11 @@ "/billing/verify-purchase-request", "/bogo-promotions", "/branches", - "/callscope/logs/:id/user/:id/%3Aid", + "/changelogs/@me/messages", "/channels/:id/:id/shared-canvas/emoji-hose", "/channels/:id/:id/shared-canvas/emoji-hose/:id", "/channels/:id/:id/shared-canvas/lines", + "/channels/:id/add-safety-warning", "/channels/:id/application-command-index", "/channels/:id/application-commands/search", "/channels/:id/attachments", @@ -92,9 +105,13 @@ "/channels/:id/messages/search", "/channels/:id/messages/search/tabs", "/channels/:id/pins/ack", - "/channels/:id/polls/:id/answers", + "/channels/:id/polls/:id/answers/:id", + "/channels/:id/polls/:id/answers/@me", + "/channels/:id/polls/:id/expire", "/channels/:id/post-data", "/channels/:id/recipients/@me", + "/channels/:id/safety-warning/report-false-positive", + "/channels/:id/safety-warnings", "/channels/:id/safety-warnings/ack", "/channels/:id/send-soundboard-sound", "/channels/:id/store-listing", @@ -109,19 +126,16 @@ "/channels/:id/threads/search", "/channels/:id/users/@me/threads/archived/private", "/channels/:id/voice-channel-effects", + "/channels/:id/voice-push", "/channels/:id/voice-status", "/channels/broadcast-channels", "/channels/preload-messages", "/channels/recipients/@me/batch-reject", - "/clyde-profiles/:id", - "/clyde-profiles/:id/avatars/:id.:id", - "/clyde-profiles/:id/banners/:id.:id", - "/clyde-profiles/generate-personality", + "/clan/:id", + "/clan/:id/disable", + "/clan/:id/settings", "/collectibles-categories", - "/connections/:id/authorize?continuation=true", - "/connections/:id/authorize?two_way_link=true&two_way_link_type=:id", - "/connections/:id/authorize?two_way_link=true&two_way_link_type=device_code&two_way_user_code=:id", - "/connections/:id/callback-continuation/:id", + "/collectibles-products/:id", "/connections/:id/link-dispatch-auth-callback", "/consoles/:id/devices", "/consoles/:id/devices/:id/commands", @@ -129,10 +143,16 @@ "/consoles/connect-request", "/consoles/connect-request/:id", "/consoles/xbox-handoff", + "/content-inventory/users/@me/applications/:id", + "/content-inventory/users/@me/similar-games/:id", + "/content-inventory/users/@me/spotify", + "/content-inventory/users/@me?refresh_token=:id", "/creator-monetization/marketing/nag-activate/eligibility", "/debug-logs/:id/:id", "/debug-logs/multi/:id", "/discovery/:id", + "/discovery/:id/clan", + "/discovery/games/all", "/discovery/valid-term", "/drops/@me", "/drops/eligibility", @@ -154,9 +174,10 @@ "/family-center/more-activity/:id/:id/:id/:id", "/family-center/teen-user/:id", "/friend-finder/find-friends", - "/friend-finder/hide-invite-suggestion", "/friend-suggestions", "/friend-suggestions/:id", + "/game-invite/@me", + "/game-invite/@me/:id", "/gifs/select", "/gifs/suggest", "/gifs/trending-search", @@ -164,6 +185,9 @@ "/google-play/emit-google-play-metrics", "/google-play/validate-purchase", "/google-play/verify-purchase-token", + "/gravity-content", + "/gravity-custom-channel-scores", + "/gravity-custom-guild-score", "/guild-events", "/guild-events/:id/images/:id.:id", "/guilds/:id/ack/:id/:id", @@ -188,10 +212,7 @@ "/guilds/:id/avatars/:id.:id", "/guilds/:id/banners/:id.:id", "/guilds/:id/bans/search", - "/guilds/:id/bulk-ban", - "/guilds/:id/channel-highlights", - "/guilds/:id/clyde-profiles", - "/guilds/:id/clyde-settings", + "/guilds/:id/basic", "/guilds/:id/creator-monetization/accept-new-terms", "/guilds/:id/creator-monetization/accept-new-terms-demonetized", "/guilds/:id/creator-monetization/accept-terms", @@ -208,7 +229,6 @@ "/guilds/:id/discovery-metadata", "/guilds/:id/discovery-splashes/:id.jpg", "/guilds/:id/entitlements", - "/guilds/:id/get-channel-emojis", "/guilds/:id/guild-feed", "/guilds/:id/guild-feed/feature", "/guilds/:id/guild-feed/mark-seen", @@ -218,12 +238,11 @@ "/guilds/:id/incident-actions", "/guilds/:id/integrations/:id", "/guilds/:id/integrations/:id/sync", - "/guilds/:id/inventory/settings", "/guilds/:id/join-admin-server", + "/guilds/:id/join-wfs-server", "/guilds/:id/members-search", "/guilds/:id/members/@me", "/guilds/:id/members/@me", - "/guilds/:id/members/clyde", "/guilds/:id/members/supplemental", "/guilds/:id/members/unusual-dm-activity", "/guilds/:id/messages/search/tabs", @@ -237,7 +256,6 @@ "/guilds/:id/onboarding-prompts/:id", "/guilds/:id/onboarding-responses", "/guilds/:id/pincode", - "/guilds/:id/populate-channel-emojis", "/guilds/:id/premium/subscriptions/:id", "/guilds/:id/preview", "/guilds/:id/products", @@ -264,10 +282,11 @@ "/guilds/:id/roles/connections-configurations", "/guilds/:id/scheduled-events", "/guilds/:id/scheduled-events/:id", + "/guilds/:id/scheduled-events/:id/:id/users", + "/guilds/:id/scheduled-events/:id/:id/users/@me", "/guilds/:id/scheduled-events/:id/exceptions", "/guilds/:id/scheduled-events/:id/exceptions/:id", - "/guilds/:id/scheduled-events/:id/users", - "/guilds/:id/scheduled-events/:id/users/@me", + "/guilds/:id/scheduled-events/:id/users/counts", "/guilds/:id/soundboard-sounds", "/guilds/:id/soundboard-sounds/:id", "/guilds/:id/splashes/:id.jpg", @@ -284,15 +303,13 @@ "/integrations/:id/join", "/integrations/:id/search", "/interactions", - "/inventory/packs/:id/metadata", - "/lobbies", - "/lobbies/:id", - "/lobbies/:id/members/:id", - "/lobbies/:id/send", - "/lobbies/search", + "/join-requests/:id", + "/join-requests/:id/interview", "/messages-log/guild-channels/get", "/messages-log/private-channels/get", + "/messages/explicit-media", "/metrics", + "/metrics/v2", "/mfa/finish", "/networking/token", "/oauth2/@me", @@ -312,19 +329,39 @@ "/phone-verifications/resend", "/phone-verifications/validate-support-ticket", "/phone-verifications/verify", + "/premium-marketing", "/private/bug-reports", "/promotions/funimation", + "/quests/:id/claim-reward", + "/quests/:id/console/start", + "/quests/:id/console/stop", + "/quests/:id/dismissible-content/:id/dismiss", + "/quests/:id/enroll", + "/quests/:id/heartbeat", + "/quests/:id/preview/complete", + "/quests/:id/preview/dismissibility", + "/quests/:id/preview/status", + "/quests/:id/reward-code", + "/quests/@me", "/referrals/:id", "/report/options", "/reporting/:id", "/reporting/menu/:id", + "/reporting/review", "/reporting/unauthenticated/:id", + "/reporting/unauthenticated/:id/code", + "/reporting/unauthenticated/:id/verify", + "/reporting/unauthenticated/experiment", "/reporting/unauthenticated/menu/:id", "/reports", "/reports/channels/:id/messages/:id", "/roles/:id/icons/:id.png", "/safety-hub/@me", + "/safety-hub/request-review/:id", + "/safety-hub/suspended/@me", + "/safety-hub/suspended/request-review/:id", "/saved-messages", + "/search/favorites", "/soundboard-default-sounds", "/soundboard-sounds/:id", "/sso", @@ -361,18 +398,20 @@ "/unique-username/username-suggestions-unauthed", "/unverified-applications", "/unverified-applications/icons", + "/user-offer-ids", + "/user-offers", + "/user-offers/:id/:id", + "/user-offers/:id/:id/unack", + "/user-offers/create/:id/:id", "/user-profile-effects", - "/user-trial-offers", - "/user-trial-offers/:id", - "/user-trial-offers/:id/unack", - "/user-trial-offers/create/:id", "/users/:id/applications/:id/achievements/:id", "/users/:id/avatars/:id.:id", "/users/:id/banners/:id.:id", - "/users/:id/sessions/:id/activities/:id/JOIN", + "/users/:id/sessions/:id/activities/:id/1", "/users/:id/sessions/:id/activities/:id/metadata", "/users/:id/video-filter-assets/:id/:id.:id", "/users/@me/:id/:id/ack", + "/users/@me/activate-perk-demo/:id", "/users/@me/affinities/channels", "/users/@me/agreements", "/users/@me/application-command-index", @@ -384,9 +423,12 @@ "/users/@me/background-sync", "/users/@me/billing/adyen/payment-methods", "/users/@me/billing/apple/trial-offer-signature", + "/users/@me/billing/checkout-recovery", + "/users/@me/billing/churn-user-offer", "/users/@me/billing/eligible-application-subscription-guilds", "/users/@me/billing/invoice", "/users/@me/billing/localized-pricing-promo", + "/users/@me/billing/nitro-affinity", "/users/@me/billing/payment-sources/:id", "/users/@me/billing/payment-sources/validate-billing-address", "/users/@me/billing/payments", @@ -406,13 +448,14 @@ "/users/@me/billing/subscriptions/preview", "/users/@me/billing/user-offer", "/users/@me/billing/user-offer/ack", + "/users/@me/billing/user-offer/redeem", "/users/@me/billing/user-trial-offer", "/users/@me/billing/user-trial-offer/:id/ack", "/users/@me/burst-credits", "/users/@me/captcha/verify", "/users/@me/channels/broadcast", "/users/@me/claim-premium-collectibles-product", - "/users/@me/clyde-consent", + "/users/@me/clan", "/users/@me/collectibles-purchases", "/users/@me/connections/:id/:id/refresh", "/users/@me/connections/contacts/@me/external-friend-list-entries", @@ -425,15 +468,15 @@ "/users/@me/entitlements/gift-codes", "/users/@me/entitlements/gift-codes", "/users/@me/entitlements/gift-codes/:id", + "/users/@me/gravity-icymi", + "/users/@me/guilds/:id/member/ack-dm-upsell-settings", "/users/@me/guilds/integration-application-ids", "/users/@me/guilds/premium/subscription-slots/:id/cancel", "/users/@me/guilds/premium/subscription-slots/:id/uncancel", "/users/@me/guilds/premium/subscriptions", "/users/@me/guilds/premium/subscriptions/cooldown", + "/users/@me/guilds/settings", "/users/@me/harvest", - "/users/@me/inventory", - "/users/@me/inventory/packs/add", - "/users/@me/inventory/packs/remove", "/users/@me/invites", "/users/@me/join-request-guilds", "/users/@me/library/:id", @@ -452,7 +495,12 @@ "/users/@me/notification-center/items/:id", "/users/@me/notification-center/items/:id/ack", "/users/@me/notification-center/items/bulk-ack", + "/users/@me/notification-settings", + "/users/@me/notification-settings/snapshots", + "/users/@me/notification-settings/snapshots/:id", + "/users/@me/notification-settings/snapshots/:id/restore-guilds", "/users/@me/outbound-promotions/codes", + "/users/@me/perks-demos", "/users/@me/phone", "/users/@me/phone/reverify", "/users/@me/phone/verify", @@ -463,6 +511,7 @@ "/users/@me/referrals/:id", "/users/@me/referrals/:id/preview", "/users/@me/referrals/eligibility", + "/users/@me/referrals/eligible-users", "/users/@me/relationships/bulk", "/users/@me/remote-auth", "/users/@me/remote-auth/cancel", @@ -474,12 +523,16 @@ "/users/@me/settings/game-notifications/overrides", "/users/@me/sticker-packs", "/users/@me/survey", + "/users/@me/survey/:id/seen", + "/users/@me/tenure-reward/sync", + "/users/@me/valid-collectibles-gift-recipient", "/users/@me/video-filters/assets", "/users/@me/video-filters/assets/:id", "/users/@me/video-filters/assets/:id/last-used", "/users/broadcasts/bucket", "/users/disable-email-notifications", "/users/disable-server-highlight-notifications", + "/users/username/:id", "/webhooks/:id", "/webhooks/:id/:id", "webapp:///billing/premium/subscribe/login-handoff?handoff_key=:id&handoff_token=:id&destination=:id" diff --git a/package-lock.json b/package-lock.json index 8c5ae33..43940e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,53 +9,42 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "astring": "^1.8.4", - "estraverse": "^5.3.0", - "estree-toolkit": "^1.4.0", - "meriyah": "^4.3.3", - "node-fetch": "^3.3.0", - "typescript": "^4.9.4" + "astring": "^1.8.6", + "estree-toolkit": "^1.7.5", + "meriyah": "^4.5.0", + "node-fetch": "^3.3.2", + "typescript": "^4.9.5" }, "devDependencies": { - "@types/estraverse": "^5.1.2", - "@types/node-fetch": "^2.6.2" - } - }, - "node_modules/@types/estraverse": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/@types/estraverse/-/estraverse-5.1.4.tgz", - "integrity": "sha512-vWk/Pr08mWnzh2ckEqt4JEYCZcjJ1Tb0pJcNs4lRX660NbON2bKPN6busy+8TzUzV0AhLEOHphK8W+KBZtZ8kQ==", - "dev": true, - "dependencies": { - "@types/estree": "*" + "@types/node-fetch": "^2.6.11" } }, "node_modules/@types/estree": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.2.tgz", - "integrity": "sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" }, "node_modules/@types/estree-jsx": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.1.tgz", - "integrity": "sha512-sHyakZlAezNFxmYRo0fopDZW+XvK6ipeZkkp5EAOLjdPfZp8VjZBJ67vSRI99RSCAoqXVmXOHS4fnWoxpuGQtQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", "dependencies": { "@types/estree": "*" } }, "node_modules/@types/node": { - "version": "20.8.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.6.tgz", - "integrity": "sha512-eWO4K2Ji70QzKUqRy6oyJWUeB7+g2cRagT3T/nxYibYcT4y2BDL8lqolRXjTHmkZCdJfIPaY73KbJAZmcryxTQ==", + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", "dev": true, "dependencies": { - "undici-types": "~5.25.1" + "undici-types": "~5.26.4" } }, "node_modules/@types/node-fetch": { - "version": "2.6.6", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.6.tgz", - "integrity": "sha512-95X8guJYhfqiuVVhRFxVQcf4hW/2bCuoPwDasMf/531STFoNoWTT7YDnWdXHEZKqAGUigmpG31r2FE70LwnzJw==", + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", "dev": true, "dependencies": { "@types/node": "*", @@ -105,21 +94,13 @@ "node": ">=0.4.0" } }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "engines": { - "node": ">=4.0" - } - }, "node_modules/estree-toolkit": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/estree-toolkit/-/estree-toolkit-1.7.3.tgz", - "integrity": "sha512-hMPO2kBkGtZK7GDUeouqm01kCzIWyk0b5gJFunCpbafHSQyB45u2/cYgxt5U5w+0Qt/AsqdlWhoDNdyWlmeWjw==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/estree-toolkit/-/estree-toolkit-1.7.5.tgz", + "integrity": "sha512-e26HrVkoOZMKEyNkF107NyJkGNSmOi9ageC4/sR7zR0HcyOw9+U+Nnvuzl4ufbTHmEhvA75yh6C8XnWHomD5sg==", "dependencies": { - "@types/estree": "^1.0.1", - "@types/estree-jsx": "^1.0.0" + "@types/estree": "^1.0.5", + "@types/estree-jsx": "^1.0.5" } }, "node_modules/fetch-blob": { @@ -170,9 +151,9 @@ } }, "node_modules/meriyah": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-4.3.7.tgz", - "integrity": "sha512-JAlSOUqFU/rmLy2CEdZO5hN5E5dyUj1f4AlRR4GCQMjfobvd5lcm9JLkrqq0MgVaLQ/Zur590A+0RyUZhj0b5A==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-4.5.0.tgz", + "integrity": "sha512-Rbiu0QPIxTXgOXwiIpRVJfZRQ2FWyfzYrOGBs9SN5RbaXg1CN5ELn/plodwWwluX93yzc4qO/bNIen1ThGFCxw==", "engines": { "node": ">=10.4.0" } @@ -246,15 +227,15 @@ } }, "node_modules/undici-types": { - "version": "5.25.3", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", - "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==", + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", "engines": { "node": ">= 8" } diff --git a/package.json b/package.json index c9410c4..439470c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "sb-routes", "version": "1.0.0", "description": "", - "main": "index.js", + "main": "dist/index.js", "scripts": { "build": "tsc -b", "start": "node dist/index.js" @@ -10,16 +10,14 @@ "author": "", "license": "ISC", "dependencies": { - "astring": "^1.8.4", - "estraverse": "^5.3.0", - "estree-toolkit": "^1.4.0", - "meriyah": "^4.3.3", - "node-fetch": "^3.3.0", - "typescript": "^4.9.4" + "astring": "^1.8.6", + "estree-toolkit": "^1.7.5", + "meriyah": "^4.5.0", + "node-fetch": "^3.3.2", + "typescript": "^4.9.5" }, "type": "module", "devDependencies": { - "@types/estraverse": "^5.1.2", - "@types/node-fetch": "^2.6.2" + "@types/node-fetch": "^2.6.11" } } diff --git a/src/index.ts b/src/index.ts index 39941c6..aafc5a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,4 @@ import { generate } from "astring"; -import estraverse from "estraverse"; import ESTree from "estree"; import { traverse } from "estree-toolkit"; import fs from "fs"; @@ -9,8 +8,8 @@ import fetch from "node-fetch"; const JAVASCRIPT_ENVIRONMENT = fs.readFileSync("./src/template.js").toString(); const getClientSource = async () => { - const index = await fetch("https://discord.com/app").then(x => x.text()); - const script = [...index.matchAll(/[A-Fa-f0-9]{20}.js/g)].reverse()[0]; + const index = await fetch("https://canary.discord.com/app").then(x => x.text()); + const script = [...index.matchAll(/web.[A-Fa-f0-9]{20}.js/g)].reverse()[0]; return fetch(`https://canary.discord.com/assets/${script[0]}`).then((x) => x.text() @@ -24,11 +23,12 @@ const MeriyahOptions: meriyah.Options = { const findClientRoutes = (source: string): string[] => { const tree = meriyah.parseModule(source, MeriyahOptions) as ESTree.Node; + let called = 0; let out = ""; traverse(tree, { $: { scope: true }, CallExpression: { - enter: (path, state) => { + enter: (path) => { const node = path.node; if (!node) return; if ( @@ -44,18 +44,24 @@ const findClientRoutes = (source: string): string[] => { (x) => x.type == "Property" && x.key.type == "Identifier" && - x.key.name == "USER" + x.key.name == "USER" && + x.value.type == "ArrowFunctionExpression" ) ) { + called++; + // this is our routes list const generated = generate(node); out = JAVASCRIPT_ENVIRONMENT.replace("undefined;// --- GENERATED_CODE_MARKER ---", generated); - return estraverse.VisitorOption.Break; } }, }, }); + if (called > 1) { + console.warn("\nWarning: More than one result was found while traversing the AST. This will probably break the output.\n"); + } + out = out.replaceAll(/..\.JOIN/g, `"JOIN"`); out = out.replaceAll(/.\..\.DEVICE_CODE/g, `"device_code"`); @@ -73,10 +79,10 @@ const getSbOpenAPI = async () => { const compare = (discord: string[], spacebar: string[]) => { const missing = []; - for (var route of discord) { - var regex = route.replaceAll("/", "\\/").replaceAll(":id", "{.*}"); + for (const route of discord) { + const regex = route.replaceAll("/", "\\/").replaceAll(":id", "{.*}"); - var found = spacebar.find((x) => x.match(regex)); + const found = spacebar.find((x) => x.match(regex)); if (!found) { missing.push(route);