feat: 完善登录鉴权和超级管理员重置
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -24,6 +24,8 @@ export type IntegrationConfigStatus = {
|
||||
configured: string[];
|
||||
missing: string[];
|
||||
optional?: string[];
|
||||
enabled?: string[];
|
||||
disabled?: string[];
|
||||
note?: string;
|
||||
variableHelp?: Record<string, IntegrationVariableHelp>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user