Improve local auth env handling and fallbacks
Allow local env files to reliably override authentication feature flags (SMS/WeChat) by whitelisting keys in scripts/dev-utils.mjs and adding a unit test. Add SMS checks to scripts/check-api-server-env.mjs. Make server config.parse_bool tolerant of shell-wrapped quoted values (e.g. '"true"') and add tests so SMS_AUTH_ENABLED is parsed correctly when shells supply quotes. Update docs to clarify SMS env behaviour, restart requirements, and add guidance + a CSS fallback for old mobile browsers (QQ/X5) so public cover images render even when aspect-ratio is unsupported. Also include related frontend test and component adjustments and add puzzle onboarding handlers/endpoints in server-rs/crates/api-server/src/puzzle.rs.
This commit is contained in:
@@ -68,6 +68,26 @@ describe('dev utils env merge', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('本地认证开关覆盖外层 shell 旧值', () => {
|
||||
withTempEnvFiles(
|
||||
{
|
||||
'.env.local': [
|
||||
'SMS_AUTH_ENABLED=true',
|
||||
'SMS_AUTH_PROVIDER=aliyun',
|
||||
].join('\n'),
|
||||
},
|
||||
(_env, tempDir) => {
|
||||
const env = mergeApiServerEnv(tempDir, {
|
||||
SMS_AUTH_ENABLED: 'false',
|
||||
SMS_AUTH_PROVIDER: 'mock',
|
||||
});
|
||||
|
||||
expect(env.SMS_AUTH_ENABLED).toBe('true');
|
||||
expect(env.SMS_AUTH_PROVIDER).toBe('aliyun');
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test('空外层 shell 变量不会遮蔽本地私密配置', () => {
|
||||
withTempEnvFiles(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user