diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-02 09:24:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-02 09:24:32 +0200 |
commit | bfe8847d72cd0893230f2e654242658214943e61 (patch) | |
tree | 3384b02ebad7a74cbb106ddd95546e0e24ff0bb8 /src/features/serviceProxy/index.js | |
parent | fix: Fix navigation shortcut accelerator for non-macos (fixes #1172) (#2012) (diff) | |
download | ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.gz ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.tar.zst ferdium-app-bfe8847d72cd0893230f2e654242658214943e61.zip |
chore: convert various files from JS to TS (#2010)
Diffstat (limited to 'src/features/serviceProxy/index.js')
-rw-r--r-- | src/features/serviceProxy/index.js | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/features/serviceProxy/index.js b/src/features/serviceProxy/index.js deleted file mode 100644 index b9320cda9..000000000 --- a/src/features/serviceProxy/index.js +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | import { autorun, observable } from 'mobx'; | ||
2 | import { session } from '@electron/remote'; | ||
3 | |||
4 | const debug = require('debug')('Ferdi:feature:serviceProxy'); | ||
5 | |||
6 | export const config = observable({ | ||
7 | isEnabled: true, | ||
8 | }); | ||
9 | |||
10 | export default function init(stores) { | ||
11 | debug('Initializing `serviceProxy` feature'); | ||
12 | |||
13 | autorun(() => { | ||
14 | config.isEnabled = true; | ||
15 | |||
16 | const services = stores.services.enabled; | ||
17 | const proxySettings = stores.settings.proxy; | ||
18 | |||
19 | debug('Service Proxy autorun'); | ||
20 | |||
21 | for (const service of services) { | ||
22 | const s = session.fromPartition(`persist:service-${service.id}`); | ||
23 | |||
24 | if (config.isEnabled) { | ||
25 | const serviceProxyConfig = proxySettings[service.id]; | ||
26 | |||
27 | if (serviceProxyConfig && serviceProxyConfig.isEnabled && serviceProxyConfig.host) { | ||
28 | const proxyHost = `${serviceProxyConfig.host}${serviceProxyConfig.port ? `:${serviceProxyConfig.port}` : ''}`; | ||
29 | debug(`Setting proxy config from service settings for "${service.name}" (${service.id}) to`, proxyHost); | ||
30 | |||
31 | s.setProxy({ proxyRules: proxyHost }, () => { | ||
32 | debug(`Using proxy "${proxyHost}" for "${service.name}" (${service.id})`); | ||
33 | }); | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | }); | ||
38 | } | ||