diff options
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/delayApp/Component.js | 23 | ||||
-rw-r--r-- | src/features/delayApp/index.js | 1 | ||||
-rw-r--r-- | src/features/serviceProxy/index.js | 8 |
3 files changed, 18 insertions, 14 deletions
diff --git a/src/features/delayApp/Component.js b/src/features/delayApp/Component.js index 403340c7b..6e0532c9a 100644 --- a/src/features/delayApp/Component.js +++ b/src/features/delayApp/Component.js | |||
@@ -6,7 +6,7 @@ import injectSheet from 'react-jss'; | |||
6 | 6 | ||
7 | import Button from '../../components/ui/Button'; | 7 | import Button from '../../components/ui/Button'; |
8 | 8 | ||
9 | import { config } from './'; | 9 | import { config } from '.'; |
10 | import styles from './styles'; | 10 | import styles from './styles'; |
11 | 11 | ||
12 | const messages = defineMessages({ | 12 | const messages = defineMessages({ |
@@ -38,11 +38,15 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp | |||
38 | countdown: config.delayDuration, | 38 | countdown: config.delayDuration, |
39 | } | 39 | } |
40 | 40 | ||
41 | countdownInterval = null; | ||
42 | |||
43 | countdownIntervalTimeout = 1000; | ||
44 | |||
41 | componentDidMount() { | 45 | componentDidMount() { |
42 | this.countdownInterval = setInterval(() => { | 46 | this.countdownInterval = setInterval(() => { |
43 | this.setState({ | 47 | this.setState(prevState => ({ |
44 | countdown: this.state.countdown - this.countdownIntervalTimeout, | 48 | countdown: prevState.countdown - this.countdownIntervalTimeout, |
45 | }); | 49 | })); |
46 | 50 | ||
47 | if (this.state.countdown <= 0) { | 51 | if (this.state.countdown <= 0) { |
48 | // reload(); | 52 | // reload(); |
@@ -55,9 +59,6 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp | |||
55 | clearInterval(this.countdownInterval); | 59 | clearInterval(this.countdownInterval); |
56 | } | 60 | } |
57 | 61 | ||
58 | countdownInterval = null; | ||
59 | countdownIntervalTimeout = 1000; | ||
60 | |||
61 | render() { | 62 | render() { |
62 | const { classes, actions } = this.props; | 63 | const { classes, actions } = this.props; |
63 | const { intl } = this.context; | 64 | const { intl } = this.context; |
@@ -71,9 +72,11 @@ export default @inject('actions') @injectSheet(styles) @observer class DelayApp | |||
71 | buttonType="inverted" | 72 | buttonType="inverted" |
72 | onClick={() => actions.ui.openSettings({ path: 'user' })} | 73 | onClick={() => actions.ui.openSettings({ path: 'user' })} |
73 | /> | 74 | /> |
74 | <p className="footnote">{intl.formatMessage(messages.text, { | 75 | <p className="footnote"> |
75 | seconds: this.state.countdown / 1000, | 76 | {intl.formatMessage(messages.text, { |
76 | })}</p> | 77 | seconds: this.state.countdown / 1000, |
78 | })} | ||
79 | </p> | ||
77 | </div> | 80 | </div> |
78 | ); | 81 | ); |
79 | } | 82 | } |
diff --git a/src/features/delayApp/index.js b/src/features/delayApp/index.js index 9ffa1d2fd..d5c544b78 100644 --- a/src/features/delayApp/index.js +++ b/src/features/delayApp/index.js | |||
@@ -67,4 +67,3 @@ export default function init(stores) { | |||
67 | } | 67 | } |
68 | 68 | ||
69 | export const Component = DelayAppComponent; | 69 | export const Component = DelayAppComponent; |
70 | |||
diff --git a/src/features/serviceProxy/index.js b/src/features/serviceProxy/index.js index ee0b4e79c..4bea327ad 100644 --- a/src/features/serviceProxy/index.js +++ b/src/features/serviceProxy/index.js | |||
@@ -23,15 +23,18 @@ export default function init(stores) { | |||
23 | 23 | ||
24 | const services = stores.services.enabled; | 24 | const services = stores.services.enabled; |
25 | const isPremiumUser = stores.user.data.isPremium; | 25 | const isPremiumUser = stores.user.data.isPremium; |
26 | const proxySettings = stores.settings.proxy; | ||
27 | |||
28 | debug('Service Proxy autorun'); | ||
26 | 29 | ||
27 | services.forEach((service) => { | 30 | services.forEach((service) => { |
28 | const s = session.fromPartition(`persist:service-${service.id}`); | 31 | const s = session.fromPartition(`persist:service-${service.id}`); |
29 | 32 | ||
30 | if (config.isEnabled && (isPremiumUser || !config.isPremium)) { | 33 | if (config.isEnabled && (isPremiumUser || !config.isPremium)) { |
31 | const serviceProxyConfig = stores.settings.proxy[service.id]; | 34 | const serviceProxyConfig = proxySettings[service.id]; |
32 | 35 | ||
33 | if (serviceProxyConfig && serviceProxyConfig.isEnabled && serviceProxyConfig.host) { | 36 | if (serviceProxyConfig && serviceProxyConfig.isEnabled && serviceProxyConfig.host) { |
34 | const proxyHost = serviceProxyConfig.host; | 37 | const proxyHost = `${serviceProxyConfig.host}${serviceProxyConfig.port ? `:${serviceProxyConfig.port}` : ''}`; |
35 | debug(`Setting proxy config from service settings for "${service.name}" (${service.id}) to`, proxyHost); | 38 | debug(`Setting proxy config from service settings for "${service.name}" (${service.id}) to`, proxyHost); |
36 | 39 | ||
37 | s.setProxy({ proxyRules: proxyHost }, () => { | 40 | s.setProxy({ proxyRules: proxyHost }, () => { |
@@ -42,4 +45,3 @@ export default function init(stores) { | |||
42 | }); | 45 | }); |
43 | }); | 46 | }); |
44 | } | 47 | } |
45 | |||