mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-30 10:42:09 +08:00
Revert "feat(cvd): add device-bound subscription protocol"
This reverts commit 2cb9c13ab6.
This commit is contained in:
@@ -178,7 +178,6 @@ impl NetworkManager {
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn get_with_tls_mode(
|
||||
&self,
|
||||
url: &str,
|
||||
@@ -187,7 +186,6 @@ impl NetworkManager {
|
||||
user_agent: Option<String>,
|
||||
accept_invalid_certs: bool,
|
||||
tls_root_mode: TlsRootMode,
|
||||
cvd_headers: HeaderMap,
|
||||
) -> Result<HttpResponse> {
|
||||
let mut parsed = Url::parse(url)?;
|
||||
let mut extra_headers = HeaderMap::new();
|
||||
@@ -220,10 +218,6 @@ impl NetworkManager {
|
||||
|
||||
let mut request_builder = client.get(parsed);
|
||||
|
||||
// Merge CVD headers (and any future caller-supplied headers) with URL-userinfo auth.
|
||||
for (key, value) in cvd_headers.iter() {
|
||||
extra_headers.insert(key.clone(), value.clone());
|
||||
}
|
||||
for (key, value) in extra_headers.iter() {
|
||||
request_builder = request_builder.header(key, value);
|
||||
}
|
||||
@@ -298,7 +292,6 @@ impl NetworkManager {
|
||||
timeout_secs: Option<u64>,
|
||||
user_agent: Option<String>,
|
||||
accept_invalid_certs: bool,
|
||||
extra_headers: HeaderMap,
|
||||
) -> Result<HttpResponse> {
|
||||
let platform_result = self
|
||||
.get_with_tls_mode(
|
||||
@@ -308,7 +301,6 @@ impl NetworkManager {
|
||||
user_agent.clone(),
|
||||
accept_invalid_certs,
|
||||
TlsRootMode::PlatformVerifier,
|
||||
extra_headers.clone(),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -322,7 +314,6 @@ impl NetworkManager {
|
||||
user_agent,
|
||||
accept_invalid_certs,
|
||||
TlsRootMode::StaticWebpkiRoots,
|
||||
extra_headers,
|
||||
)
|
||||
.await
|
||||
.map_err(|fallback_err| {
|
||||
|
||||
@@ -85,7 +85,7 @@ async fn import_subscription(url: &str, name: Option<&String>) {
|
||||
profiles.latest_arc().current.is_some()
|
||||
};
|
||||
|
||||
let Some((mut item, device_key)) = fetch_profile_item(url, name).await else {
|
||||
let Some(mut item) = fetch_profile_item(url, name).await else {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -97,18 +97,6 @@ async fn import_subscription(url: &str, name: Option<&String>) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Persist the device key only if CVD actually engaged (item cached a pubkey). A plaintext airport
|
||||
// leaves cvd_pub None, so we skip the keychain write (and its macOS prompt).
|
||||
if item.cvd_pub.is_some()
|
||||
&& let Err(e) = device_key.persist()
|
||||
{
|
||||
logging!(
|
||||
warn,
|
||||
Type::Config,
|
||||
"cvd: failed to persist device key after deep-link import: {e}"
|
||||
);
|
||||
}
|
||||
|
||||
Config::profiles().await.apply();
|
||||
logging_error!(Type::Config, Config::profiles().await.data_arc().save_file().await);
|
||||
handle::Handle::notice_message(
|
||||
@@ -119,12 +107,9 @@ async fn import_subscription(url: &str, name: Option<&String>) {
|
||||
post_import_updates(&uid, had_current_profile).await;
|
||||
}
|
||||
|
||||
async fn fetch_profile_item(url: &str, name: Option<&String>) -> Option<(PrfItem, crate::cvd::DeviceKey)> {
|
||||
// New remote profile: own the device key; the caller persists it after the profile is saved.
|
||||
let uid = help::get_uid("R");
|
||||
let key = crate::cvd::DeviceKey::generate(&uid);
|
||||
match PrfItem::from_url(url, name, None, None, &uid, crate::cvd::CvdMode::New(&key)).await {
|
||||
Ok(item) => Some((item, key)),
|
||||
async fn fetch_profile_item(url: &str, name: Option<&String>) -> Option<PrfItem> {
|
||||
match PrfItem::from_url(url, name, None, None).await {
|
||||
Ok(item) => Some(item),
|
||||
Err(e) => {
|
||||
logging!(error, Type::Config, "failed to parse profile from url: {:?}", e);
|
||||
handle::Handle::notice_message("import_sub_url::error", e.to_string());
|
||||
|
||||
Reference in New Issue
Block a user