feat: add configurable stealth download security policies

This commit is contained in:
2026-02-18 09:48:14 +08:00
parent 8956270a60
commit 96ff46aa4a
4 changed files with 735 additions and 1 deletions

View File

@@ -1705,6 +1705,40 @@ function initDefaultSettings() {
if (!SettingsDB.get('global_theme')) {
SettingsDB.set('global_theme', 'dark');
}
// 下载安全策略默认值同IP同文件限速5分钟3次、1小时10次、1天20次
if (!SettingsDB.get('download_security_enabled')) {
SettingsDB.set('download_security_enabled', 'true');
}
if (!SettingsDB.get('download_security_same_file_enabled')) {
SettingsDB.set('download_security_same_file_enabled', 'true');
}
if (!SettingsDB.get('download_security_same_file_limit_5m')) {
SettingsDB.set('download_security_same_file_limit_5m', '3');
}
if (!SettingsDB.get('download_security_same_file_limit_1h')) {
SettingsDB.set('download_security_same_file_limit_1h', '10');
}
if (!SettingsDB.get('download_security_same_file_limit_1d')) {
SettingsDB.set('download_security_same_file_limit_1d', '20');
}
// 扩展策略默认关闭(管理员可按需开启)
if (!SettingsDB.get('download_security_same_user_enabled')) {
SettingsDB.set('download_security_same_user_enabled', 'false');
}
if (!SettingsDB.get('download_security_same_user_limit_1h')) {
SettingsDB.set('download_security_same_user_limit_1h', '80');
}
if (!SettingsDB.get('download_security_same_user_limit_1d')) {
SettingsDB.set('download_security_same_user_limit_1d', '300');
}
if (!SettingsDB.get('download_security_same_file_min_interval_enabled')) {
SettingsDB.set('download_security_same_file_min_interval_enabled', 'false');
}
if (!SettingsDB.get('download_security_same_file_min_interval_seconds')) {
SettingsDB.set('download_security_same_file_min_interval_seconds', '2');
}
}
// 数据库迁移 - 主题偏好字段