mirror of
https://github.com/spacebarchat/server.git
synced 2026-06-30 18:11:55 +00:00
CDN: unify imports layout
This commit is contained in:
+1
-1
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"],
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user