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 #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
if (scheme == "http") scheme = "http://"; if (scheme == "http") scheme = "http://{ip}:{port}";
else if (scheme == "socks") scheme = "socks="; else if (scheme == "socks") scheme = "socks={ip}:{port}";
QString str = "{scheme}{ip}:{socks_port}"; scheme = scheme.replace("{ip}", address)
str = str.replace("{scheme}", scheme) .replace("{port}", Int2String(socksPort));
.replace("{ip}", address)
.replace("{socks_port}", Int2String(socksPort));
// //
LOG("Windows proxy string: " + str); LOG("Windows proxy string: " + scheme);
auto proxyStrW = new WCHAR[str.length() + 1]; auto proxyStrW = new WCHAR[scheme.length() + 1];
wcscpy(proxyStrW, str.toStdWString().c_str()); wcscpy(proxyStrW, scheme.toStdWString().c_str());
// //
__QueryProxyOptions(); __QueryProxyOptions();

View File

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

View File

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

View File

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