added button to turn off hwid sending
This commit is contained in:
@@ -74,6 +74,8 @@ pub struct IVerge {
|
||||
/// enable dns settings - this controls whether dns_config.yaml is applied
|
||||
pub enable_dns_settings: Option<bool>,
|
||||
|
||||
pub enable_send_hwid: Option<bool>,
|
||||
|
||||
pub primary_action: Option<String>,
|
||||
|
||||
/// always use default bypass
|
||||
@@ -403,6 +405,7 @@ impl IVerge {
|
||||
enable_auto_light_weight_mode: Some(false),
|
||||
auto_light_weight_minutes: Some(10),
|
||||
enable_dns_settings: Some(false),
|
||||
enable_send_hwid: Some(true),
|
||||
primary_action: Some("tun-mode".into()),
|
||||
home_cards: None,
|
||||
service_state: None,
|
||||
@@ -492,6 +495,7 @@ impl IVerge {
|
||||
patch!(enable_auto_light_weight_mode);
|
||||
patch!(auto_light_weight_minutes);
|
||||
patch!(enable_dns_settings);
|
||||
patch!(enable_send_hwid);
|
||||
patch!(primary_action);
|
||||
patch!(home_cards);
|
||||
patch!(service_state);
|
||||
@@ -588,6 +592,7 @@ pub struct IVergeResponse {
|
||||
pub enable_auto_light_weight_mode: Option<bool>,
|
||||
pub auto_light_weight_minutes: Option<u64>,
|
||||
pub enable_dns_settings: Option<bool>,
|
||||
pub enable_send_hwid: Option<bool>,
|
||||
pub primary_action: Option<String>,
|
||||
pub home_cards: Option<serde_json::Value>,
|
||||
pub enable_hover_jump_navigator: Option<bool>,
|
||||
@@ -661,6 +666,7 @@ impl From<IVerge> for IVergeResponse {
|
||||
enable_auto_light_weight_mode: verge.enable_auto_light_weight_mode,
|
||||
auto_light_weight_minutes: verge.auto_light_weight_minutes,
|
||||
enable_dns_settings: verge.enable_dns_settings,
|
||||
enable_send_hwid: verge.enable_send_hwid,
|
||||
primary_action: verge.primary_action,
|
||||
home_cards: verge.home_cards,
|
||||
enable_hover_jump_navigator: verge.enable_hover_jump_navigator,
|
||||
|
||||
@@ -552,33 +552,21 @@ pub async fn resolve_scheme(param: String) -> Result<()> {
|
||||
if link_parsed.scheme() == "clash" || link_parsed.scheme() == "clash-verge" {
|
||||
let mut name: Option<String> = None;
|
||||
let mut url_param: Option<String> = None;
|
||||
let mut use_hwid = true;
|
||||
|
||||
for (key, value) in link_parsed.query_pairs() {
|
||||
match key.as_ref() {
|
||||
"name" => name = Some(value.into_owned()),
|
||||
"url" => url_param = Some(percent_decode_str(&value).decode_utf8_lossy().to_string()),
|
||||
"hwid" => use_hwid = value == "1" || value == "true",
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
let option = if use_hwid {
|
||||
log::info!(target:"app", "HWID usage requested via deep link");
|
||||
Some(PrfOption {
|
||||
use_hwid: Some(true),
|
||||
..Default::default()
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
match url_param {
|
||||
Some(url) => {
|
||||
log::info!(target:"app", "decoded subscription url: {url}");
|
||||
|
||||
create_window(false);
|
||||
match PrfItem::from_url(url.as_ref(), name, None, option).await {
|
||||
match PrfItem::from_url(url.as_ref(), name, None, None).await {
|
||||
Ok(item) => {
|
||||
let uid = item.uid.clone().unwrap();
|
||||
let _ = wrap_err!(Config::profiles().data().append_item(item));
|
||||
|
||||
@@ -43,6 +43,7 @@ import {
|
||||
Power,
|
||||
BellOff,
|
||||
Repeat,
|
||||
Fingerprint
|
||||
} from "lucide-react";
|
||||
|
||||
// Модальные окна
|
||||
@@ -390,6 +391,22 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
</Select>
|
||||
</GuardState>
|
||||
</SettingRow>
|
||||
|
||||
<SettingRow
|
||||
label={<LabelWithIcon icon={Fingerprint} text={t("Send HWID")} />}
|
||||
>
|
||||
<GuardState
|
||||
value={verge?.enable_send_hwid ?? true} // По умолчанию включено
|
||||
valueProps="checked"
|
||||
onChangeProps="onCheckedChange"
|
||||
onFormat={onSwitchFormat}
|
||||
onChange={(e) => onChangeData({ enable_send_hwid: e })}
|
||||
onGuard={(e) => patchVerge({ enable_send_hwid: e })}
|
||||
onCatch={onError}
|
||||
>
|
||||
<Switch />
|
||||
</GuardState>
|
||||
</SettingRow>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user