aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/serviceProxy/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/serviceProxy/index.ts')
-rw-r--r--src/features/serviceProxy/index.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/features/serviceProxy/index.ts b/src/features/serviceProxy/index.ts
index b3705b190..e0d667a72 100644
--- a/src/features/serviceProxy/index.ts
+++ b/src/features/serviceProxy/index.ts
@@ -1,8 +1,7 @@
1import { autorun, observable } from 'mobx'; 1import { autorun, observable } from 'mobx';
2import { session } from '@electron/remote'; 2import { session } from '@electron/remote';
3 3
4// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed 4const debug = require('../../preload-safe-debug')('Ferdium:feature:serviceProxy');
5// const debug = require('debug')('Ferdium:feature:serviceProxy');
6 5
7export const config = observable({ 6export const config = observable({
8 isEnabled: true, 7 isEnabled: true,
@@ -12,7 +11,7 @@ export default function init(stores: {
12 services: { enabled: any }; 11 services: { enabled: any };
13 settings: { proxy: any }; 12 settings: { proxy: any };
14}) { 13}) {
15 console.log('Initializing `serviceProxy` feature'); 14 debug('Initializing `serviceProxy` feature');
16 15
17 autorun(() => { 16 autorun(() => {
18 config.isEnabled = true; 17 config.isEnabled = true;
@@ -20,7 +19,7 @@ export default function init(stores: {
20 const services = stores.services.enabled; 19 const services = stores.services.enabled;
21 const proxySettings = stores.settings.proxy; 20 const proxySettings = stores.settings.proxy;
22 21
23 console.log('Service Proxy autorun'); 22 debug('Service Proxy autorun');
24 23
25 for (const service of services) { 24 for (const service of services) {
26 const s = session.fromPartition(`persist:service-${service.id}`); 25 const s = session.fromPartition(`persist:service-${service.id}`);
@@ -36,14 +35,14 @@ export default function init(stores: {
36 const proxyHost = `${serviceProxyConfig.host}${ 35 const proxyHost = `${serviceProxyConfig.host}${
37 serviceProxyConfig.port ? `:${serviceProxyConfig.port}` : '' 36 serviceProxyConfig.port ? `:${serviceProxyConfig.port}` : ''
38 }`; 37 }`;
39 console.log( 38 debug(
40 `Setting proxy config from service settings for "${service.name}" (${service.id}) to`, 39 `Setting proxy config from service settings for "${service.name}" (${service.id}) to`,
41 proxyHost, 40 proxyHost,
42 ); 41 );
43 42
44 s.setProxy({ proxyRules: proxyHost }) 43 s.setProxy({ proxyRules: proxyHost })
45 .then(() => { 44 .then(() => {
46 console.log( 45 debug(
47 `Using proxy "${proxyHost}" for "${service.name}" (${service.id})`, 46 `Using proxy "${proxyHost}" for "${service.name}" (${service.id})`,
48 ); 47 );
49 }) 48 })