add new windows proxy format

This commit is contained in:
Nova 2025-04-13 02:22:40 +03:30
parent f446c023d3
commit 64c5e5b7eb
4 changed files with 17 additions and 14 deletions

View File

@ -253,16 +253,14 @@ namespace Qv2ray::components::proxy {
#endif
#ifdef Q_OS_WIN
if (scheme == "http") scheme = "http://";
else if (scheme == "socks") scheme = "socks=";
QString str = "{scheme}{ip}:{socks_port}";
str = str.replace("{scheme}", scheme)
.replace("{ip}", address)
.replace("{socks_port}", Int2String(socksPort));
if (scheme == "http") scheme = "http://{ip}:{port}";
else if (scheme == "socks") scheme = "socks={ip}:{port}";
scheme = scheme.replace("{ip}", address)
.replace("{port}", Int2String(socksPort));
//
LOG("Windows proxy string: " + str);
auto proxyStrW = new WCHAR[str.length() + 1];
wcscpy(proxyStrW, str.toStdWString().c_str());
LOG("Windows proxy string: " + scheme);
auto proxyStrW = new WCHAR[scheme.length() + 1];
wcscpy(proxyStrW, scheme.toStdWString().c_str());
//
__QueryProxyOptions();

View File

@ -5,8 +5,8 @@
#include <QJsonDocument>
#include <QDebug>
#define LOG(...) Qv2ray::base::log_internal(__VA_ARGS__)
#define DEBUG(...) Qv2ray::base::log_internal(__VA_ARGS__)
#define LOG(...) qDebug() << __VA_ARGS__
#define DEBUG(...) qDebug() << __VA_ARGS__
namespace Qv2ray {
namespace base {
template<typename... T>

View File

@ -39,7 +39,7 @@ namespace NekoGui {
bool need_keep_vpn_off = false;
QString appdataDir = "";
QStringList ignoreConnTag = {};
QString proxy_scheme = "http";
QString proxy_scheme = "{ip}:{port}";
std::unique_ptr<Routing> routing;
int imported_count = 0;

View File

@ -111,12 +111,17 @@
<widget class="QComboBox" name="proxy_scheme">
<item>
<property name="text">
<string>http</string>
<string>{ip}:{port}</string>
</property>
</item>
<item>
<property name="text">
<string>socks</string>
<string>http://{ip}:{port}</string>
</property>
</item>
<item>
<property name="text">
<string>socks={ip}:{port}</string>
</property>
</item>
</widget>