From 2b6e6ea0256325dc6a1097b9f0cfb2928feb12aa Mon Sep 17 00:00:00 2001 From: Thesourtimes Date: Sat, 1 Jan 2022 20:04:30 +0300 Subject: [PATCH 1/2] Organize @fosscord/api utils in directories --- api/src/Server.ts | 2 +- .../util/{ => entities}/blockedEmailDomains.txt | 0 .../util/{ => entities}/trustedEmailDomains.txt | 0 api/src/util/{ => handlers}/Instance.ts | 0 api/src/util/{ => handlers}/Message.ts | 2 +- api/src/util/{ => handlers}/Voice.ts | 2 +- api/src/util/{ => handlers}/route.ts | 2 ++ api/src/util/index.ts | 16 ++++++++-------- api/src/util/{ => utility}/Base64.ts | 0 api/src/util/{ => utility}/RandomInviteID.ts | 0 api/src/util/{ => utility}/String.ts | 0 api/src/util/{ => utility}/ipAddress.ts | 0 api/src/util/{ => utility}/passwordStrength.ts | 0 .../{clientRelase.ts => ClientRelase.ts} | 0 util/src/entities/index.ts | 2 +- 15 files changed, 14 insertions(+), 12 deletions(-) rename api/src/util/{ => entities}/blockedEmailDomains.txt (100%) rename api/src/util/{ => entities}/trustedEmailDomains.txt (100%) rename api/src/util/{ => handlers}/Instance.ts (100%) rename api/src/util/{ => handlers}/Message.ts (98%) rename api/src/util/{ => handlers}/Voice.ts (92%) rename api/src/util/{ => handlers}/route.ts (99%) rename api/src/util/{ => utility}/Base64.ts (100%) rename api/src/util/{ => utility}/RandomInviteID.ts (100%) rename api/src/util/{ => utility}/String.ts (100%) rename api/src/util/{ => utility}/ipAddress.ts (100%) rename api/src/util/{ => utility}/passwordStrength.ts (100%) rename util/src/entities/{clientRelase.ts => ClientRelase.ts} (100%) 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 similarity index 100% rename from api/src/util/blockedEmailDomains.txt rename to api/src/util/entities/blockedEmailDomains.txt diff --git a/api/src/util/trustedEmailDomains.txt b/api/src/util/entities/trustedEmailDomains.txt similarity index 100% rename from api/src/util/trustedEmailDomains.txt rename to api/src/util/entities/trustedEmailDomains.txt diff --git a/api/src/util/Instance.ts b/api/src/util/handlers/Instance.ts similarity index 100% rename from api/src/util/Instance.ts rename to api/src/util/handlers/Instance.ts diff --git a/api/src/util/Message.ts b/api/src/util/handlers/Message.ts similarity index 98% rename from api/src/util/Message.ts rename to 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 similarity index 92% rename from api/src/util/Voice.ts rename to 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 similarity index 99% rename from api/src/util/route.ts rename to 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 similarity index 100% rename from api/src/util/Base64.ts rename to api/src/util/utility/Base64.ts diff --git a/api/src/util/RandomInviteID.ts b/api/src/util/utility/RandomInviteID.ts similarity index 100% rename from api/src/util/RandomInviteID.ts rename to api/src/util/utility/RandomInviteID.ts diff --git a/api/src/util/String.ts b/api/src/util/utility/String.ts similarity index 100% rename from api/src/util/String.ts rename to api/src/util/utility/String.ts diff --git a/api/src/util/ipAddress.ts b/api/src/util/utility/ipAddress.ts similarity index 100% rename from api/src/util/ipAddress.ts rename to api/src/util/utility/ipAddress.ts diff --git a/api/src/util/passwordStrength.ts b/api/src/util/utility/passwordStrength.ts similarity index 100% rename from api/src/util/passwordStrength.ts rename to api/src/util/utility/passwordStrength.ts diff --git a/util/src/entities/clientRelase.ts b/util/src/entities/ClientRelase.ts similarity index 100% rename from util/src/entities/clientRelase.ts rename to 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 From dd62a1ff15434dc5559920ac24297a54639a1ec3 Mon Sep 17 00:00:00 2001 From: Thesourtimes Date: Sat, 1 Jan 2022 20:37:11 +0300 Subject: [PATCH 2/2] add a relase template --- .github/relase_body_template.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/relase_body_template.md diff --git a/.github/relase_body_template.md b/.github/relase_body_template.md new file mode 100644 index 00000000..9a80b37e --- /dev/null +++ b/.github/relase_body_template.md @@ -0,0 +1,11 @@ +Relase +=== + +Notes +=== + +Additions +=== + +Fixes +=== \ No newline at end of file