diff options
author | 2019-10-18 20:53:41 +0200 | |
---|---|---|
committer | 2019-10-18 20:53:41 +0200 | |
commit | af506f40edb1c9c339cc86baf40baccf2dc6da62 (patch) | |
tree | d5efae2f9374ee11d645096208424d59812a9a58 /src/stores | |
parent | Merge branch 'develop' into local-server (diff) | |
download | ferdium-app-af506f40edb1c9c339cc86baf40baccf2dc6da62.tar.gz ferdium-app-af506f40edb1c9c339cc86baf40baccf2dc6da62.tar.zst ferdium-app-af506f40edb1c9c339cc86baf40baccf2dc6da62.zip |
Develop local server feature
Diffstat (limited to 'src/stores')
-rw-r--r-- | src/stores/RequestStore.js | 9 | ||||
-rw-r--r-- | src/stores/SettingsStore.js | 14 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/stores/RequestStore.js b/src/stores/RequestStore.js index 2587d4eef..a92f4c685 100644 --- a/src/stores/RequestStore.js +++ b/src/stores/RequestStore.js | |||
@@ -1,3 +1,4 @@ | |||
1 | import { ipcRenderer } from 'electron'; | ||
1 | import { action, computed, observable } from 'mobx'; | 2 | import { action, computed, observable } from 'mobx'; |
2 | import ms from 'ms'; | 3 | import ms from 'ms'; |
3 | 4 | ||
@@ -12,6 +13,8 @@ export default class RequestStore extends Store { | |||
12 | 13 | ||
13 | @observable showRequiredRequestsError = false; | 14 | @observable showRequiredRequestsError = false; |
14 | 15 | ||
16 | @observable localServerPort = 45569; | ||
17 | |||
15 | retries = 0; | 18 | retries = 0; |
16 | 19 | ||
17 | retryDelay = ms('2s'); | 20 | retryDelay = ms('2s'); |
@@ -29,6 +32,12 @@ export default class RequestStore extends Store { | |||
29 | setup() { | 32 | setup() { |
30 | this.userInfoRequest = this.stores.user.getUserInfoRequest; | 33 | this.userInfoRequest = this.stores.user.getUserInfoRequest; |
31 | this.servicesRequest = this.stores.services.allServicesRequest; | 34 | this.servicesRequest = this.stores.services.allServicesRequest; |
35 | |||
36 | ipcRenderer.on('localServerPort', (event, data) => { | ||
37 | if (data.port) { | ||
38 | this.localServerPort = data.port; | ||
39 | } | ||
40 | }); | ||
32 | } | 41 | } |
33 | 42 | ||
34 | @computed get areRequiredRequestsSuccessful() { | 43 | @computed get areRequiredRequestsSuccessful() { |
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 8c4cd47eb..df0fc77e9 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -9,7 +9,7 @@ import Request from './lib/Request'; | |||
9 | import { getLocale } from '../helpers/i18n-helpers'; | 9 | import { getLocale } from '../helpers/i18n-helpers'; |
10 | import { API } from '../environment'; | 10 | import { API } from '../environment'; |
11 | 11 | ||
12 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES } from '../config'; | 12 | import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES, LOCAL_SERVER } from '../config'; |
13 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 13 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
14 | 14 | ||
15 | const debug = require('debug')('Ferdi:SettingsStore'); | 15 | const debug = require('debug')('Ferdi:SettingsStore'); |
@@ -53,6 +53,18 @@ export default class SettingsStore extends Store { | |||
53 | ); | 53 | ); |
54 | 54 | ||
55 | reaction( | 55 | reaction( |
56 | () => this.all.app.server, | ||
57 | (server) => { | ||
58 | if (server === LOCAL_SERVER) { | ||
59 | ipcRenderer.send('startLocalServer'); | ||
60 | } | ||
61 | }, | ||
62 | { | ||
63 | fireImmediately: true, | ||
64 | }, | ||
65 | ); | ||
66 | |||
67 | reaction( | ||
56 | () => this.all.app.locked, | 68 | () => this.all.app.locked, |
57 | () => { | 69 | () => { |
58 | const { router } = window.ferdi.stores; | 70 | const { router } = window.ferdi.stores; |