diff options
author | Thesourtimes <cckhmck@gmail.com> | 2022-01-01 20:04:30 +0300 |
---|---|---|
committer | Thesourtimes <cckhmck@gmail.com> | 2022-01-01 20:04:30 +0300 |
commit | ff93a9178d05b8c60b64c7dbe29f903317e84d67 (patch) | |
tree | ca7db91b442ac10e168ad88fd3ccde9458635e02 | |
parent | Fix game statusses (diff) | |
download | server-ff93a9178d05b8c60b64c7dbe29f903317e84d67.tar.xz |
Organize @fosscord/api utils in directories
-rw-r--r-- | api/src/Server.ts | 2 | ||||
-rw-r--r-- | api/src/util/entities/blockedEmailDomains.txt (renamed from api/src/util/blockedEmailDomains.txt) | 0 | ||||
-rw-r--r-- | api/src/util/entities/trustedEmailDomains.txt (renamed from api/src/util/trustedEmailDomains.txt) | 0 | ||||
-rw-r--r-- | api/src/util/handlers/Instance.ts (renamed from api/src/util/Instance.ts) | 0 | ||||
-rw-r--r-- | api/src/util/handlers/Message.ts (renamed from api/src/util/Message.ts) | 2 | ||||
-rw-r--r-- | api/src/util/handlers/Voice.ts (renamed from api/src/util/Voice.ts) | 2 | ||||
-rw-r--r-- | api/src/util/handlers/route.ts (renamed from api/src/util/route.ts) | 2 | ||||
-rw-r--r-- | api/src/util/index.ts | 16 | ||||
-rw-r--r-- | api/src/util/utility/Base64.ts (renamed from api/src/util/Base64.ts) | 0 | ||||
-rw-r--r-- | api/src/util/utility/RandomInviteID.ts (renamed from api/src/util/RandomInviteID.ts) | 0 | ||||
-rw-r--r-- | api/src/util/utility/String.ts (renamed from api/src/util/String.ts) | 0 | ||||
-rw-r--r-- | api/src/util/utility/ipAddress.ts (renamed from api/src/util/ipAddress.ts) | 0 | ||||
-rw-r--r-- | api/src/util/utility/passwordStrength.ts (renamed from api/src/util/passwordStrength.ts) | 0 | ||||
-rw-r--r-- | util/src/entities/ClientRelase.ts (renamed from util/src/entities/clientRelase.ts) | 0 | ||||
-rw-r--r-- | util/src/entities/index.ts | 2 |
15 files changed, 14 insertions, 12 deletions
diff --git a/api/src/Server.ts b/api/src/Server.ts index b0683dfc..4cf0917d 100644 --- a/api/src/Server.ts +++ b/api/src/Server.ts @@ -10,7 +10,7 @@ import { initRateLimits } from "./middlewares/RateLimit"; import TestClient from "./middlewares/TestClient"; import { initTranslation } from "./middlewares/Translation"; import morgan from "morgan"; -import { initInstance } from "./util/Instance"; +import { initInstance } from "./util/handlers/Instance"; import { registerRoutes } from "@fosscord/util"; import { red } from "picocolors" diff --git a/api/src/util/blockedEmailDomains.txt b/api/src/util/entities/blockedEmailDomains.txt index eb88305d..eb88305d 100644 --- a/api/src/util/blockedEmailDomains.txt +++ b/api/src/util/entities/blockedEmailDomains.txt diff --git a/api/src/util/trustedEmailDomains.txt b/api/src/util/entities/trustedEmailDomains.txt index 38ffa4fa..38ffa4fa 100644 --- a/api/src/util/trustedEmailDomains.txt +++ b/api/src/util/entities/trustedEmailDomains.txt diff --git a/api/src/util/Instance.ts b/api/src/util/handlers/Instance.ts index 6bddfa98..6bddfa98 100644 --- a/api/src/util/Instance.ts +++ b/api/src/util/handlers/Instance.ts diff --git a/api/src/util/Message.ts b/api/src/util/handlers/Message.ts index 4ba93edd..ba676394 100644 --- a/api/src/util/Message.ts +++ b/api/src/util/handlers/Message.ts @@ -22,7 +22,7 @@ import { import { HTTPError } from "lambert-server"; import fetch from "node-fetch"; import cheerio from "cheerio"; -import { MessageCreateSchema } from "../routes/channels/#channel_id/messages"; +import { MessageCreateSchema } from "../../routes/channels/#channel_id/messages"; // TODO: check webhook, application, system author, stickers // TODO: embed gifs/videos/images diff --git a/api/src/util/Voice.ts b/api/src/util/handlers/Voice.ts index f06b1aaa..4d60eb91 100644 --- a/api/src/util/Voice.ts +++ b/api/src/util/handlers/Voice.ts @@ -1,5 +1,5 @@ import { Config } from "@fosscord/util"; -import { distanceBetweenLocations, IPAnalysis } from "./ipAddress"; +import { distanceBetweenLocations, IPAnalysis } from "../utility/ipAddress"; export async function getVoiceRegions(ipAddress: string, vip: boolean) { const regions = Config.get().regions; diff --git a/api/src/util/route.ts b/api/src/util/handlers/route.ts index e4794eb5..ef6c8571 100644 --- a/api/src/util/route.ts +++ b/api/src/util/handlers/route.ts @@ -20,6 +20,7 @@ import addFormats from "ajv-formats"; const SchemaPath = path.join(__dirname, "..", "..", "assets", "schemas.json"); const schemas = JSON.parse(fs.readFileSync(SchemaPath, { encoding: "utf8" })); + export const ajv = new Ajv({ allErrors: true, parseDate: true, @@ -30,6 +31,7 @@ export const ajv = new Ajv({ strict: true, strictRequired: true }); + addFormats(ajv); declare global { diff --git a/api/src/util/index.ts b/api/src/util/index.ts index 238787c9..ffbcf24e 100644 --- a/api/src/util/index.ts +++ b/api/src/util/index.ts @@ -1,8 +1,8 @@ -export * from "./Base64"; -export * from "./ipAddress"; -export * from "./Message"; -export * from "./passwordStrength"; -export * from "./RandomInviteID"; -export * from "./route"; -export * from "./String"; -export * from "./Voice"; +export * from "./utility/Base64"; +export * from "./utility/ipAddress"; +export * from "./handlers/Message"; +export * from "./utility/passwordStrength"; +export * from "./utility/RandomInviteID"; +export * from "./handlers/route"; +export * from "./utility/String"; +export * from "./handlers/Voice"; diff --git a/api/src/util/Base64.ts b/api/src/util/utility/Base64.ts index 46cff77a..46cff77a 100644 --- a/api/src/util/Base64.ts +++ b/api/src/util/utility/Base64.ts diff --git a/api/src/util/RandomInviteID.ts b/api/src/util/utility/RandomInviteID.ts index 7ea344e0..7ea344e0 100644 --- a/api/src/util/RandomInviteID.ts +++ b/api/src/util/utility/RandomInviteID.ts diff --git a/api/src/util/String.ts b/api/src/util/utility/String.ts index 982b7e11..982b7e11 100644 --- a/api/src/util/String.ts +++ b/api/src/util/utility/String.ts diff --git a/api/src/util/ipAddress.ts b/api/src/util/utility/ipAddress.ts index 13cc9603..13cc9603 100644 --- a/api/src/util/ipAddress.ts +++ b/api/src/util/utility/ipAddress.ts diff --git a/api/src/util/passwordStrength.ts b/api/src/util/utility/passwordStrength.ts index 047df008..047df008 100644 --- a/api/src/util/passwordStrength.ts +++ b/api/src/util/utility/passwordStrength.ts diff --git a/util/src/entities/clientRelase.ts b/util/src/entities/ClientRelase.ts index e021b82b..e021b82b 100644 --- a/util/src/entities/clientRelase.ts +++ b/util/src/entities/ClientRelase.ts diff --git a/util/src/entities/index.ts b/util/src/entities/index.ts index fdf18f23..c1f979d4 100644 --- a/util/src/entities/index.ts +++ b/util/src/entities/index.ts @@ -26,4 +26,4 @@ export * from "./Template"; export * from "./User"; export * from "./VoiceState"; export * from "./Webhook"; -export * from "./clientRelase"; \ No newline at end of file +export * from "./ClientRelase"; \ No newline at end of file |