diff --git a/cdn/package-lock.json b/cdn/package-lock.json
index 62c2cdc8..08d49abf 100644
--- a/cdn/package-lock.json
+++ b/cdn/package-lock.json
@@ -43,7 +43,7 @@
"@types/multer": "^1.4.7",
"@types/node": "^14.17.0",
"@types/node-fetch": "^2.5.7",
- "@zerollup/ts-transform-paths": "^1.7.18",
+ "@ovos-media/ts-transform-paths": "^1.7.18-1",
"ts-patch": "^1.4.4"
}
},
diff --git a/cdn/package.json b/cdn/package.json
index 57ee89d1..b9aaea69 100644
--- a/cdn/package.json
+++ b/cdn/package.json
@@ -31,8 +31,8 @@
"@types/multer": "^1.4.7",
"@types/node": "^14.17.0",
"@types/node-fetch": "^2.5.7",
- "@zerollup/ts-transform-paths": "^1.7.18",
- "ts-patch": "^1.4.4"
+ "@ovos-media/ts-transform-paths": "^1.7.18-1",
+ "ts-patch": "^2.0.1"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.36.1",
@@ -40,21 +40,21 @@
"@fosscord/util": "file:../util",
"body-parser": "^1.19.0",
"btoa": "^1.2.1",
- "dotenv": "^10.0.0",
+ "dotenv": "^16.0.1",
"exif-be-gone": "^1.2.0",
"express": "^4.17.1",
"express-async-errors": "^3.1.1",
- "file-type": "^16.5.4",
+ "file-type": "^17.1.2",
"form-data": "^4.0.0",
"fs-extra": "^10.0.0",
"image-size": "^1.0.0",
- "jest": "^27.0.6",
+ "jest": "^28.1.3",
"lambert-db": "^1.2.3",
"lambert-server": "^1.2.12",
"missing-native-js-functions": "^1.2.17",
- "multer": "^1.4.2",
+ "multer": "^1.4.5-lts.1",
"nanocolors": "^0.2.12",
- "node-fetch": "^2.6.2",
+ "node-fetch": "^3.2.9",
"supertest": "^6.1.6",
"typescript": "^4.1.2"
},
diff --git a/cdn/src/routes/attachments.ts b/cdn/src/routes/attachments.ts
index 33801932..2aed752e 100644
--- a/cdn/src/routes/attachments.ts
+++ b/cdn/src/routes/attachments.ts
@@ -68,7 +68,7 @@ router.get(
`attachments/${channel_id}/${id}/${filename}`
);
if (!file) throw new HTTPError("File not found");
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
let content_type = type?.mime || "application/octet-stream";
if (SANITIZED_CONTENT_TYPE.includes(content_type)) {
diff --git a/cdn/src/routes/avatars.ts b/cdn/src/routes/avatars.ts
index 0b766144..3b521cc3 100644
--- a/cdn/src/routes/avatars.ts
+++ b/cdn/src/routes/avatars.ts
@@ -38,7 +38,7 @@ router.post(
.update(Snowflake.generate())
.digest("hex");
- const type = await FileType.fromBuffer(buffer);
+ const type = await FileType.fileTypeFromBuffer(buffer);
if (!type || !ALLOWED_MIME_TYPES.includes(type.mime))
throw new HTTPError("Invalid file type");
if (ANIMATED_MIME_TYPES.includes(type.mime)) hash = `a_${hash}`; // animated icons have a_ infront of the hash
@@ -65,7 +65,7 @@ router.get("/:user_id", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000");
@@ -80,7 +80,7 @@ router.get("/:user_id/:hash", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000");
diff --git a/cdn/src/routes/external.ts b/cdn/src/routes/external.ts
index dc90e3c8..ed44c905 100644
--- a/cdn/src/routes/external.ts
+++ b/cdn/src/routes/external.ts
@@ -49,7 +49,7 @@ router.get("/:id", async (req: Request, res: Response) => {
const file = await storage.get(`/external/${id}`);
if (!file) throw new HTTPError("File not found");
- const result = await FileType.fromBuffer(file);
+ const result = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", result?.mime);
diff --git a/cdn/src/routes/role-icons.ts b/cdn/src/routes/role-icons.ts
index 1d92d638..a850db88 100644
--- a/cdn/src/routes/role-icons.ts
+++ b/cdn/src/routes/role-icons.ts
@@ -38,7 +38,7 @@ router.post(
.update(Snowflake.generate())
.digest("hex");
- const type = await FileType.fromBuffer(buffer);
+ const type = await FileType.fileTypeFromBuffer(buffer);
if (!type || !ALLOWED_MIME_TYPES.includes(type.mime))
throw new HTTPError("Invalid file type");
@@ -64,7 +64,7 @@ router.get("/:role_id", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000, must-revalidate");
@@ -79,7 +79,7 @@ router.get("/:role_id/:hash", async (req: Request, res: Response) => {
const file = await storage.get(path);
if (!file) throw new HTTPError("not found", 404);
- const type = await FileType.fromBuffer(file);
+ const type = await FileType.fileTypeFromBuffer(file);
res.set("Content-Type", type?.mime);
res.set("Cache-Control", "public, max-age=31536000, must-revalidate");
diff --git a/cdn/tsconfig.json b/cdn/tsconfig.json
index 64ab18f4..1ad037c6 100644
--- a/cdn/tsconfig.json
+++ b/cdn/tsconfig.json
@@ -8,7 +8,7 @@
"target": "ES6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"lib": [
- "ES2015",
+ "ES2021",
"dom"
] /* Specify library files to be included in the compilation. */,
"allowJs": true /* Allow javascript files to be compiled. */,
@@ -65,7 +65,7 @@
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
+ "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
@@ -76,6 +76,6 @@
"@fosscord/cdn": ["src/index"],
"@fosscord/cdn/*": ["src/*"]
},
- "plugins": [{ "transform": "@zerollup/ts-transform-paths" }]
+ "plugins": [{ "transform": "@ovos-media/ts-transform-paths" }]
}
}
|