diff options
Diffstat (limited to 'src/api/routes')
37 files changed, 74 insertions, 59 deletions
diff --git a/src/api/routes/applications/#id/entitlements.ts b/src/api/routes/applications/#id/entitlements.ts index 26054eb0..07b9219d 100644 --- a/src/api/routes/applications/#id/entitlements.ts +++ b/src/api/routes/applications/#id/entitlements.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route //const { exclude_consumed } = req.query; res.status(200).send([]); }); diff --git a/src/api/routes/channels/#channel_id/followers.ts b/src/api/routes/channels/#channel_id/followers.ts index c06db61b..d91f4b84 100644 --- a/src/api/routes/channels/#channel_id/followers.ts +++ b/src/api/routes/channels/#channel_id/followers.ts @@ -1,6 +1,6 @@ import { Router } from "express"; const router: Router = Router(); -// TODO: +// TODO: implement route export default router; diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts b/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts index fbbc65f0..5cdb2ba1 100644 --- a/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts +++ b/src/api/routes/channels/#channel_id/messages/#message_id/crosspost.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.post("/", route({ permission: "MANAGE_MESSAGES" }), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json({ id: "", type: 0, diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts index d542ea0f..00008ed4 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts @@ -12,12 +12,10 @@ import { Message, MessageCreateEvent, MessageCreateSchema, - Snowflake, - uploadFile, - Member, - MessageCreateSchema, PluginEventHandler, - PreMessageEventArgs + PreMessageEventArgs, + Snowflake, + uploadFile } from "@fosscord/util"; import { Request, Response, Router } from "express"; import multer from "multer"; @@ -210,8 +208,8 @@ router.post( }) ); } - - //Defining member fields + + //Defining member fields var member = await Member.findOneOrFail({ where: { id: req.user_id }, relations: ["roles", "user"] }); // TODO: This doesn't work either // member.roles = member.roles.filter((role) => { @@ -224,10 +222,17 @@ router.post( // delete message.member.last_message_id; // delete message.member.index; - let blocks = (await PluginEventHandler.preMessageEvent({ - message - } as PreMessageEventArgs)).filter(x=>x.cancel); - if(blocks.length > 0) throw new HTTPError("Message denied.", 400, blocks.filter(x=>x.blockReason).map(x=>x.blockReason)); + let blocks = ( + await PluginEventHandler.preMessageEvent({ + message + } as PreMessageEventArgs) + ).filter((x) => x.cancel); + if (blocks.length > 0) + throw new HTTPError( + "Message denied.", + 400, + blocks.filter((x) => x.blockReason).map((x) => x.blockReason) + ); await Promise.all([ message.save(), diff --git a/src/api/routes/channels/#channel_id/recipients.ts b/src/api/routes/channels/#channel_id/recipients.ts index 276a0eda..fc6b6b4f 100644 --- a/src/api/routes/channels/#channel_id/recipients.ts +++ b/src/api/routes/channels/#channel_id/recipients.ts @@ -26,7 +26,7 @@ router.put("/:user_id", route({}), async (req: Request, res: Response) => { return res.status(201).json(new_channel); } else { if (channel.recipients!.map((r) => r.user_id).includes(user_id)) { - throw DiscordApiErrors.INVALID_RECIPIENT; //TODO is this the right error? + throw DiscordApiErrors.INVALID_RECIPIENT; //TODO: is this the right error? } channel.recipients!.push(OrmUtils.mergeDeep(new Recipient(), { channel_id, user_id: user_id })); @@ -57,7 +57,7 @@ router.delete("/:user_id", route({}), async (req: Request, res: Response) => { throw DiscordApiErrors.MISSING_PERMISSIONS; if (!channel.recipients!.map((r) => r.user_id).includes(user_id)) { - throw DiscordApiErrors.INVALID_RECIPIENT; //TODO is this the right error? + throw DiscordApiErrors.INVALID_RECIPIENT; //TODO: is this the right error? } await Channel.removeRecipientFromChannel(channel, user_id); diff --git a/src/api/routes/discoverable-guilds.ts b/src/api/routes/discoverable-guilds.ts index 2bf49287..3516efd1 100644 --- a/src/api/routes/discoverable-guilds.ts +++ b/src/api/routes/discoverable-guilds.ts @@ -7,9 +7,10 @@ import { route } from ".."; const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { + let cfg = Config.get(); const { offset, limit, categories } = req.query; - let showAllGuilds = Config.get().guild.discovery.showAllGuilds; - let configLimit = Config.get().guild.discovery.limit; + let showAllGuilds = cfg.guild.discovery.showAllGuilds; + let configLimit = cfg.guild.discovery.limit; // ! this only works using SQL querys // const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) }); let guilds; @@ -31,7 +32,7 @@ router.get("/", route({}), async (req: Request, res: Response) => { res.send({ total: total, guilds: guilds, - offset: Number(offset || Config.get().guild.discovery.offset), + offset: Number(offset || cfg.guild.discovery.offset), limit: Number(limit || configLimit) }); }); diff --git a/src/api/routes/discovery.ts b/src/api/routes/discovery.ts index 7b9edd48..dce29ef6 100644 --- a/src/api/routes/discovery.ts +++ b/src/api/routes/discovery.ts @@ -5,8 +5,7 @@ import { route } from ".."; const router = Router(); router.get("/categories", route({}), async (req: Request, res: Response) => { - // TODO: - // Get locale instead + // TODO: Get locale instead const { locale, primary_only } = req.query; diff --git a/src/api/routes/experiments.ts b/src/api/routes/experiments.ts index 0355c631..356d674f 100644 --- a/src/api/routes/experiments.ts +++ b/src/api/routes/experiments.ts @@ -4,7 +4,7 @@ import { route } from ".."; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.send({ fingerprint: "", assignments: [], guild_experiments: [] }); }); diff --git a/src/api/routes/guilds/#guild_id/discovery-requirements.ts b/src/api/routes/guilds/#guild_id/discovery-requirements.ts index c0260fe7..b8fdd060 100644 --- a/src/api/routes/guilds/#guild_id/discovery-requirements.ts +++ b/src/api/routes/guilds/#guild_id/discovery-requirements.ts @@ -5,9 +5,8 @@ const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { const { guild_id } = req.params; - // TODO: - // Load from database - // Admin control, but for now it allows anyone to be discoverable + // TODO: Load from database + // TODO: Admin control, but for now it allows anyone to be discoverable res.send({ guild_id: guild_id, diff --git a/src/api/routes/guilds/#guild_id/premium.ts b/src/api/routes/guilds/#guild_id/premium.ts index b7716378..920811b0 100644 --- a/src/api/routes/guilds/#guild_id/premium.ts +++ b/src/api/routes/guilds/#guild_id/premium.ts @@ -3,7 +3,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/subscriptions", route({}), async (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json([]); }); diff --git a/src/api/routes/guilds/#guild_id/regions.ts b/src/api/routes/guilds/#guild_id/regions.ts index aa57ec65..5064ace5 100644 --- a/src/api/routes/guilds/#guild_id/regions.ts +++ b/src/api/routes/guilds/#guild_id/regions.ts @@ -7,7 +7,7 @@ const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { const { guild_id } = req.params; const guild = await Guild.findOneOrFail({ where: { id: guild_id } }); - //TODO we should use an enum for guild's features and not hardcoded strings + //TODO: we should use an enum for guild's features and not hardcoded strings return res.json(await getVoiceRegions(getIpAdress(req), guild.features.includes("VIP_REGIONS"))); }); diff --git a/src/api/routes/guilds/#guild_id/templates.ts b/src/api/routes/guilds/#guild_id/templates.ts index 448ee033..af116760 100644 --- a/src/api/routes/guilds/#guild_id/templates.ts +++ b/src/api/routes/guilds/#guild_id/templates.ts @@ -1,5 +1,5 @@ -import { generateCode, route } from "@fosscord/api"; -import { Guild, HTTPError, OrmUtils, Template } from "@fosscord/util"; +import { route } from "@fosscord/api"; +import { generateCode, Guild, HTTPError, OrmUtils, Template } from "@fosscord/util"; import { Request, Response, Router } from "express"; const router: Router = Router(); diff --git a/src/api/routes/guilds/#guild_id/widget.json.ts b/src/api/routes/guilds/#guild_id/widget.json.ts index 368fe46e..66cc456f 100644 --- a/src/api/routes/guilds/#guild_id/widget.json.ts +++ b/src/api/routes/guilds/#guild_id/widget.json.ts @@ -1,5 +1,5 @@ -import { random, route } from "@fosscord/api"; -import { Channel, Guild, HTTPError, Invite, Member, OrmUtils, Permissions } from "@fosscord/util"; +import { route } from "@fosscord/api"; +import { Channel, Guild, HTTPError, Invite, Member, OrmUtils, Permissions, random } from "@fosscord/util"; import { Request, Response, Router } from "express"; const router: Router = Router(); diff --git a/src/api/routes/guilds/index.ts b/src/api/routes/guilds/index.ts index 6946e2f7..3d433232 100644 --- a/src/api/routes/guilds/index.ts +++ b/src/api/routes/guilds/index.ts @@ -7,9 +7,10 @@ const router: Router = Router(); //TODO: create default channel router.post("/", route({ body: "GuildCreateSchema", right: "CREATE_GUILDS" }), async (req: Request, res: Response) => { + let cfg = Config.get(); const body = req.body as GuildCreateSchema; - const { maxGuilds } = Config.get().limits.user; + const { maxGuilds } = cfg.limits.user; const guild_count = await Member.count({ where: { id: req.user_id } }); const rights = await getRights(req.user_id); if (guild_count >= maxGuilds && !rights.has("MANAGE_GUILDS")) { @@ -18,7 +19,7 @@ router.post("/", route({ body: "GuildCreateSchema", right: "CREATE_GUILDS" }), a const guild = await Guild.createGuild({ ...body, owner_id: req.user_id }); - const { autoJoin } = Config.get().guild; + const { autoJoin } = cfg.guild; if (autoJoin.enabled && !autoJoin.guilds?.length) { // @ts-ignore await Config.set({ guild: { autoJoin: { guilds: [guild.id] } } }); diff --git a/src/api/routes/guilds/templates/index.ts b/src/api/routes/guilds/templates/index.ts index 467186a3..bef10d6c 100644 --- a/src/api/routes/guilds/templates/index.ts +++ b/src/api/routes/guilds/templates/index.ts @@ -4,8 +4,9 @@ import { Request, Response, Router } from "express"; import fetch from "node-fetch"; const router: Router = Router(); +let cfg = Config.get(); router.get("/:code", route({}), async (req: Request, res: Response) => { - const { allowDiscordTemplates, allowRaws, enabled } = Config.get().templates; + const { allowDiscordTemplates, allowRaws, enabled } = cfg.templates; if (!enabled) res.json({ code: 403, message: "Template creation & usage is disabled on this instance." }).sendStatus(403); const { code } = req.params; @@ -33,14 +34,14 @@ router.get("/:code", route({}), async (req: Request, res: Response) => { }); router.post("/:code", route({ body: "GuildTemplateCreateSchema" }), async (req: Request, res: Response) => { - const { enabled, allowTemplateCreation, allowDiscordTemplates, allowRaws } = Config.get().templates; + const { enabled, allowTemplateCreation, allowDiscordTemplates, allowRaws } = cfg.templates; if (!enabled) return res.json({ code: 403, message: "Template creation & usage is disabled on this instance." }).sendStatus(403); if (!allowTemplateCreation) return res.json({ code: 403, message: "Template creation is disabled on this instance." }).sendStatus(403); const { code } = req.params; const body = req.body as GuildTemplateCreateSchema; - const { maxGuilds } = Config.get().limits.user; + const { maxGuilds } = cfg.limits.user; const guild_count = await Member.count({ where: { id: req.user_id } }); if (guild_count >= maxGuilds) { diff --git a/src/api/routes/outbound-promotions.ts b/src/api/routes/outbound-promotions.ts index 8e407184..42378bb2 100644 --- a/src/api/routes/outbound-promotions.ts +++ b/src/api/routes/outbound-promotions.ts @@ -1,5 +1,5 @@ -import { route } from "@fosscord/api"; import { Request, Response, Router } from "express"; +import { route } from ".."; const router: Router = Router(); diff --git a/src/api/routes/partners/#guild_id/requirements.ts b/src/api/routes/partners/#guild_id/requirements.ts index c0260fe7..b8fdd060 100644 --- a/src/api/routes/partners/#guild_id/requirements.ts +++ b/src/api/routes/partners/#guild_id/requirements.ts @@ -5,9 +5,8 @@ const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { const { guild_id } = req.params; - // TODO: - // Load from database - // Admin control, but for now it allows anyone to be discoverable + // TODO: Load from database + // TODO: Admin control, but for now it allows anyone to be discoverable res.send({ guild_id: guild_id, diff --git a/src/api/routes/ping.ts b/src/api/routes/ping.ts index 5f1b0174..e8b25442 100644 --- a/src/api/routes/ping.ts +++ b/src/api/routes/ping.ts @@ -1,6 +1,6 @@ -import { route } from "@fosscord/api"; import { Config } from "@fosscord/util"; import { Request, Response, Router } from "express"; +import { route } from ".."; const router = Router(); diff --git a/src/api/routes/science.ts b/src/api/routes/science.ts index cb01e576..a25fc958 100644 --- a/src/api/routes/science.ts +++ b/src/api/routes/science.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.post("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route? res.sendStatus(204); }); diff --git a/src/api/routes/track.ts b/src/api/routes/track.ts index cb01e576..a25fc958 100644 --- a/src/api/routes/track.ts +++ b/src/api/routes/track.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.post("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route? res.sendStatus(204); }); diff --git a/src/api/routes/users/@me/activities/statistics/applications.ts b/src/api/routes/users/@me/activities/statistics/applications.ts index ba359b47..1a3b9906 100644 --- a/src/api/routes/users/@me/activities/statistics/applications.ts +++ b/src/api/routes/users/@me/activities/statistics/applications.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json([]).status(200); }); diff --git a/src/api/routes/users/@me/affinities/guilds.ts b/src/api/routes/users/@me/affinities/guilds.ts index e733910f..7e1a76c2 100644 --- a/src/api/routes/users/@me/affinities/guilds.ts +++ b/src/api/routes/users/@me/affinities/guilds.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.status(200).send({ guild_affinities: [] }); }); diff --git a/src/api/routes/users/@me/affinities/users.ts b/src/api/routes/users/@me/affinities/users.ts index 758bedc3..ead5c564 100644 --- a/src/api/routes/users/@me/affinities/users.ts +++ b/src/api/routes/users/@me/affinities/users.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.status(200).send({ user_affinities: [], inverse_user_affinities: [] }); }); diff --git a/src/api/routes/users/@me/billing/payment-sources.ts b/src/api/routes/users/@me/billing/payment-sources.ts index ba359b47..1a3b9906 100644 --- a/src/api/routes/users/@me/billing/payment-sources.ts +++ b/src/api/routes/users/@me/billing/payment-sources.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json([]).status(200); }); diff --git a/src/api/routes/users/@me/delete.ts b/src/api/routes/users/@me/delete.ts index dfc6131b..c3caf327 100644 --- a/src/api/routes/users/@me/delete.ts +++ b/src/api/routes/users/@me/delete.ts @@ -1,5 +1,6 @@ import { route } from "@fosscord/api"; import { HTTPError, Member, User } from "@fosscord/util"; +import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; let bcrypt: any; @@ -24,7 +25,11 @@ router.post("/", route({}), async (req: Request, res: Response) => { } } - // TODO: decrement guild member count + (await Member.find({ where: { id: req.user_id }, relations: ["guild"] })).forEach((x) => { + let g = x.guild; + if (g.member_count) g.member_count--; + g.save(); + }); if (correctpass) { await Promise.all([User.delete({ id: req.user_id }), Member.delete({ id: req.user_id })]); diff --git a/src/api/routes/users/@me/devices.ts b/src/api/routes/users/@me/devices.ts index cb01e576..7c0fd034 100644 --- a/src/api/routes/users/@me/devices.ts +++ b/src/api/routes/users/@me/devices.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.post("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.sendStatus(204); }); diff --git a/src/api/routes/users/@me/disable.ts b/src/api/routes/users/@me/disable.ts index 05976908..e47ace91 100644 --- a/src/api/routes/users/@me/disable.ts +++ b/src/api/routes/users/@me/disable.ts @@ -1,5 +1,6 @@ import { route } from "@fosscord/api"; import { User } from "@fosscord/util"; +import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; let bcrypt: any; diff --git a/src/api/routes/users/@me/email-settings.ts b/src/api/routes/users/@me/email-settings.ts index 28d0864a..fc248283 100644 --- a/src/api/routes/users/@me/email-settings.ts +++ b/src/api/routes/users/@me/email-settings.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json({ categories: { social: true, diff --git a/src/api/routes/users/@me/entitlements.ts b/src/api/routes/users/@me/entitlements.ts index 7aaa5d7c..2848755a 100644 --- a/src/api/routes/users/@me/entitlements.ts +++ b/src/api/routes/users/@me/entitlements.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/gifts", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json([]).status(200); }); diff --git a/src/api/routes/users/@me/guilds/premium/subscription-slots.ts b/src/api/routes/users/@me/guilds/premium/subscription-slots.ts index ba359b47..3ce7ac1a 100644 --- a/src/api/routes/users/@me/guilds/premium/subscription-slots.ts +++ b/src/api/routes/users/@me/guilds/premium/subscription-slots.ts @@ -1,10 +1,10 @@ -import { route } from "@fosscord/api"; import { Request, Response, Router } from "express"; +import { route } from "../../../../.."; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: implement route res.json([]).status(200); }); diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts index 563300dc..7ee0a178 100644 --- a/src/api/routes/users/@me/index.ts +++ b/src/api/routes/users/@me/index.ts @@ -12,6 +12,7 @@ import { UserModifySchema, UserUpdateEvent } from "@fosscord/util"; +import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; let bcrypt: any; diff --git a/src/api/routes/users/@me/library.ts b/src/api/routes/users/@me/library.ts index 0aea02a0..b1a5a53e 100644 --- a/src/api/routes/users/@me/library.ts +++ b/src/api/routes/users/@me/library.ts @@ -4,7 +4,7 @@ import { Request, Response, Router } from "express"; const router = Router(); router.get("/", route({}), (req: Request, res: Response) => { - // TODO: + // TODO: Add library route res.status(200).send([]); }); diff --git a/src/api/routes/users/@me/mfa/codes.ts b/src/api/routes/users/@me/mfa/codes.ts index c62581cc..956ac2ae 100644 --- a/src/api/routes/users/@me/mfa/codes.ts +++ b/src/api/routes/users/@me/mfa/codes.ts @@ -1,6 +1,7 @@ -import { route } from "@fosscord/api"; import { BackupCode, Config, FieldErrors, generateMfaBackupCodes, MfaCodesSchema, User } from "@fosscord/util"; +import bcrypt from "bcrypt"; import { Request, Response, Router } from "express"; +import { route } from "../../../.."; let bcrypt: any; try { diff --git a/src/api/routes/users/@me/mfa/totp/disable.ts b/src/api/routes/users/@me/mfa/totp/disable.ts index a53fa816..22f34e06 100644 --- a/src/api/routes/users/@me/mfa/totp/disable.ts +++ b/src/api/routes/users/@me/mfa/totp/disable.ts @@ -2,6 +2,7 @@ import { route } from "@fosscord/api"; import { BackupCode, generateToken, HTTPError, TotpDisableSchema, User } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { verifyToken } from "node-2fa"; +import { route } from "../../../../.."; const router = Router(); diff --git a/src/api/routes/users/@me/mfa/totp/enable.ts b/src/api/routes/users/@me/mfa/totp/enable.ts index 0bf1a188..15b2764b 100644 --- a/src/api/routes/users/@me/mfa/totp/enable.ts +++ b/src/api/routes/users/@me/mfa/totp/enable.ts @@ -2,6 +2,7 @@ import { route } from "@fosscord/api"; import { BackupCode, Config, generateMfaBackupCodes, generateToken, HTTPError, TotpEnableSchema, User } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { verifyToken } from "node-2fa"; +import { route } from "../../../../.."; let bcrypt: any; try { diff --git a/src/api/routes/users/@me/relationships.ts b/src/api/routes/users/@me/relationships.ts index 8267c142..1ff6c452 100644 --- a/src/api/routes/users/@me/relationships.ts +++ b/src/api/routes/users/@me/relationships.ts @@ -25,7 +25,7 @@ router.get("/", route({}), async (req: Request, res: Response) => { select: ["relationships"] }); - //TODO DTO + //TODO: DTO const related_users = user.relationships.map((r) => { return { id: r.to.id, @@ -181,7 +181,7 @@ async function updateRelationship(req: Request, res: Response, friend: User, typ if (friendRequest.type === RelationshipType.blocked) throw new HTTPError("The user blocked you"); if (friendRequest.type === RelationshipType.friends) throw new HTTPError("You are already friends with the user"); // accept friend request - incoming_relationship = friendRequest as any; //TODO: checkme, any cast + incoming_relationship = friendRequest; incoming_relationship.type = RelationshipType.friends; } @@ -189,7 +189,7 @@ async function updateRelationship(req: Request, res: Response, friend: User, typ if (relationship.type === RelationshipType.outgoing) throw new HTTPError("You already sent a friend request"); if (relationship.type === RelationshipType.blocked) throw new HTTPError("Unblock the user before sending a friend request"); if (relationship.type === RelationshipType.friends) throw new HTTPError("You are already friends with the user"); - outgoing_relationship = relationship as any; //TODO: checkme, any cast + outgoing_relationship = relationship; outgoing_relationship.type = RelationshipType.friends; } diff --git a/src/api/routes/voice/regions.ts b/src/api/routes/voice/regions.ts index eacdcf11..9745bbe4 100644 --- a/src/api/routes/voice/regions.ts +++ b/src/api/routes/voice/regions.ts @@ -1,5 +1,5 @@ -import { getIpAdress, getVoiceRegions, route } from "@fosscord/api"; import { Request, Response, Router } from "express"; +import { getIpAdress, getVoiceRegions, route } from "../.."; const router: Router = Router(); |