mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 03:10:24 +08:00
[fix] Fix import config bug and improve tolerance
Former-commit-id: 8a8c1a349a
This commit is contained in:
parent
bfe0dc9089
commit
929f086956
@ -25,14 +25,15 @@ namespace Qv2ray
|
||||
auto vmessConf = JsonFromString(Base64Decode(vmessJsonB64.toString()));
|
||||
string ps, add, id, net, type, host, path, tls;
|
||||
int port, aid;
|
||||
ps = vmessConf["ps"].toVariant().toString().toStdString();
|
||||
ps = vmessConf.contains("ps") ? vmessConf["ps"].toVariant().toString().toStdString()
|
||||
: (vmessConf["add"].toVariant().toString().toStdString() + ":" + vmessConf["port"].toVariant().toString().toStdString());
|
||||
add = vmessConf["add"].toVariant().toString().toStdString();
|
||||
id = vmessConf["id"].toVariant().toString().toStdString();
|
||||
net = vmessConf["net"].toVariant().toString().toStdString();
|
||||
type = vmessConf["type"].toVariant().toString().toStdString();
|
||||
net = vmessConf.contains("net") ? vmessConf["net"].toVariant().toString().toStdString() : "tcp";
|
||||
type = vmessConf.contains("type") ? vmessConf["type"].toVariant().toString().toStdString() : "none";
|
||||
host = vmessConf["host"].toVariant().toString().toStdString();
|
||||
path = vmessConf["path"].toVariant().toString().toStdString();
|
||||
tls = vmessConf["tls"].toVariant().toString().toStdString();
|
||||
tls = vmessConf.contains("tls") ? vmessConf["tls"].toVariant().toString().toStdString() : "";
|
||||
//
|
||||
port = vmessConf["port"].toVariant().toInt();
|
||||
aid = vmessConf["aid"].toVariant().toInt();
|
||||
|
@ -25,21 +25,14 @@ namespace Qv2ray
|
||||
flag = flag && C("port");
|
||||
flag = flag && C("add");
|
||||
// Stream Settings
|
||||
auto net = vmessConf["net"].toString();
|
||||
auto net = C("net") ? vmessConf["net"].toString() : "tcp";
|
||||
|
||||
if (net == "tcp")
|
||||
flag = flag && C("type");
|
||||
else if (net == "http" || net == "ws")
|
||||
if (net == "http" || net == "ws")
|
||||
flag = flag && C("host") && C("path");
|
||||
else if (net == "kcp")
|
||||
flag = flag && C("type");
|
||||
else if (net == "domainsocket")
|
||||
flag = flag && C("path");
|
||||
else if (net == "quic")
|
||||
flag = flag && C("host") && C("type") && C("path");
|
||||
|
||||
flag = flag && C("tls");
|
||||
flag = flag && C("net");
|
||||
#undef C
|
||||
return flag ? 0 : 1;
|
||||
} catch (exception *e) {
|
||||
|
@ -90,7 +90,7 @@ void ImportConfigWindow::on_buttonBox_accepted()
|
||||
return;
|
||||
|
||||
default:
|
||||
QvMessageBox(this, tr("VMess String Check"), tr("Some internal error occured."));
|
||||
QvMessageBox(this, tr("VMess String Check"), tr("VMess config is not valid."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/ui/w_ImportConfig.cpp" line="93"/>
|
||||
<source>Some internal error occured.</source>
|
||||
<source>VMess config is not valid.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@ -326,13 +326,13 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/ui/w_ImportConfig.cpp" line="69"/>
|
||||
<source>VMess string is not valid</source>
|
||||
<source>VMess string is not valid.</source>
|
||||
<translation>Ошибка строки VMess</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/ui/w_ImportConfig.cpp" line="74"/>
|
||||
<source>Some internal error occured</source>
|
||||
<translation>Произошла внутренняя ошибка</translation>
|
||||
<source>VMess config is not valid.</source>
|
||||
<translation>Конфигурация VMess недействительна.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -325,13 +325,13 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/ui/w_ImportConfig.cpp" line="69"/>
|
||||
<source>VMess string is not valid</source>
|
||||
<source>VMess string is not valid.</source>
|
||||
<translation>VMess 字符串无效</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/ui/w_ImportConfig.cpp" line="74"/>
|
||||
<source>Some internal error occured</source>
|
||||
<translation>发生了某些内部错误</translation>
|
||||
<source>VMess config is not valid.</source>
|
||||
<translation>VMess 配置无效</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
Loading…
Reference in New Issue
Block a user