diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-28 17:07:36 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-28 17:07:36 +1000 |
commit | 52414c0e7bcaae99d74f5eae0815b4c3fa0f6c52 (patch) | |
tree | b0c2902d156873d4fd6c5a7778f30f24fe0ed644 | |
parent | Fix user guild settings (diff) | |
download | server-52414c0e7bcaae99d74f5eae0815b4c3fa0f6c52.tar.xz |
Discovery splashes + fix guild icons disappearing on settings change
-rw-r--r-- | assets/schemas.json | 3 | ||||
-rw-r--r-- | src/api/routes/guilds/#guild_id/index.ts | 23 | ||||
-rw-r--r-- | src/cdn/Server.ts | 3 | ||||
-rw-r--r-- | src/util/schemas/GuildUpdateSchema.ts | 1 |
4 files changed, 23 insertions, 7 deletions
diff --git a/assets/schemas.json b/assets/schemas.json index a79ac852..c37b74fd 100644 --- a/assets/schemas.json +++ b/assets/schemas.json @@ -21465,6 +21465,9 @@ "premium_progress_bar_enabled": { "type": "boolean" }, + "discovery_splash": { + "type": "string" + }, "name": { "maxLength": 100, "type": "string" diff --git a/src/api/routes/guilds/#guild_id/index.ts b/src/api/routes/guilds/#guild_id/index.ts index 04cb76c2..a20660da 100644 --- a/src/api/routes/guilds/#guild_id/index.ts +++ b/src/api/routes/guilds/#guild_id/index.ts @@ -49,22 +49,31 @@ router.patch( "MANAGE_GUILD", ); + var guild = await Guild.findOneOrFail({ + where: { id: guild_id }, + relations: ["emojis", "roles", "stickers"], + }); + // TODO: guild update check image - if (body.icon) + if (body.icon && body.icon != guild.icon) body.icon = await handleFile(`/icons/${guild_id}`, body.icon); - if (body.banner) + + if (body.banner && body.banner !== guild.banner) body.banner = await handleFile(`/banners/${guild_id}`, body.banner); - if (body.splash) + + if (body.splash && body.splash !== guild.splash) body.splash = await handleFile( `/splashes/${guild_id}`, body.splash, ); - var guild = await Guild.findOneOrFail({ - where: { id: guild_id }, - relations: ["emojis", "roles", "stickers"], - }); + if (body.discovery_splash && body.discovery_splash !== guild.discovery_splash) + body.splash = await handleFile( + `/discovery-splashes/${guild_id}`, + body.discovery_splash, + ); + // TODO: check if body ids are valid guild.assign(body); diff --git a/src/cdn/Server.ts b/src/cdn/Server.ts index f7e6dbdc..45d3abd9 100644 --- a/src/cdn/Server.ts +++ b/src/cdn/Server.ts @@ -55,6 +55,9 @@ export class CDNServer extends Server { this.app.use("/splashes/", avatarsRoute); this.log("verbose", "[Server] Route /splashes registered"); + + this.app.use("/discovery-splashes/", avatarsRoute); + this.log("verbose", "[Server] Route /discovery-splashes registered"); this.app.use("/app-icons/", avatarsRoute); this.log("verbose", "[Server] Route /app-icons registered"); diff --git a/src/util/schemas/GuildUpdateSchema.ts b/src/util/schemas/GuildUpdateSchema.ts index fb2ac4f2..02739190 100644 --- a/src/util/schemas/GuildUpdateSchema.ts +++ b/src/util/schemas/GuildUpdateSchema.ts @@ -14,4 +14,5 @@ export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> { afk_channel_id?: string; preferred_locale?: string; premium_progress_bar_enabled?: boolean; + discovery_splash?: string; } |