Move redirect uri generation to getRedirectUri function of Connection class.

Use api_endpointPublic instead of cdn_endpointPublic
This commit is contained in:
Madeline
2023-03-18 19:33:32 -04:00
committed by Puyodead1
parent 9d5c5a8292
commit c7277efbad
15 changed files with 40 additions and 138 deletions
@@ -3,7 +3,7 @@ import {
ConnectedAccount,
ConnectionUpdateSchema,
DiscordApiErrors,
emitEvent
emitEvent,
} from "@fosscord/util";
import { Request, Response, Router } from "express";
const router = Router();
@@ -38,10 +38,12 @@ router.patch(
if (!connection) return DiscordApiErrors.UNKNOWN_CONNECTION;
// TODO: do we need to do anything if the connection is revoked?
//@ts-ignore For some reason the client sends this as a boolean, even tho docs say its a number?
if (typeof body.visibility === "boolean") body.visibility = body.visibility ? 1 : 0;
//@ts-ignore For some reason the client sends this as a boolean, even tho docs say its a number?
if (typeof body.show_activity === "boolean") body.show_activity = body.show_activity ? 1 : 0;
if (typeof body.visibility === "boolean")
//@ts-expect-error For some reason the client sends this as a boolean, even tho docs say its a number?
body.visibility = body.visibility ? 1 : 0;
if (typeof body.show_activity === "boolean")
//@ts-expect-error For some reason the client sends this as a boolean, even tho docs say its a number?
body.show_activity = body.show_activity ? 1 : 0;
connection.assign(req.body);