summary refs log tree commit diff
path: root/api/src/util/cdn.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-24 10:43:43 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-24 10:43:43 +0200
commit9abb04d2e6fcc2567ddafc2dc753cbb0c79ca930 (patch)
treea9ce1cd54d5dd50023e1a1c5d0a494802f37b5e6 /api/src/util/cdn.ts
parent:sparkles: added User flags (diff)
parent:art: remove start from setup script (diff)
downloadserver-9abb04d2e6fcc2567ddafc2dc753cbb0c79ca930.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-server
Diffstat (limited to '')
-rw-r--r--api/src/util/cdn.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/src/util/cdn.ts b/api/src/util/cdn.ts

index 3c71d980..8c6e9ac9 100644 --- a/api/src/util/cdn.ts +++ b/api/src/util/cdn.ts
@@ -38,3 +38,16 @@ export async function handleFile(path: string, body?: string): Promise<string | throw new HTTPError("Invalid " + path); } } + +export async function deleteFile(path: string) { + const response = await fetch(`${Config.get().cdn.endpoint || "http://localhost:3003"}${path}`, { + headers: { + signature: Config.get().security.requestSignature + }, + method: "DELETE" + }); + const result = await response.json(); + + if (response.status !== 200) throw result; + return result; +}