mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 04:32:35 +01:00
Discovery splashes + fix guild icons disappearing on settings change
This commit is contained in:
parent
138cad6b8d
commit
02913b5e24
@ -21465,6 +21465,9 @@
|
|||||||
"premium_progress_bar_enabled": {
|
"premium_progress_bar_enabled": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"discovery_splash": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"maxLength": 100,
|
"maxLength": 100,
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -49,22 +49,31 @@ router.patch(
|
|||||||
"MANAGE_GUILD",
|
"MANAGE_GUILD",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var guild = await Guild.findOneOrFail({
|
||||||
|
where: { id: guild_id },
|
||||||
|
relations: ["emojis", "roles", "stickers"],
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: guild update check image
|
// TODO: guild update check image
|
||||||
|
|
||||||
if (body.icon)
|
if (body.icon && body.icon != guild.icon)
|
||||||
body.icon = await handleFile(`/icons/${guild_id}`, body.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);
|
body.banner = await handleFile(`/banners/${guild_id}`, body.banner);
|
||||||
if (body.splash)
|
|
||||||
|
if (body.splash && body.splash !== guild.splash)
|
||||||
body.splash = await handleFile(
|
body.splash = await handleFile(
|
||||||
`/splashes/${guild_id}`,
|
`/splashes/${guild_id}`,
|
||||||
body.splash,
|
body.splash,
|
||||||
);
|
);
|
||||||
|
|
||||||
var guild = await Guild.findOneOrFail({
|
if (body.discovery_splash && body.discovery_splash !== guild.discovery_splash)
|
||||||
where: { id: guild_id },
|
body.splash = await handleFile(
|
||||||
relations: ["emojis", "roles", "stickers"],
|
`/discovery-splashes/${guild_id}`,
|
||||||
});
|
body.discovery_splash,
|
||||||
|
);
|
||||||
|
|
||||||
// TODO: check if body ids are valid
|
// TODO: check if body ids are valid
|
||||||
guild.assign(body);
|
guild.assign(body);
|
||||||
|
|
||||||
|
@ -55,6 +55,9 @@ export class CDNServer extends Server {
|
|||||||
|
|
||||||
this.app.use("/splashes/", avatarsRoute);
|
this.app.use("/splashes/", avatarsRoute);
|
||||||
this.log("verbose", "[Server] Route /splashes registered");
|
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.app.use("/app-icons/", avatarsRoute);
|
||||||
this.log("verbose", "[Server] Route /app-icons registered");
|
this.log("verbose", "[Server] Route /app-icons registered");
|
||||||
|
@ -14,4 +14,5 @@ export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> {
|
|||||||
afk_channel_id?: string;
|
afk_channel_id?: string;
|
||||||
preferred_locale?: string;
|
preferred_locale?: string;
|
||||||
premium_progress_bar_enabled?: boolean;
|
premium_progress_bar_enabled?: boolean;
|
||||||
|
discovery_splash?: string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user