diff --git a/3rdparty/qv2ray/v2/proxy/QvProxyConfigurator.cpp b/3rdparty/qv2ray/v2/proxy/QvProxyConfigurator.cpp index a5e32d5..4b37f05 100644 --- a/3rdparty/qv2ray/v2/proxy/QvProxyConfigurator.cpp +++ b/3rdparty/qv2ray/v2/proxy/QvProxyConfigurator.cpp @@ -253,7 +253,21 @@ namespace Qv2ray::components::proxy { #endif #ifdef Q_OS_WIN - // we don't use this for windows + QString str = "socks={ip}:{socks_port}"; + str = str.replace("{ip}", address) + .replace("{socks_port}", Int2String(socksPort)); + // + LOG("Windows proxy string: " + str); + auto proxyStrW = new WCHAR[str.length() + 1]; + wcscpy(proxyStrW, str.toStdWString().c_str()); + // + __QueryProxyOptions(); + + if (!__SetProxyOptions(proxyStrW, false)) { + LOG("Failed to set proxy."); + } + + __QueryProxyOptions(); #elif defined(Q_OS_LINUX) QList actions; actions << ProcessArgument{"gsettings", {"set", "org.gnome.system.proxy", "mode", "manual"}}; diff --git a/ui/mainwindow_grpc.cpp b/ui/mainwindow_grpc.cpp index e97d2a0..fd0ff8e 100644 --- a/ui/mainwindow_grpc.cpp +++ b/ui/mainwindow_grpc.cpp @@ -391,23 +391,12 @@ void MainWindow::neko_start(int _id) { void MainWindow::neko_set_spmode_system_proxy(bool enable, bool save) { if (enable != NekoGui::dataStore->spmode_system_proxy) { -#ifndef Q_OS_LINUX - bool ok; - auto error = defaultClient->SetSystemProxy(&ok, enable); - if (!ok) { - MW_show_log("Failed to set system proxy with error " + error); - ui->checkBox_SystemProxy->setChecked(false); - refresh_status(); - return; - } -#else if (enable) { auto socks_port = NekoGui::dataStore->inbound_socks_port; SetSystemProxy(socks_port, socks_port); } else { ClearSystemProxy(); } -#endif } if (save) {