feat: 完善登录鉴权和超级管理员重置

This commit is contained in:
湛兮
2026-06-12 10:20:10 +08:00
parent 125042f927
commit c8716b3a1a
15 changed files with 206 additions and 37 deletions
+21
View File
@@ -238,6 +238,7 @@ export class SettingsService {
configured,
missing,
...(definition.optional ? { optional: [...definition.optional] } : {}),
...this.booleanFlagGroups(definition),
...(definition.note ? { note: definition.note } : {}),
...(definition.variableHelp
? { variableHelp: this.pickVariableHelp(definition) }
@@ -270,6 +271,7 @@ export class SettingsService {
configured,
missing,
...(definition.optional ? { optional: [...definition.optional] } : {}),
...this.booleanFlagGroups(definition),
note:
provider && !providerWebhook
? `NOTIFICATION_PROVIDER=${provider} 暂不支持;可选 wecom、feishu、generic。`
@@ -312,6 +314,25 @@ export class SettingsService {
return !PLACEHOLDER_PATTERNS.some((pattern) => pattern.test(value));
}
private booleanFlagGroups(
definition: IntegrationDefinition,
): Pick<IntegrationConfigStatus, 'enabled' | 'disabled'> {
const booleanKeys = (definition.optional ?? []).filter(
(key) => typeof this.config.get(key, { infer: true }) === 'boolean',
);
const enabled = booleanKeys.filter(
(key) => this.config.get(key, { infer: true }) === true,
);
const disabled = booleanKeys.filter(
(key) => this.config.get(key, { infer: true }) === false,
);
return {
...(enabled.length > 0 ? { enabled } : {}),
...(disabled.length > 0 ? { disabled } : {}),
};
}
private resolveStatus(
configuredCount: number,
missingCount: number,
+2
View File
@@ -24,6 +24,8 @@ export type IntegrationConfigStatus = {
configured: string[];
missing: string[];
optional?: string[];
enabled?: string[];
disabled?: string[];
note?: string;
variableHelp?: Record<string, IntegrationVariableHelp>;
};