api/core: return public turnstile sitekey in server info
This commit is contained in:
parent
5e7324bca9
commit
0cc18b488c
2 changed files with 8 additions and 2 deletions
|
@ -34,10 +34,15 @@ const env = {
|
|||
|
||||
externalProxy: process.env.API_EXTERNAL_PROXY,
|
||||
|
||||
turnstileSitekey: process.env.TURNSTILE_SITEKEY,
|
||||
turnstileSecret: process.env.TURNSTILE_SECRET,
|
||||
jwtSecret: process.env.JWT_SECRET,
|
||||
jwtLifetime: process.env.JWT_EXPIRY || 120,
|
||||
|
||||
sessionEnabled: process.env.TURNSTILE_SITEKEY
|
||||
&& process.env.TURNSTILE_SECRET
|
||||
&& process.env.JWT_SECRET,
|
||||
|
||||
enabledServices,
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ export const runAPI = (express, app, __dirname) => {
|
|||
url: env.apiURL,
|
||||
startTime: `${startTimestamp}`,
|
||||
durationLimit: env.durationLimit,
|
||||
turnstileSitekey: env.sessionEnabled ? env.turnstileSitekey : undefined,
|
||||
services: [...env.enabledServices].map(e => {
|
||||
return friendlyServiceName(e);
|
||||
}),
|
||||
|
@ -106,7 +107,7 @@ export const runAPI = (express, app, __dirname) => {
|
|||
app.use('/tunnel', apiLimiterStream);
|
||||
|
||||
app.post('/', (req, res, next) => {
|
||||
if (!env.turnstileSecret || !env.jwtSecret) {
|
||||
if (!env.sessionEnabled) {
|
||||
return next();
|
||||
}
|
||||
|
||||
|
@ -156,7 +157,7 @@ export const runAPI = (express, app, __dirname) => {
|
|||
});
|
||||
|
||||
app.post("/session", async (req, res) => {
|
||||
if (!env.turnstileSecret || !env.jwtSecret) {
|
||||
if (!env.sessionEnabled) {
|
||||
return fail(res, "error.api.auth.not_configured")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue