From e7a6be0639cfbe94ce1afcfb9fef8c58147d69a2 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sat, 17 Dec 2022 17:38:33 +1100 Subject: Premium tier 0 SKU from staging --- .../skus/#sku_id/subscription-plans.ts | 255 +++++++++++++++++---- src/bundle/Server.ts | 29 --- src/gateway/opcodes/Identify.ts | 1 + src/gateway/opcodes/VoiceStateUpdate.ts | 2 +- 4 files changed, 207 insertions(+), 80 deletions(-) diff --git a/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts b/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts index 33151056..7c544921 100644 --- a/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts +++ b/src/api/routes/store/published-listings/skus/#sku_id/subscription-plans.ts @@ -4,143 +4,298 @@ import { route } from "@fosscord/api"; const router: Router = Router(); const skus = new Map([ - [ - "978380684370378762", - [ - { - id: "978380692553465866", - name: "Nitro Lite Monthly", - interval: 1, - interval_count: 1, - tag_inclusive: true, - sku_id: "978380684370378762", - currency: "usd", - price: 0, - price_tier: null, - }, - ], - ], [ "521842865731534868", [ { id: "511651856145973248", - name: "Premium Monthly (Legacy)", + name: "Individual Premium Tier 3 Monthly (Legacy)", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521842865731534868", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, + price_tier: null }, { id: "511651860671627264", - name: "Premium Yearly (Legacy)", + name: "Individiual Premium Tier 3 Yearly (Legacy)", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521842865731534868", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, - }, - ], + price_tier: null + } + ] ], [ "521846918637420545", [ { id: "511651871736201216", - name: "Premium Classic Monthly", + name: "Individual Premium Tier 2 Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521846918637420545", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, + price_tier: null }, { id: "511651876987469824", - name: "Premium Classic Yearly", + name: "Individual Premum Tier 2 Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521846918637420545", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, + price_tier: null }, - ], + { + id: "978380684370378761", + name: "Individual Premum Tier 1", + interval: 2, + interval_count: 1, + tax_inclusive: true, + sku_id: "521846918637420545", + currency: "eur", + price: 0, + price_tier: null + } + ] ], [ "521847234246082599", [ { id: "642251038925127690", - name: "Premium Quarterly", + name: "Individual Premium Tier 3 Quarterly", interval: 1, interval_count: 3, tax_inclusive: true, sku_id: "521847234246082599", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, + price_tier: null }, { id: "511651880837840896", - name: "Premium Monthly", + name: "Individual Premium Tier 3 Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521847234246082599", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, + price_tier: null }, { id: "511651885459963904", - name: "Premium Yearly", + name: "Individual Premium Tier 3 Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521847234246082599", - currency: "usd", + currency: "eur", price: 0, - price_tier: null, - }, - ], + price_tier: null + } + ] ], [ "590663762298667008", [ { id: "590665532894740483", - name: "Server Boost Monthly", + name: "Crowd Premium Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "590663762298667008", discount_price: 0, - currency: "usd", + currency: "eur", price: 0, - price_tier: null, + price_tier: null }, { id: "590665538238152709", - name: "Server Boost Yearly", + name: "Crowd Premium Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "590663762298667008", discount_price: 0, - currency: "usd", + currency: "eur", price: 0, - price_tier: null, - }, - ], + price_tier: null + } + ] ], + [ + "978380684370378762", + [ + [ + { + id: "978380692553465866", + name: "Premium Tier 0 Monthly", + interval: 1, + interval_count: 1, + tax_inclusive: true, + sku_id: "978380684370378762", + currency: "usd", + price: 299, + price_tier: null, + prices: { + "0": { + country_prices: { + country_code: "US", + prices: [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + }, + payment_source_prices: { + "775487223059316758": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "736345864146255982": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "683074999590060249": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + } + }, + "3": { + country_prices: { + country_code: "US", + prices: [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + }, + payment_source_prices: { + "775487223059316758": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "736345864146255982": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "683074999590060249": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + } + }, + "4": { + country_prices: { + country_code: "US", + prices: [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + }, + payment_source_prices: { + "775487223059316758": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "736345864146255982": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "683074999590060249": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + } + }, + "1": { + country_prices: { + country_code: "US", + prices: [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + }, + payment_source_prices: { + "775487223059316758": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "736345864146255982": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ], + "683074999590060249": [ + { + currency: "usd", + amount: 0, + exponent: 2 + } + ] + } + } + } + } + ] + ] + ] ]); router.get("/", route({}), async (req: Request, res: Response) => { diff --git a/src/bundle/Server.ts b/src/bundle/Server.ts index dbd57abf..9ba715d1 100644 --- a/src/bundle/Server.ts +++ b/src/bundle/Server.ts @@ -31,35 +31,6 @@ async function main() { await initDatabase(); await Config.init(); await BannedWords.init(); - // // only set endpointPublic, if not already set - // await Config.set({ - // cdn: { - // endpointClient: "${location.host}", - // endpointPrivate: `http://localhost:${port}`, - // }, - // gateway: { - // endpointClient: - // '${location.protocol === "https:" ? "wss://" : "ws://"}${location.host}', - // endpointPrivate: `ws://localhost:${port}`, - // ...(!Config.get().gateway.endpointPublic && { - // endpointPublic: `ws://localhost:${port}`, - // }), - // }, - // regions: { - // default: "fosscord", - // useDefaultAsOptimal: true, - // available: [ - // { - // id: "fosscord", - // name: "Fosscord", - // endpoint: "slowcord.maddy.k.vu:3004", - // vip: false, - // custom: false, - // deprecated: false, - // }, - // ], - // }, - // } as any); //Sentry if (Config.get().sentry.enabled) { diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts index 6e65dd44..60b5da4c 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts @@ -37,6 +37,7 @@ import { Recipient } from "@fosscord/util"; export async function onIdentify(this: WebSocket, data: Payload) { clearTimeout(this.readyTimeout); + // TODO: is this needed now that we use `json-bigint`? if (typeof data.d?.client_state?.highest_last_message_id === "number") data.d.client_state.highest_last_message_id += ""; check.call(this, IdentifySchema, data.d); diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts index daefc504..42e76312 100644 --- a/src/gateway/opcodes/VoiceStateUpdate.ts +++ b/src/gateway/opcodes/VoiceStateUpdate.ts @@ -62,7 +62,7 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) { }); } - // 'Fix' for this one voice state error + // 'Fix' for this one voice state error. TODO: Find out why this is sent if (!voiceState.guild_id) return; //TODO the member should only have these properties: hoisted_role, deaf, joined_at, mute, roles, user -- cgit 1.4.1