mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
feat: Clear servers before updating subscription
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -199,6 +199,10 @@
|
||||
<source>Advanced system proxy settings. Please select a format.</source>
|
||||
<translation>高级系统代理设置。请选择一种格式。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clear servers before updating subscription</source>
|
||||
<translation>更新订阅前清除服务器</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DialogEditGroup</name>
|
||||
@@ -1360,6 +1364,10 @@ As of January 1, 2022, compatibility with MD5 authentication information will be
|
||||
<source>Select</source>
|
||||
<translation>选择</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Clearing servers...</source>
|
||||
<translation>正在清理服务器...</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Qv2ray::ui::widgets::AutoCompleteTextEdit</name>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -421,6 +421,13 @@
|
||||
<string>Subscription</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="sub_use_proxy">
|
||||
<property name="text">
|
||||
<string>Use proxy when updating subscription</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="MyLineEdit" name="user_agent"/>
|
||||
</item>
|
||||
@@ -431,10 +438,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="sub_use_proxy">
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="sub_clear">
|
||||
<property name="text">
|
||||
<string>Use proxy when updating subscription</string>
|
||||
<string>Clear servers before updating subscription</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user