From 636a23a78aa1bc193d7ba4bcd91e72f5acd38096 Mon Sep 17 00:00:00 2001 From: smail Date: Mon, 7 Sep 2026 00:29:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=9F=BA=E7=A1=80=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=AD=E5=A4=9A=E4=BD=99=E7=9A=84=E9=80=9A=E8=A1=8C?= =?UTF-8?q?=E5=AF=86=E9=92=A5=E7=AB=99=E7=82=B9=E5=AD=97=E6=AE=B5=E5=B9=B6?= =?UTF-8?q?=E8=A1=A5=E9=BD=90=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConfigSettings/ConfigForm/ConfigForm.js | 11 ----------- test/frontend/config-form.test.mjs | 13 ++++++------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/frontend/src/views/components/ConfigSettings/ConfigForm/ConfigForm.js b/frontend/src/views/components/ConfigSettings/ConfigForm/ConfigForm.js index b5cb87a..c553d48 100644 --- a/frontend/src/views/components/ConfigSettings/ConfigForm/ConfigForm.js +++ b/frontend/src/views/components/ConfigSettings/ConfigForm/ConfigForm.js @@ -105,17 +105,6 @@ const baseGroups = [ show: config => config.http?.tlsMode !== 'proxy' && !!config.http?.httpsEnabled, hint: '默认使用 443;需要避开端口占用时可手动修改。' }) - ]), - group('security', '通行密钥站点信息', '外部邮箱与通行密钥服务默认可用,由用户在安全设置中自行选择。留空时使用当前站点的安全默认值;密码算法和加密密钥由系统维护。', [ - field('security.webAuthnRpId', '通行密钥站点域名', 'text', { - placeholder: '默认使用网页访问域名', - hint: '已绑定通行密钥后不要随意更换域名,否则原密钥可能无法使用。' - }), - field('security.webAuthnRpDisplayName', '通行密钥显示名称', 'text', { placeholder: 'Smail' }), - field('security.webAuthnRpOrigins', '通行密钥允许的来源', 'list', { - placeholder: 'https://mail.example.com', - hint: '每项填写不含路径的完整 HTTPS 来源;反代使用非标准外部端口时,请显式填写端口。' - }) ]) ] diff --git a/test/frontend/config-form.test.mjs b/test/frontend/config-form.test.mjs index 2d24f3f..3a12df7 100644 --- a/test/frontend/config-form.test.mjs +++ b/test/frontend/config-form.test.mjs @@ -10,17 +10,16 @@ const { readFormConfig, getFieldGroups, updateFormConfig, validateFormConfig } = source.replaceAll('export function ', 'function ') + '\nreturn { readFormConfig, getFieldGroups, updateFormConfig, validateFormConfig }' )() -test('站点安全配置不再依赖旧全局开关,用户权限仍由账号设置管理', () => { - const config = { security: { webAuthnEnabled: false, externalEmailEnabled: false } } +test('基础配置不再展示冗余安全选项与开关,通行密钥由系统默认解析,用户权限仍由账号设置管理', () => { + const config = { domains: { web: 'mail.old.com' }, security: { webAuthnEnabled: false, externalEmailEnabled: false, webAuthnRpId: 'mail.old.com' } } const groups = getFieldGroups('base', config) const security = groups.find(group => group.id === 'security') - assert.ok(security) - const keys = security.fields.map(field => field.path.join('.')) - assert.deepEqual(keys, ['security.webAuthnRpId', 'security.webAuthnRpDisplayName', 'security.webAuthnRpOrigins']) - const updated = readFormConfig(updateFormConfig(JSON.stringify(config), 'base', ['security', 'webAuthnRpId'], 'mail.example.com')) - assert.equal(updated.security.webAuthnRpId, 'mail.example.com') + assert.equal(security, undefined) + const updated = readFormConfig(updateFormConfig(JSON.stringify(config), 'base', ['domains', 'web'], 'mail.example.com')) + assert.equal(updated.domains.web, 'mail.example.com') assert.equal(updated.security.webAuthnEnabled, false) assert.equal(updated.security.externalEmailEnabled, false) + assert.equal(updated.security.webAuthnRpId, 'mail.old.com') }) test('七个页面使用分组表单,控件和样式能编译且不再提供 JSON 编辑器', () => {