feat: allow set bypass without using default value

This commit is contained in:
MystiPanda
2024-07-01 22:53:06 +08:00
parent 6e374bcd4e
commit d81ef1d67c
8 changed files with 41 additions and 6 deletions

View File

@@ -49,6 +49,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
proxy_auto_config,
pac_file_content,
enable_proxy_guard,
use_default_bypass,
system_proxy_bypass,
proxy_guard_duration,
} = verge ?? {};
@@ -57,6 +58,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
guard: enable_proxy_guard,
bypass: system_proxy_bypass,
duration: proxy_guard_duration ?? 10,
use_default: use_default_bypass ?? true,
pac: proxy_auto_config,
pac_content: pac_file_content ?? DEFAULT_PAC,
});
@@ -68,6 +70,7 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
guard: enable_proxy_guard,
bypass: system_proxy_bypass,
duration: proxy_guard_duration ?? 10,
use_default: use_default_bypass ?? true,
pac: proxy_auto_config,
pac_content: pac_file_content ?? DEFAULT_PAC,
});
@@ -97,6 +100,9 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
if (value.pac !== proxy_auto_config) {
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) {
patch.pac_file_content = value.pac_content;
}
@@ -197,6 +203,17 @@ export const SysproxyViewer = forwardRef<DialogRef>((props, ref) => {
}}
/>
</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 && (
<>
<ListItemText primary={t("Proxy Bypass")} />

View File

@@ -151,6 +151,7 @@
"Proxy Guard": "Proxy Guard",
"Proxy Guard Info": "Enable to prevent other software from modifying the operating system's proxy settings",
"Guard Duration": "Guard Duration",
"Always use Default Bypass": "Always use Default Bypass",
"Proxy Bypass": "Proxy Bypass Settings: ",
"Bypass": "Bypass: ",
"Use PAC Mode": "Use PAC Mode",

View File

@@ -141,6 +141,7 @@
"Proxy Guard": "محافظ پراکسی",
"Proxy Guard Info": "امکان جلوگیری از نرم‌افزارهای دیگر از تغییر تنظیمات پروکسی سیستم عامل را فعال کنید",
"Guard Duration": "مدت محافظت",
"Always use Default Bypass": "همیشه از دور زدن پیش‌فرض استفاده کنید",
"Proxy Bypass": "دور زدن پراکسی: ",
"Bypass": "دور زدن: ",
"Use PAC Mode": "استفاده از حالت PAC",

View File

@@ -141,6 +141,7 @@
"Proxy Guard": "Защита прокси",
"Proxy Guard Info": "Включите эту функцию чтобы предотвратить изменение настроек прокси-сервера операционной системы другим программным обеспечением",
"Guard Duration": "Период защиты",
"Always use Default Bypass": "Всегда использовать стандартное обходное решение",
"Proxy Bypass": "Игнорирование прокси: ",
"Bypass": "Игнорирование: ",
"Use PAC Mode": "Используйте режим PAC",

View File

@@ -151,6 +151,7 @@
"Proxy Guard": "系统代理守卫",
"Proxy Guard Info": "开启以防止其他软件修改操作系统的代理设置",
"Guard Duration": "代理守卫间隔",
"Always use Default Bypass": "始终使用默认绕过",
"Proxy Bypass": "代理绕过设置:",
"Bypass": "当前绕过:",
"Use PAC Mode": "使用PAC模式",

View File

@@ -239,6 +239,7 @@ interface IVergeConfig {
verge_socks_enabled?: boolean;
verge_http_enabled?: boolean;
enable_proxy_guard?: boolean;
use_default_bypass?: boolean;
proxy_guard_duration?: number;
system_proxy_bypass?: string;
web_ui_list?: string[];