mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:43:44 +08:00
feat: allow set bypass without using default value
This commit is contained in:
parent
6e374bcd4e
commit
d81ef1d67c
@ -75,6 +75,9 @@ pub struct IVerge {
|
|||||||
/// enable proxy guard
|
/// enable proxy guard
|
||||||
pub enable_proxy_guard: Option<bool>,
|
pub enable_proxy_guard: Option<bool>,
|
||||||
|
|
||||||
|
/// always use default bypass
|
||||||
|
pub use_default_bypass: Option<bool>,
|
||||||
|
|
||||||
/// set system proxy bypass
|
/// set system proxy bypass
|
||||||
pub system_proxy_bypass: Option<String>,
|
pub system_proxy_bypass: Option<String>,
|
||||||
|
|
||||||
@ -235,6 +238,7 @@ impl IVerge {
|
|||||||
verge_port: Some(7899),
|
verge_port: Some(7899),
|
||||||
verge_http_enabled: Some(true),
|
verge_http_enabled: Some(true),
|
||||||
enable_proxy_guard: Some(false),
|
enable_proxy_guard: Some(false),
|
||||||
|
use_default_bypass: Some(true),
|
||||||
proxy_guard_duration: Some(30),
|
proxy_guard_duration: Some(30),
|
||||||
auto_close_connection: Some(true),
|
auto_close_connection: Some(true),
|
||||||
auto_check_update: Some(true),
|
auto_check_update: Some(true),
|
||||||
@ -297,6 +301,7 @@ impl IVerge {
|
|||||||
patch!(verge_http_enabled);
|
patch!(verge_http_enabled);
|
||||||
patch!(enable_system_proxy);
|
patch!(enable_system_proxy);
|
||||||
patch!(enable_proxy_guard);
|
patch!(enable_proxy_guard);
|
||||||
|
patch!(use_default_bypass);
|
||||||
patch!(system_proxy_bypass);
|
patch!(system_proxy_bypass);
|
||||||
patch!(proxy_guard_duration);
|
patch!(proxy_guard_duration);
|
||||||
patch!(proxy_auto_config);
|
patch!(proxy_auto_config);
|
||||||
|
@ -42,8 +42,8 @@ static DEFAULT_BYPASS: &str =
|
|||||||
"127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.crashlytics.com,<local>";
|
"127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.crashlytics.com,<local>";
|
||||||
|
|
||||||
fn get_bypass() -> String {
|
fn get_bypass() -> String {
|
||||||
let bypass = DEFAULT_BYPASS.to_string();
|
// let bypass = DEFAULT_BYPASS.to_string();
|
||||||
|
let use_default = Config::verge().latest().use_default_bypass.unwrap_or(true);
|
||||||
let res = {
|
let res = {
|
||||||
let verge = Config::verge();
|
let verge = Config::verge();
|
||||||
let verge = verge.latest();
|
let verge = verge.latest();
|
||||||
@ -55,15 +55,23 @@ fn get_bypass() -> String {
|
|||||||
};
|
};
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let bypass = if custom_bypass.is_empty() {
|
let bypass = if custom_bypass.is_empty() {
|
||||||
bypass
|
DEFAULT_BYPASS.to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("{};{}", bypass, custom_bypass)
|
if use_default {
|
||||||
|
format!("{};{}", DEFAULT_BYPASS, custom_bypass)
|
||||||
|
} else {
|
||||||
|
custom_bypass
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
let bypass = if custom_bypass.is_empty() {
|
let bypass = if custom_bypass.is_empty() {
|
||||||
bypass
|
DEFAULT_BYPASS.to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("{},{}", bypass, custom_bypass)
|
if use_default {
|
||||||
|
format!("{},{}", DEFAULT_BYPASS, custom_bypass)
|
||||||
|
} else {
|
||||||
|
custom_bypass
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bypass
|
bypass
|
||||||
|
@ -49,6 +49,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
proxy_auto_config,
|
proxy_auto_config,
|
||||||
pac_file_content,
|
pac_file_content,
|
||||||
enable_proxy_guard,
|
enable_proxy_guard,
|
||||||
|
use_default_bypass,
|
||||||
system_proxy_bypass,
|
system_proxy_bypass,
|
||||||
proxy_guard_duration,
|
proxy_guard_duration,
|
||||||
} = verge ?? {};
|
} = verge ?? {};
|
||||||
@ -57,6 +58,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
guard: enable_proxy_guard,
|
guard: enable_proxy_guard,
|
||||||
bypass: system_proxy_bypass,
|
bypass: system_proxy_bypass,
|
||||||
duration: proxy_guard_duration ?? 10,
|
duration: proxy_guard_duration ?? 10,
|
||||||
|
use_default: use_default_bypass ?? true,
|
||||||
pac: proxy_auto_config,
|
pac: proxy_auto_config,
|
||||||
pac_content: pac_file_content ?? DEFAULT_PAC,
|
pac_content: pac_file_content ?? DEFAULT_PAC,
|
||||||
});
|
});
|
||||||
@ -68,6 +70,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
guard: enable_proxy_guard,
|
guard: enable_proxy_guard,
|
||||||
bypass: system_proxy_bypass,
|
bypass: system_proxy_bypass,
|
||||||
duration: proxy_guard_duration ?? 10,
|
duration: proxy_guard_duration ?? 10,
|
||||||
|
use_default: use_default_bypass ?? true,
|
||||||
pac: proxy_auto_config,
|
pac: proxy_auto_config,
|
||||||
pac_content: pac_file_content ?? DEFAULT_PAC,
|
pac_content: pac_file_content ?? DEFAULT_PAC,
|
||||||
});
|
});
|
||||||
@ -97,6 +100,9 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
if (value.pac !== proxy_auto_config) {
|
if (value.pac !== proxy_auto_config) {
|
||||||
patch.proxy_auto_config = value.pac;
|
patch.proxy_auto_config = value.pac;
|
||||||
}
|
}
|
||||||
|
if (value.use_default !== use_default_bypass) {
|
||||||
|
patch.use_default_bypass = value.use_default;
|
||||||
|
}
|
||||||
if (value.pac_content !== pac_file_content) {
|
if (value.pac_content !== pac_file_content) {
|
||||||
patch.pac_file_content = value.pac_content;
|
patch.pac_file_content = value.pac_content;
|
||||||
}
|
}
|
||||||
@ -197,6 +203,17 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
{!value.pac && (
|
||||||
|
<ListItem sx={{ padding: "5px 2px" }}>
|
||||||
|
<ListItemText primary={t("Always use Default Bypass")} />
|
||||||
|
<Switch
|
||||||
|
edge="end"
|
||||||
|
disabled={!enabled}
|
||||||
|
checked={value.use_default}
|
||||||
|
onChange={(_, e) => setValue((v) => ({ ...v, use_default: e }))}
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
|
)}
|
||||||
{!value.pac && (
|
{!value.pac && (
|
||||||
<>
|
<>
|
||||||
<ListItemText primary={t("Proxy Bypass")} />
|
<ListItemText primary={t("Proxy Bypass")} />
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
"Proxy Guard": "Proxy Guard",
|
"Proxy Guard": "Proxy Guard",
|
||||||
"Proxy Guard Info": "Enable to prevent other software from modifying the operating system's proxy settings",
|
"Proxy Guard Info": "Enable to prevent other software from modifying the operating system's proxy settings",
|
||||||
"Guard Duration": "Guard Duration",
|
"Guard Duration": "Guard Duration",
|
||||||
|
"Always use Default Bypass": "Always use Default Bypass",
|
||||||
"Proxy Bypass": "Proxy Bypass Settings: ",
|
"Proxy Bypass": "Proxy Bypass Settings: ",
|
||||||
"Bypass": "Bypass: ",
|
"Bypass": "Bypass: ",
|
||||||
"Use PAC Mode": "Use PAC Mode",
|
"Use PAC Mode": "Use PAC Mode",
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
"Proxy Guard": "محافظ پراکسی",
|
"Proxy Guard": "محافظ پراکسی",
|
||||||
"Proxy Guard Info": "امکان جلوگیری از نرمافزارهای دیگر از تغییر تنظیمات پروکسی سیستم عامل را فعال کنید",
|
"Proxy Guard Info": "امکان جلوگیری از نرمافزارهای دیگر از تغییر تنظیمات پروکسی سیستم عامل را فعال کنید",
|
||||||
"Guard Duration": "مدت محافظت",
|
"Guard Duration": "مدت محافظت",
|
||||||
|
"Always use Default Bypass": "همیشه از دور زدن پیشفرض استفاده کنید",
|
||||||
"Proxy Bypass": "دور زدن پراکسی: ",
|
"Proxy Bypass": "دور زدن پراکسی: ",
|
||||||
"Bypass": "دور زدن: ",
|
"Bypass": "دور زدن: ",
|
||||||
"Use PAC Mode": "استفاده از حالت PAC",
|
"Use PAC Mode": "استفاده از حالت PAC",
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
"Proxy Guard": "Защита прокси",
|
"Proxy Guard": "Защита прокси",
|
||||||
"Proxy Guard Info": "Включите эту функцию чтобы предотвратить изменение настроек прокси-сервера операционной системы другим программным обеспечением",
|
"Proxy Guard Info": "Включите эту функцию чтобы предотвратить изменение настроек прокси-сервера операционной системы другим программным обеспечением",
|
||||||
"Guard Duration": "Период защиты",
|
"Guard Duration": "Период защиты",
|
||||||
|
"Always use Default Bypass": "Всегда использовать стандартное обходное решение",
|
||||||
"Proxy Bypass": "Игнорирование прокси: ",
|
"Proxy Bypass": "Игнорирование прокси: ",
|
||||||
"Bypass": "Игнорирование: ",
|
"Bypass": "Игнорирование: ",
|
||||||
"Use PAC Mode": "Используйте режим PAC",
|
"Use PAC Mode": "Используйте режим PAC",
|
||||||
|
@ -151,6 +151,7 @@
|
|||||||
"Proxy Guard": "系统代理守卫",
|
"Proxy Guard": "系统代理守卫",
|
||||||
"Proxy Guard Info": "开启以防止其他软件修改操作系统的代理设置",
|
"Proxy Guard Info": "开启以防止其他软件修改操作系统的代理设置",
|
||||||
"Guard Duration": "代理守卫间隔",
|
"Guard Duration": "代理守卫间隔",
|
||||||
|
"Always use Default Bypass": "始终使用默认绕过",
|
||||||
"Proxy Bypass": "代理绕过设置:",
|
"Proxy Bypass": "代理绕过设置:",
|
||||||
"Bypass": "当前绕过:",
|
"Bypass": "当前绕过:",
|
||||||
"Use PAC Mode": "使用PAC模式",
|
"Use PAC Mode": "使用PAC模式",
|
||||||
|
1
src/services/types.d.ts
vendored
1
src/services/types.d.ts
vendored
@ -239,6 +239,7 @@ interface IVergeConfig {
|
|||||||
verge_socks_enabled?: boolean;
|
verge_socks_enabled?: boolean;
|
||||||
verge_http_enabled?: boolean;
|
verge_http_enabled?: boolean;
|
||||||
enable_proxy_guard?: boolean;
|
enable_proxy_guard?: boolean;
|
||||||
|
use_default_bypass?: boolean;
|
||||||
proxy_guard_duration?: number;
|
proxy_guard_duration?: number;
|
||||||
system_proxy_bypass?: string;
|
system_proxy_bypass?: string;
|
||||||
web_ui_list?: string[];
|
web_ui_list?: string[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user