summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--api/src/routes/guilds/index.ts3
-rw-r--r--api/src/util/cdn.ts4
2 files changed, 4 insertions, 3 deletions
diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts
index 2e68d953..3612ca82 100644
--- a/api/src/routes/guilds/index.ts
+++ b/api/src/routes/guilds/index.ts
@@ -1,6 +1,6 @@
 import { Router, Request, Response } from "express";
 import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord/util";
-import { route } from "@fosscord/api";
+import { handleFile, route } from "@fosscord/api";
 import { DiscordApiErrors } from "@fosscord/util";
 import { ChannelModifySchema } from "../channels/#channel_id";
 
@@ -34,6 +34,7 @@ router.post("/", route({ body: "GuildCreateSchema" }), async (req: Request, res:
 
 	await Guild.insert({
 		name: body.name,
+		icon: await handleFile(`/icons/${guild_id}`, body.icon as string),
 		region: Config.get().regions.default,
 		owner_id: req.user_id,
 		afk_timeout: 300,
diff --git a/api/src/util/cdn.ts b/api/src/util/cdn.ts
index 88b0ea0d..8c6e9ac9 100644
--- a/api/src/util/cdn.ts
+++ b/api/src/util/cdn.ts
@@ -42,9 +42,9 @@ export async function handleFile(path: string, body?: string): Promise<string |
 export async function deleteFile(path: string) {
 	const response = await fetch(`${Config.get().cdn.endpoint || "http://localhost:3003"}${path}`, {
 		headers: {
-			signature: Config.get().security.requestSignature,
+			signature: Config.get().security.requestSignature
 		},
-		method: "DELETE",
+		method: "DELETE"
 	});
 	const result = await response.json();