diff --git a/src/cdn/Server.ts b/src/cdn/Server.ts
index cd0d8dee..a6a4330e 100644
--- a/src/cdn/Server.ts
+++ b/src/cdn/Server.ts
@@ -19,7 +19,7 @@
import path from "node:path";
import morgan from "morgan";
import { Server, ServerOptions } from "lambert-server/Server";
-import { CORS, BodyParser } from "@spacebar/api";
+import { CORS, BodyParser } from "@spacebar/api/middlewares";
import { Attachment, initDatabase } from "@spacebar/database";
import { Config, registerRoutes } from "@spacebar/util";
import { ProcessLifecycle } from "../util/util/ProcessLifecycle";
diff --git a/src/cdn/routes/app-assets.ts b/src/cdn/routes/app-assets.ts
index fc20cb17..f67051ac 100644
--- a/src/cdn/routes/app-assets.ts
+++ b/src/cdn/routes/app-assets.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/app-icons.ts b/src/cdn/routes/app-icons.ts
index 4cff5754..46599ad9 100644
--- a/src/cdn/routes/app-icons.ts
+++ b/src/cdn/routes/app-icons.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/attachments.ts b/src/cdn/routes/attachments.ts
index 01621be1..ef91b7d9 100644
--- a/src/cdn/routes/attachments.ts
+++ b/src/cdn/routes/attachments.ts
@@ -22,9 +22,7 @@ import imageSize from "image-size";
import { HTTPError } from "lambert-server/HTTPError";
import { CloudAttachment } from "@spacebar/database";
import { Config, hasValidSignature, NewUrlUserSignatureData, Snowflake, UrlSignResult } from "@spacebar/util";
-import { storage } from "@spacebar/cdn/util/Storage";
-import { multer } from "@spacebar/cdn/util/multer";
-import { cache } from "@spacebar/cdn/util/cache";
+import { storage, multer, cache } from "@spacebar/cdn/util";
const router = Router({ mergeParams: true });
diff --git a/src/cdn/routes/avatar-decoration-presets.ts b/src/cdn/routes/avatar-decoration-presets.ts
index a2df4de4..e52ae710 100644
--- a/src/cdn/routes/avatar-decoration-presets.ts
+++ b/src/cdn/routes/avatar-decoration-presets.ts
@@ -17,10 +17,9 @@
*/
import { Router, Response, Request } from "express";
-import { storage } from "@spacebar/cdn";
import { HTTPError } from "lambert-server/HTTPError";
import { fileTypeFromBuffer } from "file-type";
-import { cache } from "../util/cache";
+import { storage, cache } from "@spacebar/cdn/util";
const router = Router({ mergeParams: true });
diff --git a/src/cdn/routes/avatars.ts b/src/cdn/routes/avatars.ts
index 3a6991e0..099e0ad9 100644
--- a/src/cdn/routes/avatars.ts
+++ b/src/cdn/routes/avatars.ts
@@ -20,10 +20,8 @@ import crypto from "node:crypto";
import { Router, Response, Request } from "express";
import { fileTypeFromBuffer } from "file-type";
import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { HTTPError } from "lambert-server/HTTPError";
-import { multer } from "../util/multer";
-import { cache } from "../util/cache";
+import { storage, multer, cache } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/badge-icons.ts b/src/cdn/routes/badge-icons.ts
index 4eaed599..a2fc0ea0 100644
--- a/src/cdn/routes/badge-icons.ts
+++ b/src/cdn/routes/badge-icons.ts
@@ -17,10 +17,9 @@
*/
import { Router, Response, Request } from "express";
-import { storage } from "@spacebar/cdn";
import { HTTPError } from "lambert-server/HTTPError";
import { fileTypeFromBuffer } from "file-type";
-import { cache } from "../util/cache";
+import { storage, cache } from "@spacebar/cdn/util";
const router = Router({ mergeParams: true });
diff --git a/src/cdn/routes/banners.ts b/src/cdn/routes/banners.ts
index af0d194d..6e3a6bf9 100644
--- a/src/cdn/routes/banners.ts
+++ b/src/cdn/routes/banners.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/channel-icons.ts b/src/cdn/routes/channel-icons.ts
index 3f345bbc..91bfe123 100644
--- a/src/cdn/routes/channel-icons.ts
+++ b/src/cdn/routes/channel-icons.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/discover-splashes.ts b/src/cdn/routes/discover-splashes.ts
index c3aa8444..c43f35f0 100644
--- a/src/cdn/routes/discover-splashes.ts
+++ b/src/cdn/routes/discover-splashes.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/discovery-splashes.ts b/src/cdn/routes/discovery-splashes.ts
index c5ab5b37..d1c3f079 100644
--- a/src/cdn/routes/discovery-splashes.ts
+++ b/src/cdn/routes/discovery-splashes.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/embed.ts b/src/cdn/routes/embed.ts
index 0ca4908f..965d6a94 100644
--- a/src/cdn/routes/embed.ts
+++ b/src/cdn/routes/embed.ts
@@ -16,12 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Request, Response, Router } from "express";
import fs from "node:fs/promises";
-import { HTTPError } from "lambert-server/HTTPError";
import { join } from "node:path";
+import { Request, Response, Router } from "express";
import { fileTypeFromBuffer } from "file-type";
-import { cache } from "../util/cache";
+import { HTTPError } from "lambert-server/HTTPError";
+import { cache } from "@spacebar/cdn/util";
const defaultAvatarHashMap = new Map([
["0", "4a8562cf00887030c416d3ec2d46385a"],
diff --git a/src/cdn/routes/emojis.ts b/src/cdn/routes/emojis.ts
index a0a14ac3..aaf6af9f 100644
--- a/src/cdn/routes/emojis.ts
+++ b/src/cdn/routes/emojis.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/guild-profiles.ts b/src/cdn/routes/guild-profiles.ts
index a38ef4c9..fe87e9a4 100644
--- a/src/cdn/routes/guild-profiles.ts
+++ b/src/cdn/routes/guild-profiles.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Config } from "@spacebar/util";
import crypto from "node:crypto";
import { Request, Response, Router } from "express";
-import { HTTPError } from "lambert-server/HTTPError";
-import { multer } from "../util/multer";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
-import { cache } from "../util/cache";
+import { HTTPError } from "lambert-server/HTTPError";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/icons.ts b/src/cdn/routes/icons.ts
index e2d4341f..bacc046b 100644
--- a/src/cdn/routes/icons.ts
+++ b/src/cdn/routes/icons.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/role-icons.ts b/src/cdn/routes/role-icons.ts
index 55da7f02..86037cd3 100644
--- a/src/cdn/routes/role-icons.ts
+++ b/src/cdn/routes/role-icons.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache } from "@spacebar/cdn/util";
//Role icons ---> avatars.ts modified
diff --git a/src/cdn/routes/splashes.ts b/src/cdn/routes/splashes.ts
index 68f4cede..21556167 100644
--- a/src/cdn/routes/splashes.ts
+++ b/src/cdn/routes/splashes.ts
@@ -17,13 +17,11 @@
*/
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
+import crypto from "node:crypto";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/stickers.ts b/src/cdn/routes/stickers.ts
index 536c617b..dade992d 100644
--- a/src/cdn/routes/stickers.ts
+++ b/src/cdn/routes/stickers.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/routes/team-icons.ts b/src/cdn/routes/team-icons.ts
index 99de19c6..e171dc75 100644
--- a/src/cdn/routes/team-icons.ts
+++ b/src/cdn/routes/team-icons.ts
@@ -16,14 +16,12 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import crypto from "node:crypto";
import { Router, Response, Request } from "express";
-import { Config } from "@spacebar/util";
-import { storage } from "@spacebar/cdn";
import { fileTypeFromBuffer } from "file-type";
import { HTTPError } from "lambert-server/HTTPError";
-import crypto from "node:crypto";
-import { multer } from "../util/multer";
-import { cache, cacheNotFound } from "../util/cache";
+import { Config } from "@spacebar/util";
+import { storage, multer, cache, cacheNotFound } from "@spacebar/cdn/util";
// TODO: check premium and animated pfp are allowed in the config
// TODO: generate different sizes of icon
diff --git a/src/cdn/util/FileStorage.ts b/src/cdn/util/FileStorage.ts
index eaedbc90..068e2c73 100644
--- a/src/cdn/util/FileStorage.ts
+++ b/src/cdn/util/FileStorage.ts
@@ -16,11 +16,11 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { Storage } from "./Storage";
import fs from "node:fs";
import fsp from "node:fs/promises";
import { join, dirname } from "node:path";
import { Readable } from "node:stream";
+import { Storage } from "./Storage";
import ExifTransformer from "exif-be-gone";
export class FileStorage implements Storage {
diff --git a/src/cdn/util/Storage.ts b/src/cdn/util/Storage.ts
index 3245f655..7fa76852 100644
--- a/src/cdn/util/Storage.ts
+++ b/src/cdn/util/Storage.ts
@@ -16,7 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-import { FileStorage } from "./FileStorage";
import path from "node:path";
import fs from "node:fs";
import { red } from "picocolors";
@@ -46,6 +45,7 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) {
if (!fs.existsSync(location)) fs.mkdirSync(location);
process.env.STORAGE_LOCATION = location;
+ const { FileStorage } = require("./FileStorage");
storage = new FileStorage();
} else if (process.env.STORAGE_PROVIDER === "s3") {
try {
diff --git a/src/cdn/util/index.ts b/src/cdn/util/index.ts
index ba249845..7d4e2758 100644
--- a/src/cdn/util/index.ts
+++ b/src/cdn/util/index.ts
@@ -16,6 +16,6 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-export * from "./FileStorage";
+export * from "./cache";
export * from "./multer";
export * from "./Storage";
|