summary refs log tree commit diff
path: root/src/cdn
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cdn/Server.ts (renamed from cdn/src/Server.ts)0
-rw-r--r--src/cdn/index.ts (renamed from cdn/src/index.ts)0
-rw-r--r--src/cdn/routes/attachments.ts (renamed from cdn/src/routes/attachments.ts)0
-rw-r--r--src/cdn/routes/avatars.ts (renamed from cdn/src/routes/avatars.ts)0
-rw-r--r--src/cdn/routes/external.ts (renamed from cdn/src/routes/external.ts)2
-rw-r--r--src/cdn/routes/guilds.ts (renamed from cdn/src/routes/guilds.ts)0
-rw-r--r--src/cdn/routes/ping.ts (renamed from cdn/src/routes/ping.ts)0
-rw-r--r--src/cdn/routes/role-icons.ts (renamed from cdn/src/routes/role-icons.ts)0
-rw-r--r--src/cdn/start.ts (renamed from cdn/src/start.ts)1
-rw-r--r--src/cdn/util/FileStorage.ts (renamed from cdn/src/util/FileStorage.ts)5
-rw-r--r--src/cdn/util/S3Storage.ts (renamed from cdn/src/util/S3Storage.ts)0
-rw-r--r--src/cdn/util/Storage.ts (renamed from cdn/src/util/Storage.ts)4
-rw-r--r--src/cdn/util/index.ts (renamed from cdn/src/util/index.ts)0
-rw-r--r--src/cdn/util/multer.ts (renamed from cdn/src/util/multer.ts)0
14 files changed, 6 insertions, 6 deletions
diff --git a/cdn/src/Server.ts b/src/cdn/Server.ts

index 5b395589..5b395589 100644 --- a/cdn/src/Server.ts +++ b/src/cdn/Server.ts
diff --git a/cdn/src/index.ts b/src/cdn/index.ts
index a24300d6..a24300d6 100644 --- a/cdn/src/index.ts +++ b/src/cdn/index.ts
diff --git a/cdn/src/routes/attachments.ts b/src/cdn/routes/attachments.ts
index ae50bc48..ae50bc48 100644 --- a/cdn/src/routes/attachments.ts +++ b/src/cdn/routes/attachments.ts
diff --git a/cdn/src/routes/avatars.ts b/src/cdn/routes/avatars.ts
index e5e25a4c..e5e25a4c 100644 --- a/cdn/src/routes/avatars.ts +++ b/src/cdn/routes/avatars.ts
diff --git a/cdn/src/routes/external.ts b/src/cdn/routes/external.ts
index fc12c017..cb17ff9b 100644 --- a/cdn/src/routes/external.ts +++ b/src/cdn/routes/external.ts
@@ -3,7 +3,7 @@ import fetch from "node-fetch"; import { HTTPError } from "lambert-server"; import { Snowflake } from "@fosscord/util"; import { storage } from "../util/Storage"; -import FileType, { stream } from "file-type"; +import FileType from "file-type"; import { Config } from "@fosscord/util"; import sharp from "sharp"; diff --git a/cdn/src/routes/guilds.ts b/src/cdn/routes/guilds.ts
index 3c4b646c..3c4b646c 100644 --- a/cdn/src/routes/guilds.ts +++ b/src/cdn/routes/guilds.ts
diff --git a/cdn/src/routes/ping.ts b/src/cdn/routes/ping.ts
index 38daf81e..38daf81e 100644 --- a/cdn/src/routes/ping.ts +++ b/src/cdn/routes/ping.ts
diff --git a/cdn/src/routes/role-icons.ts b/src/cdn/routes/role-icons.ts
index 12aae8a4..12aae8a4 100644 --- a/cdn/src/routes/role-icons.ts +++ b/src/cdn/routes/role-icons.ts
diff --git a/cdn/src/start.ts b/src/cdn/start.ts
index 71681b40..1fdea22e 100644 --- a/cdn/src/start.ts +++ b/src/cdn/start.ts
@@ -1,3 +1,4 @@ +require('module-alias/register') import dotenv from "dotenv"; dotenv.config(); diff --git a/cdn/src/util/FileStorage.ts b/src/cdn/util/FileStorage.ts
index 84ecf556..955c570b 100644 --- a/cdn/src/util/FileStorage.ts +++ b/src/cdn/util/FileStorage.ts
@@ -1,10 +1,9 @@ import { Storage } from "./Storage"; import fs from "fs"; -import fse from "fs-extra"; import { join, relative, dirname } from "path"; import "missing-native-js-functions"; import { Readable } from "stream"; -import ExifTransformer = require("exif-be-gone"); +import ExifTransformer from "exif-be-gone"; // TODO: split stored files into separate folders named after cloned route @@ -36,7 +35,7 @@ export class FileStorage implements Storage { async set(path: string, value: any) { path = getPath(path); - fse.ensureDirSync(dirname(path)); + if (!fs.existsSync(dirname(path))) fs.mkdirSync(dirname(path)); value = Readable.from(value); const cleaned_file = fs.createWriteStream(path); diff --git a/cdn/src/util/S3Storage.ts b/src/cdn/util/S3Storage.ts
index c4066817..c4066817 100644 --- a/cdn/src/util/S3Storage.ts +++ b/src/cdn/util/S3Storage.ts
diff --git a/cdn/src/util/Storage.ts b/src/cdn/util/Storage.ts
index 89dd5634..04fbacca 100644 --- a/cdn/src/util/Storage.ts +++ b/src/cdn/util/Storage.ts
@@ -1,6 +1,6 @@ import { FileStorage } from "./FileStorage"; import path from "path"; -import fse from "fs-extra"; +import fs from "fs"; import { bgCyan, black } from "picocolors"; import { S3 } from "@aws-sdk/client-s3"; import { S3Storage } from "./S3Storage"; @@ -22,7 +22,7 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) { location = path.join(process.cwd(), "files"); } console.log(`[CDN] storage location: ${bgCyan(`${black(location)}`)}`); - fse.ensureDirSync(location); + if (!fs.existsSync(location)) fs.mkdirSync(location); process.env.STORAGE_LOCATION = location; storage = new FileStorage(); diff --git a/cdn/src/util/index.ts b/src/cdn/util/index.ts
index 07a5c31a..07a5c31a 100644 --- a/cdn/src/util/index.ts +++ b/src/cdn/util/index.ts
diff --git a/cdn/src/util/multer.ts b/src/cdn/util/multer.ts
index bfdf6aff..bfdf6aff 100644 --- a/cdn/src/util/multer.ts +++ b/src/cdn/util/multer.ts