mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
bug fix
This commit is contained in:
@@ -19,7 +19,8 @@ namespace NekoRay {
|
||||
void ProfileManager::LoadManager() {
|
||||
for (auto id: _profiles) {
|
||||
auto ent = LoadProxyEntity(QString("profiles/%1.json").arg(id));
|
||||
if (ent->bean->version == -114514) { // clear invaild profile
|
||||
if (ent == nullptr || ent->bean == nullptr || ent->bean->version == -114514) {
|
||||
// clear invaild profile
|
||||
DeleteProfile(id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace NekoRay::fmt {
|
||||
|
||||
CoreObjOutboundBuildResult VMessBean::BuildCoreObjSingBox() {
|
||||
CoreObjOutboundBuildResult result;
|
||||
|
||||
QJsonObject outbound{
|
||||
{"type", "vmess"},
|
||||
{"server", serverAddress},
|
||||
@@ -105,6 +106,7 @@ namespace NekoRay::fmt {
|
||||
|
||||
CoreObjOutboundBuildResult TrojanVLESSBean::BuildCoreObjSingBox() {
|
||||
CoreObjOutboundBuildResult result;
|
||||
|
||||
QJsonObject outbound{
|
||||
{"type", proxy_type == proxy_VLESS ? "vless" : "trojan"},
|
||||
{"server", serverAddress},
|
||||
|
||||
@@ -51,10 +51,16 @@ namespace NekoRay::fmt {
|
||||
domain_address = WrapIPV6Host(domain_address);
|
||||
connect_address = WrapIPV6Host(connect_address);
|
||||
|
||||
auto proxy_url = QUrl();
|
||||
proxy_url.setScheme(protocol);
|
||||
proxy_url.setUserName(username);
|
||||
proxy_url.setPassword(password);
|
||||
proxy_url.setPort(connect_port);
|
||||
proxy_url.setHost(domain_address);
|
||||
|
||||
result.arguments += "--log";
|
||||
result.arguments += "--listen=socks://127.0.0.1:" + Int2String(socks_port);
|
||||
result.arguments += "--proxy=" + protocol + "://" + username + ":" + password + "@" +
|
||||
domain_address + ":" + Int2String(connect_port);
|
||||
result.arguments += "--proxy=" + proxy_url.toString(QUrl::FullyEncoded);
|
||||
if (domain_address != connect_address)
|
||||
result.arguments += "--host-resolver-rules=MAP " + domain_address + " " + connect_address;
|
||||
if (insecure_concurrency > 0) result.arguments += "--insecure-concurrency=" + Int2String(insecure_concurrency);
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace NekoRay::fmt {
|
||||
} else {
|
||||
url.setScheme(QString("socks%1").arg(socks_http_type));
|
||||
}
|
||||
if (!name.isEmpty()) url.setFragment(UrlSafe_encode(name));
|
||||
if (!name.isEmpty()) url.setFragment(name);
|
||||
if (!username.isEmpty()) url.setUserName(username);
|
||||
if (!password.isEmpty()) url.setPassword(password);
|
||||
url.setHost(serverAddress);
|
||||
url.setPort(serverPort);
|
||||
return url.toString();
|
||||
return url.toString(QUrl::FullyEncoded);
|
||||
}
|
||||
|
||||
QString TrojanVLESSBean::ToShareLink() {
|
||||
@@ -30,7 +30,7 @@ namespace NekoRay::fmt {
|
||||
url.setUserName(password);
|
||||
url.setHost(serverAddress);
|
||||
url.setPort(serverPort);
|
||||
if (!name.isEmpty()) url.setFragment(UrlSafe_encode(name));
|
||||
if (!name.isEmpty()) url.setFragment(name);
|
||||
if (!stream->sni.isEmpty()) query.addQueryItem("sni", stream->sni);
|
||||
query.addQueryItem("security", stream->security);
|
||||
query.addQueryItem("type", stream->network);
|
||||
@@ -43,7 +43,7 @@ namespace NekoRay::fmt {
|
||||
}
|
||||
|
||||
url.setQuery(query);
|
||||
return url.toString();
|
||||
return url.toString(QUrl::FullyEncoded);
|
||||
}
|
||||
|
||||
QString ShadowSocksBean::ToShareLink() {
|
||||
@@ -53,11 +53,11 @@ namespace NekoRay::fmt {
|
||||
url.setUserName(username.toUtf8().toBase64(QByteArray::Base64Option::Base64UrlEncoding));
|
||||
url.setHost(serverAddress);
|
||||
url.setPort(serverPort);
|
||||
if (!name.isEmpty()) url.setFragment(UrlSafe_encode(name));
|
||||
if (!name.isEmpty()) url.setFragment(name);
|
||||
QUrlQuery q;
|
||||
if (!plugin.isEmpty()) q.addQueryItem("plugin", plugin);
|
||||
if (!q.isEmpty()) url.setQuery(q);
|
||||
return url.toString();
|
||||
return url.toString(QUrl::FullyEncoded);
|
||||
}
|
||||
|
||||
QString VMessBean::ToShareLink() {
|
||||
@@ -86,8 +86,8 @@ namespace NekoRay::fmt {
|
||||
url.setPassword(password);
|
||||
url.setHost(serverAddress);
|
||||
url.setPort(serverPort);
|
||||
if (!name.isEmpty()) url.setFragment(UrlSafe_encode(name));
|
||||
return url.toString();
|
||||
if (!name.isEmpty()) url.setFragment(name);
|
||||
return url.toString(QUrl::FullyEncoded);
|
||||
}
|
||||
|
||||
} // namespace NekoRay::fmt
|
||||
@@ -57,10 +57,6 @@ QString GetRandomString(int randomStringLength);
|
||||
|
||||
quint64 GetRandomUint64();
|
||||
|
||||
inline QString UrlSafe_encode(const QString &s) {
|
||||
return s.toUtf8().toPercentEncoding().replace(" ", "%20");
|
||||
}
|
||||
|
||||
// JSON
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
Reference in New Issue
Block a user