This commit is contained in:
2023-05-26 17:01:13 +08:00
parent ee9c54af61
commit b257cd9fb9
10 changed files with 125 additions and 20 deletions

13
routes/api/config.ts Normal file
View File

@@ -0,0 +1,13 @@
import { Handlers } from "$fresh/server.ts";
import { load_settings } from "../../config.ts";
import { get_cfg_path } from "../../server.ts";
export const handler: Handlers = {
async GET(_req, _ctx) {
const path = get_cfg_path();
const cfg = await load_settings(path);
return new Response(JSON.stringify(cfg.to_json()), {
headers: { "Content-Type": "application/json" },
});
},
};