Fix the minor issues on route

This commit is contained in:
Thesourtimes 2021-11-18 22:15:05 +03:00
parent 159c712c43
commit 7681ea6d8e
5 changed files with 18 additions and 12 deletions

View File

@ -11,7 +11,9 @@ export const NO_AUTHORIZATION_ROUTES = [
"/experiments", "/experiments",
"/-/readyz", "/-/readyz",
"/-/healthz", "/-/healthz",
"/policies/instance/", "/science",
"/track",
"/policies/instance",
/\/guilds\/\d+\/widget\.(json|png)/ /\/guilds\/\d+\/widget\.(json|png)/
]; ];

View File

@ -3,14 +3,16 @@ import { route } from "@fosscord/api";
import { Config } from "@fosscord/util"; import { Config } from "@fosscord/util";
import { config } from "dotenv" import { config } from "dotenv"
const router = Router(); const router = Router();
const { cdn } = Config.get();
const IdentityForm = {
cdn: cdn.endpointPublic || process.env.CDN || "http://localhost:3001",
}
router.get("/",route({}), async (req: Request, res: Response) => { router.get("/",route({}), async (req: Request, res: Response) => {
res.json(IdentityForm) const { cdn, gateway } = Config.get();
const IdentityForm = {
cdn: cdn.endpointPublic || process.env.CDN || "http://localhost:3001",
gateway: gateway.endpointPublic || process.env.GATEWAY || "ws://localhost:3002"
};
res.json(IdentityForm);
}); });
export default router; export default router;

View File

@ -1,12 +1,12 @@
import { Router, Request, Response } from "express"; import { Router, Request, Response } from "express";
import { route } from "@fosscord/api"; import { route } from "@fosscord/api";
import { Config } from "@fosscord/util"; import { Config } from "@fosscord/util";
const router = Router(); const router = Router();
const { general } = Config.get();
router.get("/",route({}), async (req: Request, res: Response) => { router.get("/",route({}), async (req: Request, res: Response) => {
res.json(general) const { general } = Config.get();
res.json(general);
}); });
export default router; export default router;

View File

@ -2,10 +2,10 @@ import { Router, Request, Response } from "express";
import { route } from "@fosscord/api"; import { route } from "@fosscord/api";
import { Config } from "@fosscord/util"; import { Config } from "@fosscord/util";
const router = Router(); const router = Router();
const { limits } = Config.get();
router.get("/",route({}), async (req: Request, res: Response) => { router.get("/",route({}), async (req: Request, res: Response) => {
res.json(limits) const { limits } = Config.get();
res.json(limits);
}); });
export default router; export default router;

View File

@ -52,6 +52,7 @@ export interface ConfigValue {
instanceName: string; instanceName: string;
instanceDescription: string | null; instanceDescription: string | null;
frontPage: string | null; frontPage: string | null;
tosPage: string | null;
image: string | null; image: string | null;
instanceId: string; instanceId: string;
}; };
@ -187,6 +188,7 @@ export const DefaultConfigOptions: ConfigValue = {
instanceName: "Fosscord Instance", instanceName: "Fosscord Instance",
instanceDescription: "This is a Fosscord instance made in pre-relase days", instanceDescription: "This is a Fosscord instance made in pre-relase days",
frontPage: null, frontPage: null,
tosPage: null,
image: null, image: null,
instanceId: Snowflake.generate(), instanceId: Snowflake.generate(),
}, },