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 = {
|
const routeDef: RouteDef = {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
accepts: "*/*",
|
accepts: "*/*",
|
||||||
returns: "text/html",
|
returns: "application/json",
|
||||||
};
|
};
|
||||||
|
|
||||||
async function handler(): Promise<Response> {
|
async function handler(): Promise<Response> {
|
||||||
return new Response("Hello, World!", {
|
return Response.json(
|
||||||
headers: {
|
{
|
||||||
"content-type": "text/html",
|
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 };
|
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([
|
logger.info([
|
||||||
`[${request.method}]`,
|
`[${request.method}]`,
|
||||||
request.url,
|
request.url,
|
||||||
`${response.status}`,
|
`${response.status}`,
|
||||||
server.requestIP(request)?.address || "unknown",
|
`(${ip || "unknown"})`,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
Loading…
Add table
Reference in a new issue