mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 21:14:37 +03:00
parse ss2022 share link, closes #481
This commit is contained in:
@@ -89,10 +89,20 @@ namespace NekoRay::fmt {
|
|||||||
name = url.fragment(QUrl::FullyDecoded);
|
name = url.fragment(QUrl::FullyDecoded);
|
||||||
serverAddress = url.host();
|
serverAddress = url.host();
|
||||||
serverPort = url.port();
|
serverPort = url.port();
|
||||||
auto method_password = DecodeB64IfValid(url.userName(), QByteArray::Base64Option::Base64UrlEncoding);
|
|
||||||
|
auto urlUserName = url.userName();
|
||||||
|
QString method_password;
|
||||||
|
if (urlUserName.contains(":")) {
|
||||||
|
// 2022 format
|
||||||
|
method_password = urlUserName;
|
||||||
|
} else {
|
||||||
|
// traditional format
|
||||||
|
method_password = DecodeB64IfValid(urlUserName, QByteArray::Base64Option::Base64UrlEncoding);
|
||||||
|
}
|
||||||
if (method_password.isEmpty()) return false;
|
if (method_password.isEmpty()) return false;
|
||||||
method = SubStrBefore(method_password, ":");
|
method = SubStrBefore(method_password, ":");
|
||||||
password = SubStrAfter(method_password, ":");
|
password = SubStrAfter(method_password, ":");
|
||||||
|
|
||||||
auto query = GetQuery(url);
|
auto query = GetQuery(url);
|
||||||
plugin = query.queryItemValue("plugin").replace("simple-obfs;", "obfs-local;");
|
plugin = query.queryItemValue("plugin").replace("simple-obfs;", "obfs-local;");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user