mirror of
https://github.com/imputnet/cobalt.git
synced 2025-06-28 17:38:31 +00:00
api/core: update server info
- cache server info as string - serve a list of services & duration limit in server info
This commit is contained in:
parent
7a557a97c3
commit
70264f3691
@ -42,13 +42,16 @@ export const runAPI = (express, app, __dirname) => {
|
|||||||
const startTime = new Date();
|
const startTime = new Date();
|
||||||
const startTimestamp = startTime.getTime();
|
const startTimestamp = startTime.getTime();
|
||||||
|
|
||||||
const serverInfo = {
|
const serverInfo = JSON.stringify({
|
||||||
version: version,
|
cobalt: {
|
||||||
|
version: version,
|
||||||
|
url: env.apiURL,
|
||||||
|
startTime: `${startTimestamp}`,
|
||||||
|
durationLimit: env.durationLimit,
|
||||||
|
services: [...env.enabledServices],
|
||||||
|
},
|
||||||
git,
|
git,
|
||||||
cors: env.corsWildcard,
|
})
|
||||||
url: env.apiURL,
|
|
||||||
startTime: `${startTimestamp}`,
|
|
||||||
}
|
|
||||||
|
|
||||||
const apiLimiter = rateLimit({
|
const apiLimiter = rateLimit({
|
||||||
windowMs: env.rateLimitWindow * 1000,
|
windowMs: env.rateLimitWindow * 1000,
|
||||||
@ -267,7 +270,8 @@ export const runAPI = (express, app, __dirname) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
app.get('/', (_, res) => {
|
app.get('/', (_, res) => {
|
||||||
return res.status(200).json(serverInfo);
|
res.type('json');
|
||||||
|
res.status(200).send(serverInfo);
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/favicon.ico', (req, res) => {
|
app.get('/favicon.ico', (req, res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user