Add instance route

This commit is contained in:
uurgothat 2021-11-17 22:28:22 +03:00
parent 7d7a533984
commit 54ebf97e78
5 changed files with 46 additions and 0 deletions

View File

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

View File

@ -0,0 +1,16 @@
import { Router, Request, Response } from "express";
import { route } from "@fosscord/api";
import { Config } from "@fosscord/util";
import { config } from "dotenv"
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) => {
res.json(IdentityForm)
});
export default router;

View File

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

View File

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

View File

@ -49,6 +49,9 @@ export interface ConfigValue {
endpointPrivate: string | null; endpointPrivate: string | null;
}; };
general: { general: {
instanceName: string;
instanceDescription: string | null;
frontPage: string | null;
instanceId: string; instanceId: string;
}; };
limits: { limits: {
@ -180,7 +183,10 @@ export const DefaultConfigOptions: ConfigValue = {
endpointPublic: null, endpointPublic: null,
}, },
general: { general: {
instanceName: "Fosscord Instance",
instanceDescription: "This is a Fosscord instance made in pre-relase days",
instanceId: Snowflake.generate(), instanceId: Snowflake.generate(),
frontPage: null
}, },
limits: { limits: {
user: { user: {