Skip to content

Commit

Permalink
Organize @fosscord/api utils in directories
Browse files Browse the repository at this point in the history
  • Loading branch information
logkos committed Jan 1, 2022
1 parent 69ad3f9 commit 2b6e6ea
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion api/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/src/util/Voice.ts → api/src/util/handlers/Voice.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions api/src/util/route.ts → api/src/util/handlers/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -30,6 +31,7 @@ export const ajv = new Ajv({
strict: true,
strictRequired: true
});

addFormats(ajv);

declare global {
Expand Down
16 changes: 8 additions & 8 deletions api/src/util/index.ts
Original file line number Diff line number Diff line change
@@ -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";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion util/src/entities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export * from "./Template";
export * from "./User";
export * from "./VoiceState";
export * from "./Webhook";
export * from "./clientRelase";
export * from "./ClientRelase";

0 comments on commit 2b6e6ea

Please sign in to comment.