mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-26 16:15:19 +00:00
Fix updated client stuff...
This commit is contained in:
@@ -71,6 +71,8 @@ export interface ChannelModifySchema {
|
||||
nsfw?: boolean;
|
||||
rtc_region?: string;
|
||||
default_auto_archive_duration?: number;
|
||||
flags?: number;
|
||||
default_thread_rate_limit_per_user?: number;
|
||||
}
|
||||
|
||||
router.patch("/", route({ body: "ChannelModifySchema", permission: "MANAGE_CHANNELS" }), async (req: Request, res: Response) => {
|
||||
|
||||
@@ -36,7 +36,7 @@ router.post("/", route({ body: "InviteCreateSchema", permission: "CREATE_INSTANT
|
||||
|
||||
const invite = await OrmUtils.mergeDeep(new Invite(),{
|
||||
code: random(),
|
||||
temporary: req.body.temporary,
|
||||
temporary: req.body.temporary || true,
|
||||
uses: 0,
|
||||
max_uses: req.body.max_uses,
|
||||
max_age: req.body.max_age,
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface WebhookCreateSchema {
|
||||
* @maxLength 80
|
||||
*/
|
||||
name: string;
|
||||
avatar: string;
|
||||
avatar?: string;
|
||||
}
|
||||
//TODO: implement webhooks
|
||||
router.get("/", route({}), async (req: Request, res: Response) => {
|
||||
@@ -36,6 +36,7 @@ router.post("/", route({ body: "WebhookCreateSchema", permission: "MANAGE_WEBHOO
|
||||
if (name === "clyde") throw new HTTPError("Invalid name", 400);
|
||||
|
||||
// TODO: save webhook in database and send response
|
||||
res.json(new Webhook());
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -117,6 +117,11 @@ export function route(opts: RouteOptions) {
|
||||
const valid = validate(normalizeBody(req.body));
|
||||
if (!valid) {
|
||||
const fields: Record<string, { code?: string; message: string }> = {};
|
||||
if(process.env.LOG_INVALID_BODY) {
|
||||
console.log(`Got invalid request: ${req.method} ${req.originalUrl}`)
|
||||
console.log(req.body)
|
||||
validate.errors?.forEach(x => console.log(x.params))
|
||||
}
|
||||
validate.errors?.forEach((x) => (fields[x.instancePath.slice(1)] = { code: x.keyword, message: x.message || "" }));
|
||||
throw FieldErrors(fields);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user