summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-06-16 22:53:04 +0800
committerHaishan <[email protected]>2020-06-16 23:41:17 +0800
commitcee7dff4785b9e79e6f5134744d99723a775bdfa (patch)
treebcd7ac6ca2bb047077e04079a57de25a794d9d2f /src/components
parentbabe27f9d291283a749552913a46cb9a9d2512e4 (diff)
feat: toggle to close old connections automatically when switching proxy
Diffstat (limited to 'src/components')
-rw-r--r--src/components/proxies/Settings.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/components/proxies/Settings.js b/src/components/proxies/Settings.js
index e21ae72..43ec787 100644
--- a/src/components/proxies/Settings.js
+++ b/src/components/proxies/Settings.js
@@ -1,6 +1,10 @@
import * as React from 'react';
-import { getProxySortBy, getHideUnavailableProxies } from '../../store/app';
+import {
+ getAutoCloseOldConns,
+ getProxySortBy,
+ getHideUnavailableProxies,
+} from '../../store/app';
import Switch from '../SwitchThemed';
import { connect, useStoreActions } from '../StateProvider';
@@ -58,6 +62,16 @@ function Settings({ appConfig }) {
/>
</div>
</div>
+ <div className={s.labeledInput}>
+ <span>Automatically close old connections</span>
+ <div>
+ <Switch
+ name="autoCloseOldConns"
+ checked={appConfig.autoCloseOldConns}
+ onChange={(v) => updateAppConfig('autoCloseOldConns', v)}
+ />
+ </div>
+ </div>
</>
);
}
@@ -65,10 +79,13 @@ function Settings({ appConfig }) {
const mapState = (s) => {
const proxySortBy = getProxySortBy(s);
const hideUnavailableProxies = getHideUnavailableProxies(s);
+ const autoCloseOldConns = getAutoCloseOldConns(s);
+
return {
appConfig: {
proxySortBy,
hideUnavailableProxies,
+ autoCloseOldConns,
},
};
};