move routes from nsfw to / edit default /
This commit is contained in:
parent
725eb7d762
commit
892c67f5c5
6 changed files with 27 additions and 6 deletions
|
@ -1,15 +1,25 @@
|
|||
const routeDef: RouteDef = {
|
||||
method: "GET",
|
||||
accepts: "*/*",
|
||||
returns: "text/html",
|
||||
returns: "application/json",
|
||||
};
|
||||
|
||||
async function handler(): Promise<Response> {
|
||||
return new Response("Hello, World!", {
|
||||
headers: {
|
||||
"content-type": "text/html",
|
||||
return Response.json(
|
||||
{
|
||||
success: true,
|
||||
code: 200,
|
||||
message:
|
||||
"Welcome to the booru API, check the documentation for more information",
|
||||
links: {
|
||||
forgejo: "https://forgejo.creations.works/creations/booru-api",
|
||||
GitHub: "https://github.com/Creationsss/booru-api",
|
||||
},
|
||||
});
|
||||
},
|
||||
{
|
||||
status: 200,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export { handler, routeDef };
|
||||
|
|
|
@ -149,11 +149,22 @@ class ServerHandler {
|
|||
);
|
||||
}
|
||||
|
||||
const headers: Headers = response.headers;
|
||||
let ip: string | null = server.requestIP(request)?.address || null;
|
||||
|
||||
if (!ip) {
|
||||
ip =
|
||||
headers.get("CF-Connecting-IP") ||
|
||||
headers.get("X-Real-IP") ||
|
||||
headers.get("X-Forwarded-For") ||
|
||||
null;
|
||||
}
|
||||
|
||||
logger.info([
|
||||
`[${request.method}]`,
|
||||
request.url,
|
||||
`${response.status}`,
|
||||
server.requestIP(request)?.address || "unknown",
|
||||
`(${ip || "unknown"})`,
|
||||
]);
|
||||
|
||||
return response;
|
||||
|
|
Loading…
Add table
Reference in a new issue