This commit is contained in:
mtvpls
2026-06-29 22:41:36 +08:00
parent 418d57ae8a
commit c1716615e2
6 changed files with 145 additions and 7 deletions
+1
View File
@@ -32,6 +32,7 @@ function maskTelegramConfig(config: AdminConfig['TelegramConfig']) {
apiBaseUrl: config?.apiBaseUrl || '',
loginEnabled: config?.loginEnabled !== false,
bindingEnabled: config?.bindingEnabled !== false,
registrationEnabled: config?.registrationEnabled === true,
notificationsEnabled: config?.notificationsEnabled !== false,
defaultNotifications: config?.defaultNotifications !== false,
};
+3 -1
View File
@@ -8,12 +8,14 @@ export async function GET() {
const config = await getTelegramConfig();
const loginProblems = getTelegramConfigProblems(config, 'login');
const bindingProblems = getTelegramConfigProblems(config, 'binding');
const registrationProblems = getTelegramConfigProblems(config, 'registration');
return NextResponse.json({
enabled: config.enabled && Boolean(config.botToken),
botUsername: config.botUsername.replace(/^@/, ''),
loginEnabled: loginProblems.length === 0,
bindingEnabled: bindingProblems.length === 0,
registrationEnabled: registrationProblems.length === 0,
notificationsEnabled: config.notificationsEnabled,
problems: Array.from(new Set([...loginProblems, ...bindingProblems])),
problems: Array.from(new Set([...loginProblems, ...bindingProblems, ...registrationProblems])),
});
}