mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 13:42:51 +08:00
fix: Fix mac os proxy setting
This commit is contained in:
parent
a8fe5ed248
commit
d1c9c5b4c3
16
3rdparty/qv2ray/v2/proxy/QvProxyConfigurator.cpp
vendored
16
3rdparty/qv2ray/v2/proxy/QvProxyConfigurator.cpp
vendored
@ -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<ProcessArgument> actions;
|
||||
actions << ProcessArgument{"gsettings", {"set", "org.gnome.system.proxy", "mode", "manual"}};
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user