mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Merge pull request #704 from GoldJohnKing/feat/702-respect-system-proxy-windows
feat: respect system proxy settings on Windows platform
This commit is contained in:
@@ -544,10 +544,12 @@ function AdvancedSettings() {
|
||||
|
||||
const [hardwareAccelerationEnabled, setHardwareAccelerationEnabled] = useState(true);
|
||||
const [useSymlink, setUseSymlink] = useState(false);
|
||||
const [useSystemProxy, setUseSystemProxy] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
staticConfig.get("disable-hadware-acceleration").then(disabled =>setHardwareAccelerationEnabled(() => disabled !== true));
|
||||
staticConfig.get("use-symlinks").then(useSymlinks => setUseSymlink(() => useSymlinks));
|
||||
staticConfig.get("use-system-proxy").then(useSystemProxy => setUseSystemProxy(() => useSystemProxy));
|
||||
}, []);
|
||||
|
||||
const onChangeHardwareAcceleration = async (newHardwareAccelerationEnabled: boolean) => {
|
||||
@@ -612,6 +614,22 @@ function AdvancedSettings() {
|
||||
setUseSymlink(() => newUseSymlink);
|
||||
}
|
||||
|
||||
const onChangeUseSystemProxy = async (newUseSystemProxy: boolean) => {
|
||||
|
||||
if (window.electron.platform !== "win32" || newUseSystemProxy === useSystemProxy) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { error } = await tryit(() => staticConfig.set("use-system-proxy", newUseSystemProxy));
|
||||
|
||||
if(error){
|
||||
notification.notifyError({ title: "notifications.types.error", desc: "pages.settings.advanced.use-system-proxy.error-notification.message" });
|
||||
return;
|
||||
}
|
||||
|
||||
setUseSystemProxy(() => newUseSystemProxy);
|
||||
}
|
||||
|
||||
const advancedItems: Item[] = [{
|
||||
checked: hardwareAccelerationEnabled,
|
||||
text: t.text("pages.settings.advanced.hardware-acceleration.title"),
|
||||
@@ -625,6 +643,12 @@ function AdvancedSettings() {
|
||||
desc: t.text("pages.settings.advanced.use-symlinks.description"),
|
||||
onChange: onChangeUseSymlinks
|
||||
});
|
||||
advancedItems.push({
|
||||
checked: useSystemProxy,
|
||||
text: t.text("pages.settings.advanced.use-system-proxy.title"),
|
||||
desc: t.text("pages.settings.advanced.use-system-proxy.description"),
|
||||
onChange: onChangeUseSystemProxy
|
||||
});
|
||||
}
|
||||
|
||||
return <SettingContainer title="pages.settings.advanced.title" description="pages.settings.advanced.description">
|
||||
|
||||
Reference in New Issue
Block a user