mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
修复一些历史问题 (#592)
* fix desktop * SIP002-URI-Scheme --------- Co-authored-by: arm64v8a <48624112+arm64v8a@users.noreply.github.com>
This commit is contained in:
@@ -72,18 +72,27 @@ namespace NekoRay::fmt {
|
|||||||
return url.toString(QUrl::FullyEncoded);
|
return url.toString(QUrl::FullyEncoded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* fixShadowsocksUserNameEncodeMagic = "fixShadowsocksUserNameEncodeMagic-holder-for-QUrl";
|
||||||
|
|
||||||
QString ShadowSocksBean::ToShareLink() {
|
QString ShadowSocksBean::ToShareLink() {
|
||||||
QUrl url;
|
QUrl url;
|
||||||
url.setScheme("ss");
|
url.setScheme("ss");
|
||||||
auto username = method + ":" + password;
|
if (method.startsWith("2022-")) {
|
||||||
url.setUserName(username.toUtf8().toBase64(QByteArray::Base64Option::Base64UrlEncoding));
|
url.setUserName(fixShadowsocksUserNameEncodeMagic);
|
||||||
|
} else {
|
||||||
|
auto method_password = method + ":" + password;
|
||||||
|
url.setUserName(method_password.toUtf8().toBase64(QByteArray::Base64Option::Base64UrlEncoding));
|
||||||
|
}
|
||||||
url.setHost(serverAddress);
|
url.setHost(serverAddress);
|
||||||
url.setPort(serverPort);
|
url.setPort(serverPort);
|
||||||
if (!name.isEmpty()) url.setFragment(name);
|
if (!name.isEmpty()) url.setFragment(name);
|
||||||
QUrlQuery q;
|
QUrlQuery q;
|
||||||
if (!plugin.isEmpty()) q.addQueryItem("plugin", plugin);
|
if (!plugin.isEmpty()) q.addQueryItem("plugin", plugin);
|
||||||
if (!q.isEmpty()) url.setQuery(q);
|
if (!q.isEmpty()) url.setQuery(q);
|
||||||
return url.toString(QUrl::FullyEncoded);
|
//
|
||||||
|
auto link = url.toString(QUrl::FullyEncoded);
|
||||||
|
link = link.replace(fixShadowsocksUserNameEncodeMagic, method + ":" + QUrl::toPercentEncoding(password));
|
||||||
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VMessBean::ToShareLink() {
|
QString VMessBean::ToShareLink() {
|
||||||
|
|||||||
@@ -101,18 +101,17 @@ namespace NekoRay::fmt {
|
|||||||
serverAddress = url.host();
|
serverAddress = url.host();
|
||||||
serverPort = url.port();
|
serverPort = url.port();
|
||||||
|
|
||||||
auto urlUserName = url.userName();
|
if (url.password().isEmpty()) {
|
||||||
QString method_password;
|
|
||||||
if (urlUserName.contains(":")) {
|
|
||||||
// 2022 format
|
|
||||||
method_password = urlUserName;
|
|
||||||
} else {
|
|
||||||
// traditional format
|
// traditional format
|
||||||
method_password = DecodeB64IfValid(urlUserName, QByteArray::Base64Option::Base64UrlEncoding);
|
auto method_password = DecodeB64IfValid(url.userName(), 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, ":");
|
||||||
|
} else {
|
||||||
|
// 2022 format
|
||||||
|
method = url.userName();
|
||||||
|
password = url.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;");
|
||||||
|
|||||||
@@ -20,17 +20,22 @@ Description: Qt based cross-platform GUI proxy configuration manager (backend: v
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >nekoray/DEBIAN/postinst <<-EOF
|
cat >nekoray/DEBIAN/postinst <<-EOF
|
||||||
cat >/usr/share/applications/nekoray.desktop<<-END
|
if [ -z /usr/share/applications/nekoray.desktop ]; then
|
||||||
[Desktop Entry]
|
cat >/usr/share/applications/nekoray.desktop<<-END
|
||||||
Name=nekoray
|
[Desktop Entry]
|
||||||
Version=$version
|
Name=nekoray
|
||||||
Comment=Qt based cross-platform GUI proxy configuration manager (backend: v2ray / sing-box)
|
Version=$version
|
||||||
Exec=/opt/nekoray/nekoray -appdata
|
Comment=Qt based cross-platform GUI proxy configuration manager (backend: v2ray / sing-box)
|
||||||
Icon=/opt/nekoray/nekoray.png
|
Exec=/opt/nekoray/nekoray -appdata
|
||||||
Terminal=false
|
Icon=/opt/nekoray/nekoray.png
|
||||||
Type=Application
|
Terminal=false
|
||||||
Categories=Network;Application;
|
Type=Application
|
||||||
|
Categories=Network;Application;
|
||||||
END
|
END
|
||||||
|
else
|
||||||
|
sed -i "s/^Version=.*/Version=$version/" /usr/share/applications/nekoray.desktop
|
||||||
|
fi
|
||||||
|
|
||||||
update-desktop-database
|
update-desktop-database
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user