mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 23:56:37 +08:00
chore(release): v3.1.1
### ⚡️ 优化与改进
- 将 cap_login_enabled 默认值由 true 变更为 false,默认关闭登录界面 PoW 人机验证。
This commit is contained in:
@@ -18,6 +18,12 @@ sidebar: false
|
|||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
|
|
||||||
|
## [v3.1.1] - 2026-07-06
|
||||||
|
|
||||||
|
### 修改
|
||||||
|
|
||||||
|
- 将 `cap_login_enabled` 默认值由 `true` 变更为 `false`,默认关闭登录界面 PoW 人机验证。
|
||||||
|
|
||||||
## [v3.1.0] - 2026-07-04
|
## [v3.1.0] - 2026-07-04
|
||||||
|
|
||||||
### 修改
|
### 修改
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ Server 的所有核心基础配置定义在 `config.yaml` 中,且均支持环
|
|||||||
### 2. 人机安全校验 (PoW Captcha)
|
### 2. 人机安全校验 (PoW Captcha)
|
||||||
| 配置键 (Key) | 数据类型 | 作用说明 | 默认值 |
|
| 配置键 (Key) | 数据类型 | 作用说明 | 默认值 |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| `cap_login_enabled` | `bool` | 是否在登录界面强制要求进行本地 PoW 算力防爆破人机验证 | `true` |
|
| `cap_login_enabled` | `bool` | 是否在登录界面强制要求进行本地 PoW 算力防爆破人机验证 | `false` |
|
||||||
| `cap_auto_solve` | `bool` | 打开页面后是否由浏览器自动开始后台背景计算算力(无需用户手动点击)| `true` |
|
| `cap_auto_solve` | `bool` | 打开页面后是否由浏览器自动开始后台背景计算算力(无需用户手动点击)| `true` |
|
||||||
| `cap_challenge_count` | `int` | 人机验证所需的计算难题数。数量越大,计算要求时间越长(推荐 1~5) | `1` |
|
| `cap_challenge_count` | `int` | 人机验证所需的计算难题数。数量越大,计算要求时间越长(推荐 1~5) | `1` |
|
||||||
| `cap_challenge_difficulty`| `int`| 每次计算所需的 PoW 哈希前缀匹配难度。推荐数值在 3-5 之间 | `4` |
|
| `cap_challenge_difficulty`| `int`| 每次计算所需的 PoW 哈希前缀匹配难度。推荐数值在 3-5 之间 | `4` |
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export function LoginForm({ onOTPStateChange }: { onOTPStateChange?: (show: bool
|
|||||||
queryFn: () => AuthService.getAuthSources(),
|
queryFn: () => AuthService.getAuthSources(),
|
||||||
})
|
})
|
||||||
|
|
||||||
const capEnabled = configBool(publicConfigQuery.data?.cap_login_enabled, true)
|
const capEnabled = configBool(publicConfigQuery.data?.cap_login_enabled, false)
|
||||||
const capAutoSolve = configBool(publicConfigQuery.data?.cap_auto_solve, true)
|
const capAutoSolve = configBool(publicConfigQuery.data?.cap_auto_solve, true)
|
||||||
|
|
||||||
const loginMutation = useMutation({
|
const loginMutation = useMutation({
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export function RegisterForm() {
|
|||||||
|
|
||||||
const emailRegisterEnabled = configBool(publicConfigQuery.data?.email_register_verification_enabled, false)
|
const emailRegisterEnabled = configBool(publicConfigQuery.data?.email_register_verification_enabled, false)
|
||||||
|
|
||||||
const capEnabled = configBool(publicConfigQuery.data?.cap_login_enabled, true)
|
const capEnabled = configBool(publicConfigQuery.data?.cap_login_enabled, false)
|
||||||
const capAutoSolve = configBool(publicConfigQuery.data?.cap_auto_solve, true)
|
const capAutoSolve = configBool(publicConfigQuery.data?.cap_auto_solve, true)
|
||||||
|
|
||||||
const [capScope, setCapScope] = useState<'send_email_code' | 'register'>('send_email_code')
|
const [capScope, setCapScope] = useState<'send_email_code' | 'register'>('send_email_code')
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ export const apiSections: PolicySection[] = [
|
|||||||
"registration_enabled": "false",
|
"registration_enabled": "false",
|
||||||
"password_login_enabled": "true",
|
"password_login_enabled": "true",
|
||||||
"password_register_enabled": "false",
|
"password_register_enabled": "false",
|
||||||
"cap_login_enabled": "true",
|
"cap_login_enabled": "false",
|
||||||
"oidc_login_enabled": "true"
|
"oidc_login_enabled": "true"
|
||||||
}
|
}
|
||||||
}`}
|
}`}
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ func TestProtectionEnabledReflectsLoginSwitch(t *testing.T) {
|
|||||||
|
|
||||||
ResetRuntimeSettingsForTest()
|
ResetRuntimeSettingsForTest()
|
||||||
|
|
||||||
if !ProtectionEnabled(ctx) {
|
if ProtectionEnabled(ctx) {
|
||||||
t.Fatal("ProtectionEnabled() = false, want true from seed defaults")
|
t.Fatal("ProtectionEnabled() = true, want false from seed defaults")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := db.DB(ctx).Model(&model.SystemConfig{}).
|
if err := db.DB(ctx).Model(&model.SystemConfig{}).
|
||||||
Where("key = ?", model.ConfigKeyCapLoginEnabled).
|
Where("key = ?", model.ConfigKeyCapLoginEnabled).
|
||||||
Update("value", "false").Error; err != nil {
|
Update("value", "true").Error; err != nil {
|
||||||
t.Fatalf("Update(cap_login_enabled) error = %v", err)
|
t.Fatalf("Update(cap_login_enabled) error = %v", err)
|
||||||
}
|
}
|
||||||
if err := repository.InvalidateSystemConfigCache(ctx, model.ConfigKeyCapLoginEnabled); err != nil {
|
if err := repository.InvalidateSystemConfigCache(ctx, model.ConfigKeyCapLoginEnabled); err != nil {
|
||||||
@@ -70,8 +70,8 @@ func TestProtectionEnabledReflectsLoginSwitch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
InvalidateRuntimeSettings()
|
InvalidateRuntimeSettings()
|
||||||
|
|
||||||
if ProtectionEnabled(ctx) {
|
if !ProtectionEnabled(ctx) {
|
||||||
t.Fatal("ProtectionEnabled() = true, want false after config update")
|
t.Fatal("ProtectionEnabled() = false, want true after config update")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ CREATE INDEX IF NOT EXISTS idx_templates_created_at ON templates (created_at);
|
|||||||
CREATE INDEX IF NOT EXISTS idx_templates_updated_at ON templates (updated_at);
|
CREATE INDEX IF NOT EXISTS idx_templates_updated_at ON templates (updated_at);
|
||||||
|
|
||||||
INSERT INTO system_configs (key, value, type, visibility, description, created_at, updated_at) VALUES
|
INSERT INTO system_configs (key, value, type, visibility, description, created_at, updated_at) VALUES
|
||||||
('cap_login_enabled', 'true', 'system', 1, '是否启用登录人机验证(true/false)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_login_enabled', 'false', 'system', 1, '是否启用登录人机验证(true/false)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
('cap_auto_solve', 'true', 'system', 1, '打开页面后是否自动开始计算,关闭则需用户手动点击触发', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_auto_solve', 'true', 'system', 1, '打开页面后是否自动开始计算,关闭则需用户手动点击触发', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
('cap_challenge_count', '1', 'system', 0, '客户端需求解的 PoW 难题总数,默认 1,推荐 1~5', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_challenge_count', '1', 'system', 0, '客户端需求解的 PoW 难题总数,默认 1,推荐 1~5', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
('cap_challenge_size', '32', 'system', 0, '人机验证盐值长度', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_challenge_size', '32', 'system', 0, '人机验证盐值长度', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ UPDATE w_system_configs
|
|||||||
SET value = 'false', updated_at = CURRENT_TIMESTAMP
|
SET value = 'false', updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE key = 'password_register_enabled' AND value = 'true';
|
WHERE key = 'password_register_enabled' AND value = 'true';
|
||||||
|
|
||||||
UPDATE w_system_configs
|
|
||||||
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE key = 'cap_login_enabled' AND value = 'false';
|
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
UPDATE w_system_configs
|
UPDATE w_system_configs
|
||||||
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
||||||
@@ -19,7 +15,3 @@ WHERE key = 'registration_enabled' AND value = 'false';
|
|||||||
UPDATE w_system_configs
|
UPDATE w_system_configs
|
||||||
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE key = 'password_register_enabled' AND value = 'false';
|
WHERE key = 'password_register_enabled' AND value = 'false';
|
||||||
|
|
||||||
UPDATE w_system_configs
|
|
||||||
SET value = 'false', updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE key = 'cap_login_enabled' AND value = 'true';
|
|
||||||
@@ -137,7 +137,7 @@ CREATE INDEX IF NOT EXISTS idx_templates_created_at ON templates (created_at);
|
|||||||
CREATE INDEX IF NOT EXISTS idx_templates_updated_at ON templates (updated_at);
|
CREATE INDEX IF NOT EXISTS idx_templates_updated_at ON templates (updated_at);
|
||||||
|
|
||||||
INSERT INTO system_configs (key, value, type, visibility, description, created_at, updated_at) VALUES
|
INSERT INTO system_configs (key, value, type, visibility, description, created_at, updated_at) VALUES
|
||||||
('cap_login_enabled', 'true', 'system', 1, '是否启用登录人机验证(true/false)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_login_enabled', 'false', 'system', 1, '是否启用登录人机验证(true/false)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
('cap_auto_solve', 'true', 'system', 1, '打开页面后是否自动开始计算,关闭则需用户手动点击触发', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_auto_solve', 'true', 'system', 1, '打开页面后是否自动开始计算,关闭则需用户手动点击触发', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
('cap_challenge_count', '1', 'system', 0, '客户端需求解的 PoW 难题总数,默认 1,推荐 1~5', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_challenge_count', '1', 'system', 0, '客户端需求解的 PoW 难题总数,默认 1,推荐 1~5', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
('cap_challenge_size', '32', 'system', 0, '人机验证盐值长度', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
('cap_challenge_size', '32', 'system', 0, '人机验证盐值长度', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ UPDATE w_system_configs
|
|||||||
SET value = 'false', updated_at = CURRENT_TIMESTAMP
|
SET value = 'false', updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE key = 'password_register_enabled' AND value = 'true';
|
WHERE key = 'password_register_enabled' AND value = 'true';
|
||||||
|
|
||||||
UPDATE w_system_configs
|
|
||||||
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE key = 'cap_login_enabled' AND value = 'false';
|
|
||||||
|
|
||||||
-- +goose Down
|
-- +goose Down
|
||||||
UPDATE w_system_configs
|
UPDATE w_system_configs
|
||||||
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
||||||
@@ -19,7 +15,3 @@ WHERE key = 'registration_enabled' AND value = 'false';
|
|||||||
UPDATE w_system_configs
|
UPDATE w_system_configs
|
||||||
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
SET value = 'true', updated_at = CURRENT_TIMESTAMP
|
||||||
WHERE key = 'password_register_enabled' AND value = 'false';
|
WHERE key = 'password_register_enabled' AND value = 'false';
|
||||||
|
|
||||||
UPDATE w_system_configs
|
|
||||||
SET value = 'false', updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE key = 'cap_login_enabled' AND value = 'true';
|
|
||||||
@@ -142,7 +142,7 @@ func getSeedConfigsPart1() []model.SystemConfig {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: model.ConfigKeyCapLoginEnabled,
|
Key: model.ConfigKeyCapLoginEnabled,
|
||||||
Value: configValueTrue,
|
Value: configValueFalse,
|
||||||
Type: configTypeSystem,
|
Type: configTypeSystem,
|
||||||
Description: "是否启用登录人机验证(true/false)",
|
Description: "是否启用登录人机验证(true/false)",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user