diff --git a/main/NekoRay.cpp b/main/NekoRay.cpp
index b45d929..22980f9 100644
--- a/main/NekoRay.cpp
+++ b/main/NekoRay.cpp
@@ -59,6 +59,7 @@ namespace NekoRay {
_add(new configItem("vpn_bypass_cidr", &vpn_bypass_cidr, itemType::string));
_add(new configItem("check_include_pre", &check_include_pre, itemType::boolean));
_add(new configItem("sp_format", &system_proxy_format, itemType::string));
+ _add(new configItem("sub_clear", &sub_clear, itemType::boolean));
}
void DataStore::UpdateStartedId(int id) {
diff --git a/main/NekoRay_DataStore.hpp b/main/NekoRay_DataStore.hpp
index f6d8e4b..8367be7 100644
--- a/main/NekoRay_DataStore.hpp
+++ b/main/NekoRay_DataStore.hpp
@@ -59,8 +59,6 @@ namespace NekoRay {
// Misc
QString log_level = "warning";
- QString user_agent = "Nekoray/1.0 (Prefer Clash Format)";
- bool sub_use_proxy = false;
QString test_url = "http://cp.cloudflare.com/";
int test_concurrent = 5;
int traffic_loop_interval = 500;
@@ -74,6 +72,11 @@ namespace NekoRay {
bool check_include_pre = false;
QString system_proxy_format = "";
+ // Subscription
+ QString user_agent = "Nekoray/1.0 (Prefer Clash Format)";
+ bool sub_use_proxy = false;
+ bool sub_clear = false;
+
// Security
bool insecure_hint = true;
bool skip_cert = false;
diff --git a/sub/GroupUpdater.cpp b/sub/GroupUpdater.cpp
index 6b9c054..f5809be 100644
--- a/sub/GroupUpdater.cpp
+++ b/sub/GroupUpdater.cpp
@@ -357,6 +357,14 @@ namespace NekoRay::sub {
group->info = sub_user_info;
group->order.clear();
group->Save();
+ //
+ if (dataStore->sub_clear) {
+ showLog(QObject::tr("Clearing servers..."));
+ for (const auto &profile: in) {
+ profileManager->DeleteProfile(profile->id);
+ }
+ in = {};
+ }
}
// 解析并添加 profile
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index a7c8868..03020be 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -199,6 +199,10 @@
Advanced system proxy settings. Please select a format.
高级系统代理设置。请选择一种格式。
+
+ Clear servers before updating subscription
+ 更新订阅前清除服务器
+
DialogEditGroup
@@ -1360,6 +1364,10 @@ As of January 1, 2022, compatibility with MD5 authentication information will be
Select
选择
+
+ Clearing servers...
+ 正在清理服务器...
+
Qv2ray::ui::widgets::AutoCompleteTextEdit
diff --git a/ui/dialog_basic_settings.cpp b/ui/dialog_basic_settings.cpp
index 47de744..8ae7b49 100644
--- a/ui/dialog_basic_settings.cpp
+++ b/ui/dialog_basic_settings.cpp
@@ -145,6 +145,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
ui->user_agent->setText(NekoRay::dataStore->user_agent);
D_LOAD_BOOL(sub_use_proxy)
+ D_LOAD_BOOL(sub_clear)
// Core
@@ -268,6 +269,7 @@ void DialogBasicSettings::accept() {
NekoRay::dataStore->user_agent = ui->user_agent->text();
D_SAVE_BOOL(sub_use_proxy)
+ D_SAVE_BOOL(sub_clear)
// Core
diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui
index 1e0cc60..ce92c62 100644
--- a/ui/dialog_basic_settings.ui
+++ b/ui/dialog_basic_settings.ui
@@ -421,6 +421,13 @@
Subscription
+ -
+
+
+ Use proxy when updating subscription
+
+
+
-
@@ -431,10 +438,10 @@
- -
-
+
-
+
- Use proxy when updating subscription
+ Clear servers before updating subscription