From aa38c188ea9e62c7dc8606938b126283457d9768 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Fri, 14 Jan 2022 23:03:57 +0300 Subject: Further debranding of premium tiers --- .../skus/#sku_id/subscription-plans.ts | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'api/src') diff --git a/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts b/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts index 723a5160..d0b533d8 100644 --- a/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts +++ b/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts @@ -14,7 +14,7 @@ const skus = new Map([ interval_count: 1, tax_inclusive: true, sku_id: "521842865731534868", - currency: "usd", + currency: "eur", price: 0, price_tier: null }, @@ -25,7 +25,7 @@ const skus = new Map([ interval_count: 1, tax_inclusive: true, sku_id: "521842865731534868", - currency: "usd", + currency: "eur", price: 0, price_tier: null } @@ -36,23 +36,23 @@ const skus = new Map([ [ { id: "511651871736201216", - name: "Premium Classic Monthly", + name: "Individual Premium Tier 1 Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521846918637420545", - currency: "usd", + currency: "eur", price: 0, price_tier: null }, { id: "511651876987469824", - name: "Premium Classic Yearly", + name: "Individual Premium Tier 1 Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521846918637420545", - currency: "usd", + currency: "eur", price: 0, price_tier: null } @@ -63,34 +63,34 @@ const skus = new Map([ [ { id: "642251038925127690", - name: "Premium Quarterly", + name: "Individual Premium Tier 2 Quarterly", interval: 1, interval_count: 3, tax_inclusive: true, sku_id: "521847234246082599", - currency: "usd", + currency: "eur", price: 0, price_tier: null }, { id: "511651880837840896", - name: "Premium Monthly", + name: "Individual Premium Tier 2 Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521847234246082599", - currency: "usd", + currency: "eur", price: 0, price_tier: null }, { id: "511651885459963904", - name: "Premium Yearly", + name: "Individual Premium Tier 2 Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521847234246082599", - currency: "usd", + currency: "eur", price: 0, price_tier: null } @@ -101,25 +101,25 @@ const skus = new Map([ [ { 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 }, { 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 } -- cgit 1.5.1 From dbe88d5b188fc91c560da3b8a839b743acc543b0 Mon Sep 17 00:00:00 2001 From: Chris Chrome Date: Sun, 16 Jan 2022 23:51:04 -0500 Subject: Revert previous commit --- .../skus/#sku_id/subscription-plans.ts | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'api/src') diff --git a/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts b/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts index d0b533d8..723a5160 100644 --- a/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts +++ b/api/src/routes/store/published-listings/skus/#sku_id/subscription-plans.ts @@ -14,7 +14,7 @@ const skus = new Map([ interval_count: 1, tax_inclusive: true, sku_id: "521842865731534868", - currency: "eur", + currency: "usd", price: 0, price_tier: null }, @@ -25,7 +25,7 @@ const skus = new Map([ interval_count: 1, tax_inclusive: true, sku_id: "521842865731534868", - currency: "eur", + currency: "usd", price: 0, price_tier: null } @@ -36,23 +36,23 @@ const skus = new Map([ [ { id: "511651871736201216", - name: "Individual Premium Tier 1 Monthly", + name: "Premium Classic Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521846918637420545", - currency: "eur", + currency: "usd", price: 0, price_tier: null }, { id: "511651876987469824", - name: "Individual Premium Tier 1 Yearly", + name: "Premium Classic Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521846918637420545", - currency: "eur", + currency: "usd", price: 0, price_tier: null } @@ -63,34 +63,34 @@ const skus = new Map([ [ { id: "642251038925127690", - name: "Individual Premium Tier 2 Quarterly", + name: "Premium Quarterly", interval: 1, interval_count: 3, tax_inclusive: true, sku_id: "521847234246082599", - currency: "eur", + currency: "usd", price: 0, price_tier: null }, { id: "511651880837840896", - name: "Individual Premium Tier 2 Monthly", + name: "Premium Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "521847234246082599", - currency: "eur", + currency: "usd", price: 0, price_tier: null }, { id: "511651885459963904", - name: "Individual Premium Tier 2 Yearly", + name: "Premium Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "521847234246082599", - currency: "eur", + currency: "usd", price: 0, price_tier: null } @@ -101,25 +101,25 @@ const skus = new Map([ [ { id: "590665532894740483", - name: "Crowd Premium Monthly", + name: "Server Boost Monthly", interval: 1, interval_count: 1, tax_inclusive: true, sku_id: "590663762298667008", discount_price: 0, - currency: "eur", + currency: "usd", price: 0, price_tier: null }, { id: "590665538238152709", - name: "Crowd Premium Yearly", + name: "Server Boost Yearly", interval: 2, interval_count: 1, tax_inclusive: true, sku_id: "590663762298667008", discount_price: 0, - currency: "eur", + currency: "usd", price: 0, price_tier: null } -- cgit 1.5.1 From f9ff5b35f3b65d72302ff131cdd6375d572c1842 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sun, 23 Jan 2022 17:46:04 +0300 Subject: Closed-join guilds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves #537 Signed-off-by: Erkin Alp Güney --- api/src/routes/invites/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'api/src') diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts index ac813126..37e9e05a 100644 --- a/api/src/routes/invites/index.ts +++ b/api/src/routes/invites/index.ts @@ -19,7 +19,8 @@ router.post("/:code", route({}), async (req: Request, res: Response) => { const { features } = await Guild.findOneOrFail({ id: guild_id}); const { public_flags } = await User.findOneOrFail({ id: req.user_id }); - if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("The Maze isn't meant for you.", 401) + if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("Only intended for the staff of this server.", 401); + if(features.includes("INVITES_CLOSED")) throw new HTTPError("Sorry, this guild has joins closed.", 403); const invite = await Invite.joinGuild(req.user_id, code); -- cgit 1.5.1 From d6f5a08cb5bda45131e2195b12307204f6e1eebb Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sat, 15 Jan 2022 18:42:29 +1100 Subject: Add unhandled channel types to IsTextChannel method --- api/src/routes/channels/#channel_id/messages/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'api/src') diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts index c3d3d408..1ae9d676 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts @@ -37,7 +37,11 @@ export function isTextChannel(type: ChannelType): boolean { case ChannelType.GUILD_PUBLIC_THREAD: case ChannelType.GUILD_PRIVATE_THREAD: case ChannelType.GUILD_TEXT: + case ChannelType.ENCRYPTED: + case ChannelType.ENCRYPTED_THREAD: return true; + default: + throw new HTTPError("unimplemented", 400); } } @@ -87,7 +91,7 @@ router.get("/", async (req: Request, res: Response) => { permissions.hasThrow("VIEW_CHANNEL"); if (!permissions.has("READ_MESSAGE_HISTORY")) return res.json([]); - var query: FindManyOptions & { where: { id?: any } } = { + var query: FindManyOptions & { where: { id?: any; }; } = { order: { id: "DESC" }, take: limit, where: { channel_id }, @@ -216,7 +220,7 @@ router.post( channel.save() ]); - postHandleMessage(message).catch((e) => {}); // no await as it shouldnt block the message send function and silently catch error + postHandleMessage(message).catch((e) => { }); // no await as it shouldnt block the message send function and silently catch error return res.json(message); } -- cgit 1.5.1 From 713b6d07b4528f6d38944ccadbda9f07c87c967f Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 24 Jan 2022 15:22:09 +0100 Subject: Add dummy endpoints to prevent client loading some settings panels indefinitely --- api/src/routes/channels/#channel_id/webhooks.ts | 4 ++++ api/src/routes/guilds/#guild_id/audit-logs.ts | 20 ++++++++++++++++++++ api/src/routes/guilds/#guild_id/integrations.ts | 12 ++++++++++++ api/src/routes/guilds/#guild_id/webhooks.ts | 12 ++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 api/src/routes/guilds/#guild_id/audit-logs.ts create mode 100644 api/src/routes/guilds/#guild_id/integrations.ts create mode 100644 api/src/routes/guilds/#guild_id/webhooks.ts (limited to 'api/src') diff --git a/api/src/routes/channels/#channel_id/webhooks.ts b/api/src/routes/channels/#channel_id/webhooks.ts index 7b894455..92895da6 100644 --- a/api/src/routes/channels/#channel_id/webhooks.ts +++ b/api/src/routes/channels/#channel_id/webhooks.ts @@ -14,6 +14,10 @@ export interface WebhookCreateSchema { name: string; avatar: string; } +//TODO: implement webhooks +router.get("/", route({}), async (req: Request, res: Response) => { + res.json([]); +}); // TODO: use Image Data Type for avatar instead of String router.post("/", route({ body: "WebhookCreateSchema", permission: "MANAGE_WEBHOOKS" }), async (req: Request, res: Response) => { diff --git a/api/src/routes/guilds/#guild_id/audit-logs.ts b/api/src/routes/guilds/#guild_id/audit-logs.ts new file mode 100644 index 00000000..a4f2f800 --- /dev/null +++ b/api/src/routes/guilds/#guild_id/audit-logs.ts @@ -0,0 +1,20 @@ +import { Router, Response, Request } from "express"; +import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util"; +import { HTTPError } from "lambert-server"; +import { route } from "@fosscord/api"; +import { ChannelModifySchema } from "../../channels/#channel_id"; +const router = Router(); + +//TODO: implement audit logs +router.get("/", route({}), async (req: Request, res: Response) => { + res.json({ + audit_log_entries: [], + users: [], + integrations: [], + webhooks: [], + guild_scheduled_events: [], + threads: [], + application_commands: [] + }); +}); +export default router; diff --git a/api/src/routes/guilds/#guild_id/integrations.ts b/api/src/routes/guilds/#guild_id/integrations.ts new file mode 100644 index 00000000..abf997c9 --- /dev/null +++ b/api/src/routes/guilds/#guild_id/integrations.ts @@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util"; +import { HTTPError } from "lambert-server"; +import { route } from "@fosscord/api"; +import { ChannelModifySchema } from "../../channels/#channel_id"; +const router = Router(); + +//TODO: implement integrations list +router.get("/", route({}), async (req: Request, res: Response) => { + res.json([]); +}); +export default router; diff --git a/api/src/routes/guilds/#guild_id/webhooks.ts b/api/src/routes/guilds/#guild_id/webhooks.ts new file mode 100644 index 00000000..8b2febea --- /dev/null +++ b/api/src/routes/guilds/#guild_id/webhooks.ts @@ -0,0 +1,12 @@ +import { Router, Response, Request } from "express"; +import { Channel, ChannelUpdateEvent, getPermission, emitEvent } from "@fosscord/util"; +import { HTTPError } from "lambert-server"; +import { route } from "@fosscord/api"; +import { ChannelModifySchema } from "../../channels/#channel_id"; +const router = Router(); + +//TODO: implement webhooks +router.get("/", route({}), async (req: Request, res: Response) => { + res.json([]); +}); +export default router; -- cgit 1.5.1 From b512fa49b08e9f4ef9cdba3537335c37bb663180 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Fri, 4 Feb 2022 19:59:13 +1100 Subject: Remove nulled properties from GET `/channels/#id/messages` for improved compatibility with some client ( discord.js ) --- api/src/routes/channels/#channel_id/messages/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'api/src') diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts index 1ae9d676..5fdab623 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts @@ -126,6 +126,13 @@ router.get("/", async (req: Request, res: Response) => { y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`; }); + //Some clients ( discord.js ) only check if a property exists within the response, + //which causes erorrs when, say, the `application` property is `null`. + for (var curr in x) { + if (x[curr] === null) + delete x[curr]; + } + return x; }) ); -- cgit 1.5.1 From 385bdfdff4d1166a556e70c6fa98754dadd84d51 Mon Sep 17 00:00:00 2001 From: ImAaronFR <96433859+ImAaronFR@users.noreply.github.com> Date: Wed, 9 Feb 2022 09:52:27 +0330 Subject: [Fix] Client bug (#623) If you don't delete this property for some reasons after you send a message in a guild, your roles will be removed (client sided) for everyone, this fixes it. --- api/src/routes/channels/#channel_id/messages/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'api/src') diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts index 5fdab623..2fd08b04 100644 --- a/api/src/routes/channels/#channel_id/messages/index.ts +++ b/api/src/routes/channels/#channel_id/messages/index.ts @@ -219,7 +219,10 @@ router.post( }) ); } - + + //Fix for the client bug + delete message.member + await Promise.all([ message.save(), emitEvent({ event: "MESSAGE_CREATE", channel_id: channel_id, data: message } as MessageCreateEvent), -- cgit 1.5.1