From dbfe4258b7b7dfc24517e9b732a22d8da08168cf Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:29:31 +0800 Subject: [PATCH] fix naive link --- fmt/Bean2Link.cpp | 2 +- fmt/Link2Bean.cpp | 3 +++ sub/GroupUpdater.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fmt/Bean2Link.cpp b/fmt/Bean2Link.cpp index 03f63c5..25f1b9b 100644 --- a/fmt/Bean2Link.cpp +++ b/fmt/Bean2Link.cpp @@ -81,7 +81,7 @@ namespace NekoRay::fmt { QString NaiveBean::ToShareLink() { QUrl url; - url.setScheme("https+naive"); + url.setScheme("naive+" + protocol); url.setUserName(username); url.setPassword(password); url.setHost(serverAddress); diff --git a/fmt/Link2Bean.cpp b/fmt/Link2Bean.cpp index 905f0e2..785902b 100644 --- a/fmt/Link2Bean.cpp +++ b/fmt/Link2Bean.cpp @@ -136,6 +136,9 @@ namespace NekoRay::fmt { auto url = QUrl(link); if (!url.isValid()) return false; + protocol = url.scheme().replace("naive+", ""); + if (protocol != "https" && protocol != "quic") return false; + name = url.fragment(QUrl::FullyDecoded); serverAddress = url.host(); serverPort = url.port(); diff --git a/sub/GroupUpdater.cpp b/sub/GroupUpdater.cpp index 11e2acd..ae67137 100644 --- a/sub/GroupUpdater.cpp +++ b/sub/GroupUpdater.cpp @@ -101,7 +101,7 @@ namespace NekoRay::sub { } // Naive - if (str.startsWith("https+naive://")) { + if (str.startsWith("naive+")) { ent = ProfileManager::NewProxyEntity("naive"); auto ok = ent->NaiveBean()->TryParseLink(str); if (!ok) return;