mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
feat: require restart after profile change
This commit is contained in:
@@ -381,6 +381,11 @@ namespace NekoRay {
|
||||
tagOut = "proxy";
|
||||
}
|
||||
|
||||
// ignoreConnTag
|
||||
if (index != 0) {
|
||||
status->result->ignoreConnTag << tagOut;
|
||||
}
|
||||
|
||||
if (needGlobal) {
|
||||
if (status->globalProfiles.contains(ent->id)) {
|
||||
continue;
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace NekoRay {
|
||||
|
||||
QList<QSharedPointer<traffic::TrafficData>> outboundStats; // all, but not including "bypass" "block"
|
||||
QSharedPointer<traffic::TrafficData> outboundStat; // main
|
||||
QStringList ignoreConnTag;
|
||||
|
||||
QList<sys::ExternalProcess *> ext;
|
||||
};
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace NekoRay {
|
||||
bool core_prepare_exit = false;
|
||||
int running_spmode = NekoRay::SystemProxyMode::DISABLE;
|
||||
bool need_keep_vpn_off = false;
|
||||
QStringList ignoreConnTag = {};
|
||||
|
||||
Routing *routing = new Routing;
|
||||
int imported_count = 0;
|
||||
|
||||
@@ -334,16 +334,20 @@ void DialogEditProfile::accept() {
|
||||
*((QString *) custom_item->ptr) = CACHE.custom;
|
||||
}
|
||||
|
||||
// finish
|
||||
QStringList msg = {"accept"};
|
||||
|
||||
if (newEnt) {
|
||||
auto ok = NekoRay::profileManager->AddProfile(ent);
|
||||
if (!ok) {
|
||||
MessageBoxWarning("???", "id exists");
|
||||
}
|
||||
} else {
|
||||
ent->Save();
|
||||
auto changed = ent->Save();
|
||||
if (changed && NekoRay::dataStore->started_id == ent->id) msg << "restart";
|
||||
}
|
||||
|
||||
MW_dialog_message(Dialog_DialogEditProfile, "accept");
|
||||
MW_dialog_message(Dialog_DialogEditProfile, msg.join(","));
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
|
||||
@@ -462,8 +462,14 @@ void MainWindow::dialog_message_impl(const QString &sender, const QString &info)
|
||||
}
|
||||
// sender
|
||||
if (sender == Dialog_DialogEditProfile) {
|
||||
if (info == "accept") {
|
||||
auto msg = info.split(",");
|
||||
if (msg.contains("accept")) {
|
||||
refresh_proxy_list();
|
||||
if (msg.contains("restart")) {
|
||||
if (QMessageBox::question(GetMessageBoxParent(), tr("Confirmation"), tr("Settings changed, restart proxy?")) == QMessageBox::StandardButton::Yes) {
|
||||
neko_start(NekoRay::dataStore->started_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (sender == Dialog_DialogManageGroups) {
|
||||
if (info.startsWith("refresh")) {
|
||||
@@ -1342,6 +1348,7 @@ void MainWindow::refresh_connection_list(const QJsonArray &arr) {
|
||||
int row = -1;
|
||||
for (const auto &_item: arr) {
|
||||
auto item = _item.toObject();
|
||||
if (NekoRay::dataStore->ignoreConnTag.contains(item["Tag"].toString())) continue;
|
||||
|
||||
row++;
|
||||
ui->tableWidget_conn->insertRow(row);
|
||||
|
||||
@@ -232,6 +232,7 @@ void MainWindow::neko_start(int _id) {
|
||||
//
|
||||
NekoRay::traffic::trafficLooper->proxy = result->outboundStat.get();
|
||||
NekoRay::traffic::trafficLooper->items = result->outboundStats;
|
||||
NekoRay::dataStore->ignoreConnTag = result->ignoreConnTag;
|
||||
NekoRay::traffic::trafficLooper->loop_enabled = true;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user