aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <properly@protonmail.com>2019-08-22 11:04:50 +0200
committerLibravatar vantezzen <properly@protonmail.com>2019-08-22 11:04:50 +0200
commit8440d51cef61297eb34a193d6a3ad420a0947340 (patch)
treec92b9f96dbcc570ddcfbd595c9dca97421b74ea9
parentAdd development info to README (diff)
downloadferdium-app-8440d51cef61297eb34a193d6a3ad420a0947340.tar.gz
ferdium-app-8440d51cef61297eb34a193d6a3ad420a0947340.tar.zst
ferdium-app-8440d51cef61297eb34a193d6a3ad420a0947340.zip
Add support to use custom servers
-rw-r--r--src/api/server/ServerApi.js72
-rw-r--r--src/app.js7
-rw-r--r--src/components/settings/navigation/SettingsNavigation.js5
-rw-r--r--src/components/settings/settings/EditSettingsForm.js7
-rw-r--r--src/containers/settings/EditSettingsScreen.js8
-rw-r--r--src/i18n/messages/src/components/settings/settings/EditSettingsForm.json72
-rw-r--r--src/i18n/messages/src/containers/settings/EditSettingsScreen.json48
-rw-r--r--src/stores/SettingsStore.js2
-rw-r--r--src/stores/UserStore.js2
9 files changed, 133 insertions, 90 deletions
diff --git a/src/api/server/ServerApi.js b/src/api/server/ServerApi.js
index a9ce202ff..069994028 100644
--- a/src/api/server/ServerApi.js
+++ b/src/api/server/ServerApi.js
@@ -46,9 +46,31 @@ export default class ServerApi {
46 46
47 recipes = []; 47 recipes = [];
48 48
49 stores = {};
50
51 setStores(stores) {
52 this.stores = stores;
53 }
54
55 apiUrl() {
56 let url;
57 if (!this.stores.settings) {
58 // Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded
59 url = 'https://localhost:9999'
60 } else if (this.stores.settings.all.app.server) {
61 // Load URL from store
62 url = this.stores.settings.all.app.server;
63 } else {
64 // Use default server url
65 url = SERVER_URL;
66 }
67
68 return `${url}/${API_VERSION}`;
69 }
70
49 // User 71 // User
50 async login(email, passwordHash) { 72 async login(email, passwordHash) {
51 const request = await sendAuthRequest(`${API_URL}/auth/login`, { 73 const request = await sendAuthRequest(`${this.apiUrl()}/auth/login`, {
52 method: 'POST', 74 method: 'POST',
53 headers: { 75 headers: {
54 Authorization: `Basic ${window.btoa(`${email}:${passwordHash}`)}`, 76 Authorization: `Basic ${window.btoa(`${email}:${passwordHash}`)}`,
@@ -64,7 +86,7 @@ export default class ServerApi {
64 } 86 }
65 87
66 async signup(data) { 88 async signup(data) {
67 const request = await sendAuthRequest(`${API_URL}/auth/signup`, { 89 const request = await sendAuthRequest(`${this.apiUrl()}/auth/signup`, {
68 method: 'POST', 90 method: 'POST',
69 body: JSON.stringify(data), 91 body: JSON.stringify(data),
70 }, false); 92 }, false);
@@ -78,7 +100,7 @@ export default class ServerApi {
78 } 100 }
79 101
80 async inviteUser(data) { 102 async inviteUser(data) {
81 const request = await sendAuthRequest(`${API_URL}/invite`, { 103 const request = await sendAuthRequest(`${this.apiUrl()}/invite`, {
82 method: 'POST', 104 method: 'POST',
83 body: JSON.stringify(data), 105 body: JSON.stringify(data),
84 }); 106 });
@@ -91,7 +113,7 @@ export default class ServerApi {
91 } 113 }
92 114
93 async retrievePassword(email) { 115 async retrievePassword(email) {
94 const request = await sendAuthRequest(`${API_URL}/auth/password`, { 116 const request = await sendAuthRequest(`${this.apiUrl()}/auth/password`, {
95 method: 'POST', 117 method: 'POST',
96 body: JSON.stringify({ 118 body: JSON.stringify({
97 email, 119 email,
@@ -107,7 +129,7 @@ export default class ServerApi {
107 } 129 }
108 130
109 async userInfo() { 131 async userInfo() {
110 const request = await sendAuthRequest(`${API_URL}/me`); 132 const request = await sendAuthRequest(`${this.apiUrl()}/me`);
111 if (!request.ok) { 133 if (!request.ok) {
112 throw request; 134 throw request;
113 } 135 }
@@ -120,7 +142,7 @@ export default class ServerApi {
120 } 142 }
121 143
122 async updateUserInfo(data) { 144 async updateUserInfo(data) {
123 const request = await sendAuthRequest(`${API_URL}/me`, { 145 const request = await sendAuthRequest(`${this.apiUrl()}/me`, {
124 method: 'PUT', 146 method: 'PUT',
125 body: JSON.stringify(data), 147 body: JSON.stringify(data),
126 }); 148 });
@@ -135,7 +157,7 @@ export default class ServerApi {
135 } 157 }
136 158
137 async deleteAccount() { 159 async deleteAccount() {
138 const request = await sendAuthRequest(`${API_URL}/me`, { 160 const request = await sendAuthRequest(`${this.apiUrl()}/me`, {
139 method: 'DELETE', 161 method: 'DELETE',
140 }); 162 });
141 if (!request.ok) { 163 if (!request.ok) {
@@ -149,7 +171,7 @@ export default class ServerApi {
149 171
150 // Services 172 // Services
151 async getServices() { 173 async getServices() {
152 const request = await sendAuthRequest(`${API_URL}/me/services`); 174 const request = await sendAuthRequest(`${this.apiUrl()}/me/services`);
153 if (!request.ok) { 175 if (!request.ok) {
154 throw request; 176 throw request;
155 } 177 }
@@ -162,7 +184,7 @@ export default class ServerApi {
162 } 184 }
163 185
164 async createService(recipeId, data) { 186 async createService(recipeId, data) {
165 const request = await sendAuthRequest(`${API_URL}/service`, { 187 const request = await sendAuthRequest(`${this.apiUrl()}/service`, {
166 method: 'POST', 188 method: 'POST',
167 body: JSON.stringify(Object.assign({ 189 body: JSON.stringify(Object.assign({
168 recipeId, 190 recipeId,
@@ -192,7 +214,7 @@ export default class ServerApi {
192 await this.uploadServiceIcon(serviceId, data.iconFile); 214 await this.uploadServiceIcon(serviceId, data.iconFile);
193 } 215 }
194 216
195 const request = await sendAuthRequest(`${API_URL}/service/${serviceId}`, { 217 const request = await sendAuthRequest(`${this.apiUrl()}/service/${serviceId}`, {
196 method: 'PUT', 218 method: 'PUT',
197 body: JSON.stringify(data), 219 body: JSON.stringify(data),
198 }); 220 });
@@ -220,7 +242,7 @@ export default class ServerApi {
220 242
221 delete requestData.headers['Content-Type']; 243 delete requestData.headers['Content-Type'];
222 244
223 const request = await window.fetch(`${API_URL}/service/${serviceId}`, requestData); 245 const request = await window.fetch(`${this.apiUrl()}/service/${serviceId}`, requestData);
224 246
225 if (!request.ok) { 247 if (!request.ok) {
226 throw request; 248 throw request;
@@ -232,7 +254,7 @@ export default class ServerApi {
232 } 254 }
233 255
234 async reorderService(data) { 256 async reorderService(data) {
235 const request = await sendAuthRequest(`${API_URL}/service/reorder`, { 257 const request = await sendAuthRequest(`${this.apiUrl()}/service/reorder`, {
236 method: 'PUT', 258 method: 'PUT',
237 body: JSON.stringify(data), 259 body: JSON.stringify(data),
238 }); 260 });
@@ -245,7 +267,7 @@ export default class ServerApi {
245 } 267 }
246 268
247 async deleteService(id) { 269 async deleteService(id) {
248 const request = await sendAuthRequest(`${API_URL}/service/${id}`, { 270 const request = await sendAuthRequest(`${this.apiUrl()}/service/${id}`, {
249 method: 'DELETE', 271 method: 'DELETE',
250 }); 272 });
251 if (!request.ok) { 273 if (!request.ok) {
@@ -261,7 +283,7 @@ export default class ServerApi {
261 283
262 // Features 284 // Features
263 async getDefaultFeatures() { 285 async getDefaultFeatures() {
264 const request = await sendAuthRequest(`${API_URL}/features/default`); 286 const request = await sendAuthRequest(`${this.apiUrl()}/features/default`);
265 if (!request.ok) { 287 if (!request.ok) {
266 throw request; 288 throw request;
267 } 289 }
@@ -273,7 +295,7 @@ export default class ServerApi {
273 } 295 }
274 296
275 async getFeatures() { 297 async getFeatures() {
276 const request = await sendAuthRequest(`${API_URL}/features`); 298 const request = await sendAuthRequest(`${this.apiUrl()}/features`);
277 if (!request.ok) { 299 if (!request.ok) {
278 throw request; 300 throw request;
279 } 301 }
@@ -307,7 +329,7 @@ export default class ServerApi {
307 } 329 }
308 330
309 async getRecipeUpdates(recipeVersions) { 331 async getRecipeUpdates(recipeVersions) {
310 const request = await sendAuthRequest(`${API_URL}/recipes/update`, { 332 const request = await sendAuthRequest(`${this.apiUrl()}/recipes/update`, {
311 method: 'POST', 333 method: 'POST',
312 body: JSON.stringify(recipeVersions), 334 body: JSON.stringify(recipeVersions),
313 }); 335 });
@@ -321,7 +343,7 @@ export default class ServerApi {
321 343
322 // Recipes Previews 344 // Recipes Previews
323 async getRecipePreviews() { 345 async getRecipePreviews() {
324 const request = await sendAuthRequest(`${API_URL}/recipes`); 346 const request = await sendAuthRequest(`${this.apiUrl()}/recipes`);
325 if (!request.ok) throw request; 347 if (!request.ok) throw request;
326 const data = await request.json(); 348 const data = await request.json();
327 const recipePreviews = this._mapRecipePreviewModel(data); 349 const recipePreviews = this._mapRecipePreviewModel(data);
@@ -330,7 +352,7 @@ export default class ServerApi {
330 } 352 }
331 353
332 async getFeaturedRecipePreviews() { 354 async getFeaturedRecipePreviews() {
333 const request = await sendAuthRequest(`${API_URL}/recipes/popular`); 355 const request = await sendAuthRequest(`${this.apiUrl()}/recipes/popular`);
334 if (!request.ok) throw request; 356 if (!request.ok) throw request;
335 357
336 const data = await request.json(); 358 const data = await request.json();
@@ -342,7 +364,7 @@ export default class ServerApi {
342 } 364 }
343 365
344 async searchRecipePreviews(needle) { 366 async searchRecipePreviews(needle) {
345 const url = `${API_URL}/recipes/search?needle=${needle}`; 367 const url = `${this.apiUrl()}/recipes/search?needle=${needle}`;
346 const request = await sendAuthRequest(url); 368 const request = await sendAuthRequest(url);
347 if (!request.ok) throw request; 369 if (!request.ok) throw request;
348 370
@@ -357,7 +379,7 @@ export default class ServerApi {
357 const recipesDirectory = path.join(app.getPath('userData'), 'recipes'); 379 const recipesDirectory = path.join(app.getPath('userData'), 'recipes');
358 const recipeTempDirectory = path.join(recipesDirectory, 'temp', recipeId); 380 const recipeTempDirectory = path.join(recipesDirectory, 'temp', recipeId);
359 const archivePath = path.join(recipeTempDirectory, 'recipe.tar.gz'); 381 const archivePath = path.join(recipeTempDirectory, 'recipe.tar.gz');
360 const packageUrl = `${API_URL}/recipes/download/${recipeId}`; 382 const packageUrl = `${this.apiUrl()}/recipes/download/${recipeId}`;
361 383
362 fs.ensureDirSync(recipeTempDirectory); 384 fs.ensureDirSync(recipeTempDirectory);
363 const res = await fetch(packageUrl); 385 const res = await fetch(packageUrl);
@@ -394,7 +416,7 @@ export default class ServerApi {
394 416
395 // Payment 417 // Payment
396 async getPlans() { 418 async getPlans() {
397 const request = await sendAuthRequest(`${API_URL}/payment/plans`); 419 const request = await sendAuthRequest(`${this.apiUrl()}/payment/plans`);
398 if (!request.ok) throw request; 420 if (!request.ok) throw request;
399 const data = await request.json(); 421 const data = await request.json();
400 const plan = new PlanModel(data); 422 const plan = new PlanModel(data);
@@ -403,7 +425,7 @@ export default class ServerApi {
403 } 425 }
404 426
405 async getHostedPage(planId) { 427 async getHostedPage(planId) {
406 const request = await sendAuthRequest(`${API_URL}/payment/init`, { 428 const request = await sendAuthRequest(`${this.apiUrl()}/payment/init`, {
407 method: 'POST', 429 method: 'POST',
408 body: JSON.stringify({ 430 body: JSON.stringify({
409 planId, 431 planId,
@@ -420,7 +442,7 @@ export default class ServerApi {
420 442
421 // News 443 // News
422 async getLatestNews() { 444 async getLatestNews() {
423 const url = `${API_URL}/news?platform=${os.platform()}&arch=${os.arch()}&version=${app.getVersion()}`; 445 const url = `${this.apiUrl()}/news?platform=${os.platform()}&arch=${os.arch()}&version=${app.getVersion()}`;
424 const request = await sendAuthRequest(url); 446 const request = await sendAuthRequest(url);
425 if (!request.ok) throw request; 447 if (!request.ok) throw request;
426 const data = await request.json(); 448 const data = await request.json();
@@ -430,7 +452,7 @@ export default class ServerApi {
430 } 452 }
431 453
432 async hideNews(id) { 454 async hideNews(id) {
433 const request = await sendAuthRequest(`${API_URL}/news/${id}/read`); 455 const request = await sendAuthRequest(`${this.apiUrl()}/news/${id}/read`);
434 if (!request.ok) throw request; 456 if (!request.ok) throw request;
435 debug('ServerApi::hideNews resolves', id); 457 debug('ServerApi::hideNews resolves', id);
436 } 458 }
@@ -455,7 +477,7 @@ export default class ServerApi {
455 if (Object.prototype.hasOwnProperty.call(config, 'services')) { 477 if (Object.prototype.hasOwnProperty.call(config, 'services')) {
456 const services = await Promise.all(config.services.map(async (s) => { 478 const services = await Promise.all(config.services.map(async (s) => {
457 const service = s; 479 const service = s;
458 const request = await sendAuthRequest(`${API_URL}/recipes/${s.service}`); 480 const request = await sendAuthRequest(`${this.apiUrl()}/recipes/${s.service}`);
459 481
460 if (request.status === 200) { 482 if (request.status === 200) {
461 const data = await request.json(); 483 const data = await request.json();
diff --git a/src/app.js b/src/app.js
index 0138bc84d..ccf13b555 100644
--- a/src/app.js
+++ b/src/app.js
@@ -53,13 +53,16 @@ webFrame.setVisualZoomLevelLimits(1, 1);
53webFrame.setLayoutZoomLevelLimits(0, 0); 53webFrame.setLayoutZoomLevelLimits(0, 0);
54 54
55window.addEventListener('load', () => { 55window.addEventListener('load', () => {
56 const api = apiFactory(new ServerApi(), new LocalApi()); 56 const serverApi = new ServerApi();
57 const api = apiFactory(serverApi, new LocalApi());
57 const router = new RouterStore(); 58 const router = new RouterStore();
58 const history = syncHistoryWithStore(hashHistory, router);
59 const stores = storeFactory(api, actions, router); 59 const stores = storeFactory(api, actions, router);
60 serverApi.setStores(stores);
61 const history = syncHistoryWithStore(hashHistory, router);
60 const menu = new MenuFactory(stores, actions); 62 const menu = new MenuFactory(stores, actions);
61 const touchBar = new TouchBarFactory(stores, actions); 63 const touchBar = new TouchBarFactory(stores, actions);
62 64
65
63 window.ferdi = { 66 window.ferdi = {
64 stores, 67 stores,
65 actions, 68 actions,
diff --git a/src/components/settings/navigation/SettingsNavigation.js b/src/components/settings/navigation/SettingsNavigation.js
index df4b3b3b2..e1c5cabc3 100644
--- a/src/components/settings/navigation/SettingsNavigation.js
+++ b/src/components/settings/navigation/SettingsNavigation.js
@@ -63,6 +63,7 @@ export default @inject('stores') @observer class SettingsNavigation extends Comp
63 const { isDarkThemeActive } = stores.ui; 63 const { isDarkThemeActive } = stores.ui;
64 const { router, user } = stores; 64 const { router, user } = stores;
65 const { intl } = this.context; 65 const { intl } = this.context;
66 const isLoggedIn = Boolean(localStorage.getItem('authToken'));
66 67
67 return ( 68 return (
68 <div className="settings-navigation"> 69 <div className="settings-navigation">
@@ -130,10 +131,10 @@ export default @inject('stores') @observer class SettingsNavigation extends Comp
130 </Link> 131 </Link>
131 <span className="settings-navigation__expander" /> 132 <span className="settings-navigation__expander" />
132 <Link 133 <Link
133 to="/auth/logout" 134 to={ isLoggedIn ? "/auth/logout" : '/auth/welcome'}
134 className="settings-navigation__link" 135 className="settings-navigation__link"
135 > 136 >
136 {intl.formatMessage(messages.logout)} 137 { isLoggedIn ? intl.formatMessage(messages.logout) : 'Login'}
137 </Link> 138 </Link>
138 </div> 139 </div>
139 ); 140 );
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index ab93188cf..de324b115 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -9,6 +9,7 @@ import Button from '../../ui/Button';
9import Toggle from '../../ui/Toggle'; 9import Toggle from '../../ui/Toggle';
10import Select from '../../ui/Select'; 10import Select from '../../ui/Select';
11import PremiumFeatureContainer from '../../ui/PremiumFeatureContainer'; 11import PremiumFeatureContainer from '../../ui/PremiumFeatureContainer';
12import Input from '../../ui/Input';
12 13
13import { FRANZ_TRANSLATION } from '../../../config'; 14import { FRANZ_TRANSLATION } from '../../../config';
14 15
@@ -162,6 +163,12 @@ export default @observer class EditSettingsForm extends Component {
162 {process.platform === 'win32' && ( 163 {process.platform === 'win32' && (
163 <Toggle field={form.$('minimizeToSystemTray')} /> 164 <Toggle field={form.$('minimizeToSystemTray')} />
164 )} 165 )}
166 <Input
167 placeholder="Server"
168 onChange={e => this.submit(e)}
169 field={form.$('server')}
170 autoFocus
171 />
165 172
166 {/* Appearance */} 173 {/* Appearance */}
167 <h2 id="apperance">{intl.formatMessage(messages.headlineAppearance)}</h2> 174 <h2 id="apperance">{intl.formatMessage(messages.headlineAppearance)}</h2>
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 2b9626952..8059ee22d 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -16,6 +16,8 @@ import { getSelectOptions } from '../../helpers/i18n-helpers';
16import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; 16import EditSettingsForm from '../../components/settings/settings/EditSettingsForm';
17import ErrorBoundary from '../../components/util/ErrorBoundary'; 17import ErrorBoundary from '../../components/util/ErrorBoundary';
18 18
19import { API } from '../../environment';
20
19import globalMessages from '../../i18n/globalMessages'; 21import globalMessages from '../../i18n/globalMessages';
20 22
21const messages = defineMessages({ 23const messages = defineMessages({
@@ -88,6 +90,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
88 runInBackground: settingsData.runInBackground, 90 runInBackground: settingsData.runInBackground,
89 enableSystemTray: settingsData.enableSystemTray, 91 enableSystemTray: settingsData.enableSystemTray,
90 minimizeToSystemTray: settingsData.minimizeToSystemTray, 92 minimizeToSystemTray: settingsData.minimizeToSystemTray,
93 server: settingsData.server,
91 enableGPUAcceleration: settingsData.enableGPUAcceleration, 94 enableGPUAcceleration: settingsData.enableGPUAcceleration,
92 showDisabledServices: settingsData.showDisabledServices, 95 showDisabledServices: settingsData.showDisabledServices,
93 darkMode: settingsData.darkMode, 96 darkMode: settingsData.darkMode,
@@ -147,6 +150,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
147 value: settings.all.app.minimizeToSystemTray, 150 value: settings.all.app.minimizeToSystemTray,
148 default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, 151 default: DEFAULT_APP_SETTINGS.minimizeToSystemTray,
149 }, 152 },
153 server: {
154 label: 'Server',
155 value: settings.all.app.server || API,
156 default: API
157 },
150 showDisabledServices: { 158 showDisabledServices: {
151 label: intl.formatMessage(messages.showDisabledServices), 159 label: intl.formatMessage(messages.showDisabledServices),
152 value: settings.all.app.showDisabledServices, 160 value: settings.all.app.showDisabledServices,
diff --git a/src/i18n/messages/src/components/settings/settings/EditSettingsForm.json b/src/i18n/messages/src/components/settings/settings/EditSettingsForm.json
index 81f50f49d..6bdd5852a 100644
--- a/src/i18n/messages/src/components/settings/settings/EditSettingsForm.json
+++ b/src/i18n/messages/src/components/settings/settings/EditSettingsForm.json
@@ -4,11 +4,11 @@
4 "defaultMessage": "!!!Settings", 4 "defaultMessage": "!!!Settings",
5 "file": "src/components/settings/settings/EditSettingsForm.js", 5 "file": "src/components/settings/settings/EditSettingsForm.js",
6 "start": { 6 "start": {
7 "line": 16, 7 "line": 17,
8 "column": 12 8 "column": 12
9 }, 9 },
10 "end": { 10 "end": {
11 "line": 19, 11 "line": 20,
12 "column": 3 12 "column": 3
13 } 13 }
14 }, 14 },
@@ -17,11 +17,11 @@
17 "defaultMessage": "!!!General", 17 "defaultMessage": "!!!General",
18 "file": "src/components/settings/settings/EditSettingsForm.js", 18 "file": "src/components/settings/settings/EditSettingsForm.js",
19 "start": { 19 "start": {
20 "line": 20, 20 "line": 21,
21 "column": 19 21 "column": 19
22 }, 22 },
23 "end": { 23 "end": {
24 "line": 23, 24 "line": 24,
25 "column": 3 25 "column": 3
26 } 26 }
27 }, 27 },
@@ -30,11 +30,11 @@
30 "defaultMessage": "!!!Language", 30 "defaultMessage": "!!!Language",
31 "file": "src/components/settings/settings/EditSettingsForm.js", 31 "file": "src/components/settings/settings/EditSettingsForm.js",
32 "start": { 32 "start": {
33 "line": 24, 33 "line": 25,
34 "column": 20 34 "column": 20
35 }, 35 },
36 "end": { 36 "end": {
37 "line": 27, 37 "line": 28,
38 "column": 3 38 "column": 3
39 } 39 }
40 }, 40 },
@@ -43,11 +43,11 @@
43 "defaultMessage": "!!!Updates", 43 "defaultMessage": "!!!Updates",
44 "file": "src/components/settings/settings/EditSettingsForm.js", 44 "file": "src/components/settings/settings/EditSettingsForm.js",
45 "start": { 45 "start": {
46 "line": 28, 46 "line": 29,
47 "column": 19 47 "column": 19
48 }, 48 },
49 "end": { 49 "end": {
50 "line": 31, 50 "line": 32,
51 "column": 3 51 "column": 3
52 } 52 }
53 }, 53 },
@@ -56,11 +56,11 @@
56 "defaultMessage": "!!!Appearance", 56 "defaultMessage": "!!!Appearance",
57 "file": "src/components/settings/settings/EditSettingsForm.js", 57 "file": "src/components/settings/settings/EditSettingsForm.js",
58 "start": { 58 "start": {
59 "line": 32, 59 "line": 33,
60 "column": 22 60 "column": 22
61 }, 61 },
62 "end": { 62 "end": {
63 "line": 35, 63 "line": 36,
64 "column": 3 64 "column": 3
65 } 65 }
66 }, 66 },
@@ -69,11 +69,11 @@
69 "defaultMessage": "!!!Advanced", 69 "defaultMessage": "!!!Advanced",
70 "file": "src/components/settings/settings/EditSettingsForm.js", 70 "file": "src/components/settings/settings/EditSettingsForm.js",
71 "start": { 71 "start": {
72 "line": 36, 72 "line": 37,
73 "column": 20 73 "column": 20
74 }, 74 },
75 "end": { 75 "end": {
76 "line": 39, 76 "line": 40,
77 "column": 3 77 "column": 3
78 } 78 }
79 }, 79 },
@@ -82,11 +82,11 @@
82 "defaultMessage": "!!!Help us to translate Ferdi into your language.", 82 "defaultMessage": "!!!Help us to translate Ferdi into your language.",
83 "file": "src/components/settings/settings/EditSettingsForm.js", 83 "file": "src/components/settings/settings/EditSettingsForm.js",
84 "start": { 84 "start": {
85 "line": 40, 85 "line": 41,
86 "column": 19 86 "column": 19
87 }, 87 },
88 "end": { 88 "end": {
89 "line": 43, 89 "line": 44,
90 "column": 3 90 "column": 3
91 } 91 }
92 }, 92 },
@@ -95,11 +95,11 @@
95 "defaultMessage": "!!!Cache", 95 "defaultMessage": "!!!Cache",
96 "file": "src/components/settings/settings/EditSettingsForm.js", 96 "file": "src/components/settings/settings/EditSettingsForm.js",
97 "start": { 97 "start": {
98 "line": 44, 98 "line": 45,
99 "column": 20 99 "column": 20
100 }, 100 },
101 "end": { 101 "end": {
102 "line": 47, 102 "line": 48,
103 "column": 3 103 "column": 3
104 } 104 }
105 }, 105 },
@@ -108,11 +108,11 @@
108 "defaultMessage": "!!!Ferdi cache is currently using {size} of disk space.", 108 "defaultMessage": "!!!Ferdi cache is currently using {size} of disk space.",
109 "file": "src/components/settings/settings/EditSettingsForm.js", 109 "file": "src/components/settings/settings/EditSettingsForm.js",
110 "start": { 110 "start": {
111 "line": 48, 111 "line": 49,
112 "column": 13 112 "column": 13
113 }, 113 },
114 "end": { 114 "end": {
115 "line": 51, 115 "line": 52,
116 "column": 3 116 "column": 3
117 } 117 }
118 }, 118 },
@@ -121,11 +121,11 @@
121 "defaultMessage": "!!!Clear cache", 121 "defaultMessage": "!!!Clear cache",
122 "file": "src/components/settings/settings/EditSettingsForm.js", 122 "file": "src/components/settings/settings/EditSettingsForm.js",
123 "start": { 123 "start": {
124 "line": 52, 124 "line": 53,
125 "column": 23 125 "column": 23
126 }, 126 },
127 "end": { 127 "end": {
128 "line": 55, 128 "line": 56,
129 "column": 3 129 "column": 3
130 } 130 }
131 }, 131 },
@@ -134,11 +134,11 @@
134 "defaultMessage": "!!!Check for updates", 134 "defaultMessage": "!!!Check for updates",
135 "file": "src/components/settings/settings/EditSettingsForm.js", 135 "file": "src/components/settings/settings/EditSettingsForm.js",
136 "start": { 136 "start": {
137 "line": 56, 137 "line": 57,
138 "column": 25 138 "column": 25
139 }, 139 },
140 "end": { 140 "end": {
141 "line": 59, 141 "line": 60,
142 "column": 3 142 "column": 3
143 } 143 }
144 }, 144 },
@@ -147,11 +147,11 @@
147 "defaultMessage": "!!!Restart & install update", 147 "defaultMessage": "!!!Restart & install update",
148 "file": "src/components/settings/settings/EditSettingsForm.js", 148 "file": "src/components/settings/settings/EditSettingsForm.js",
149 "start": { 149 "start": {
150 "line": 60, 150 "line": 61,
151 "column": 23 151 "column": 23
152 }, 152 },
153 "end": { 153 "end": {
154 "line": 63, 154 "line": 64,
155 "column": 3 155 "column": 3
156 } 156 }
157 }, 157 },
@@ -160,11 +160,11 @@
160 "defaultMessage": "!!!Is searching for update", 160 "defaultMessage": "!!!Is searching for update",
161 "file": "src/components/settings/settings/EditSettingsForm.js", 161 "file": "src/components/settings/settings/EditSettingsForm.js",
162 "start": { 162 "start": {
163 "line": 64, 163 "line": 65,
164 "column": 25 164 "column": 25
165 }, 165 },
166 "end": { 166 "end": {
167 "line": 67, 167 "line": 68,
168 "column": 3 168 "column": 3
169 } 169 }
170 }, 170 },
@@ -173,11 +173,11 @@
173 "defaultMessage": "!!!Update available, downloading...", 173 "defaultMessage": "!!!Update available, downloading...",
174 "file": "src/components/settings/settings/EditSettingsForm.js", 174 "file": "src/components/settings/settings/EditSettingsForm.js",
175 "start": { 175 "start": {
176 "line": 68, 176 "line": 69,
177 "column": 25 177 "column": 25
178 }, 178 },
179 "end": { 179 "end": {
180 "line": 71, 180 "line": 72,
181 "column": 3 181 "column": 3
182 } 182 }
183 }, 183 },
@@ -186,11 +186,11 @@
186 "defaultMessage": "!!!You are using the latest version of Franz", 186 "defaultMessage": "!!!You are using the latest version of Franz",
187 "file": "src/components/settings/settings/EditSettingsForm.js", 187 "file": "src/components/settings/settings/EditSettingsForm.js",
188 "start": { 188 "start": {
189 "line": 72, 189 "line": 73,
190 "column": 24 190 "column": 24
191 }, 191 },
192 "end": { 192 "end": {
193 "line": 75, 193 "line": 76,
194 "column": 3 194 "column": 3
195 } 195 }
196 }, 196 },
@@ -199,11 +199,11 @@
199 "defaultMessage": "!!!Current version:", 199 "defaultMessage": "!!!Current version:",
200 "file": "src/components/settings/settings/EditSettingsForm.js", 200 "file": "src/components/settings/settings/EditSettingsForm.js",
201 "start": { 201 "start": {
202 "line": 76, 202 "line": 77,
203 "column": 18 203 "column": 18
204 }, 204 },
205 "end": { 205 "end": {
206 "line": 79, 206 "line": 80,
207 "column": 3 207 "column": 3
208 } 208 }
209 }, 209 },
@@ -212,11 +212,11 @@
212 "defaultMessage": "!!!Changes require restart", 212 "defaultMessage": "!!!Changes require restart",
213 "file": "src/components/settings/settings/EditSettingsForm.js", 213 "file": "src/components/settings/settings/EditSettingsForm.js",
214 "start": { 214 "start": {
215 "line": 80, 215 "line": 81,
216 "column": 29 216 "column": 29
217 }, 217 },
218 "end": { 218 "end": {
219 "line": 83, 219 "line": 84,
220 "column": 3 220 "column": 3
221 } 221 }
222 }, 222 },
@@ -225,11 +225,11 @@
225 "defaultMessage": "!!!Official translations are English & German. All other languages are community based translations.", 225 "defaultMessage": "!!!Official translations are English & German. All other languages are community based translations.",
226 "file": "src/components/settings/settings/EditSettingsForm.js", 226 "file": "src/components/settings/settings/EditSettingsForm.js",
227 "start": { 227 "start": {
228 "line": 84, 228 "line": 85,
229 "column": 22 229 "column": 22
230 }, 230 },
231 "end": { 231 "end": {
232 "line": 87, 232 "line": 88,
233 "column": 3 233 "column": 3
234 } 234 }
235 } 235 }
diff --git a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
index 14180e63f..b979b625c 100644
--- a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
+++ b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
@@ -4,11 +4,11 @@
4 "defaultMessage": "!!!Launch Ferdi on start", 4 "defaultMessage": "!!!Launch Ferdi on start",
5 "file": "src/containers/settings/EditSettingsScreen.js", 5 "file": "src/containers/settings/EditSettingsScreen.js",
6 "start": { 6 "start": {
7 "line": 22, 7 "line": 24,
8 "column": 21 8 "column": 21
9 }, 9 },
10 "end": { 10 "end": {
11 "line": 25, 11 "line": 27,
12 "column": 3 12 "column": 3
13 } 13 }
14 }, 14 },
@@ -17,11 +17,11 @@
17 "defaultMessage": "!!!Open in background", 17 "defaultMessage": "!!!Open in background",
18 "file": "src/containers/settings/EditSettingsScreen.js", 18 "file": "src/containers/settings/EditSettingsScreen.js",
19 "start": { 19 "start": {
20 "line": 26, 20 "line": 28,
21 "column": 26 21 "column": 26
22 }, 22 },
23 "end": { 23 "end": {
24 "line": 29, 24 "line": 31,
25 "column": 3 25 "column": 3
26 } 26 }
27 }, 27 },
@@ -30,11 +30,11 @@
30 "defaultMessage": "!!!Keep Ferdi in background when closing the window", 30 "defaultMessage": "!!!Keep Ferdi in background when closing the window",
31 "file": "src/containers/settings/EditSettingsScreen.js", 31 "file": "src/containers/settings/EditSettingsScreen.js",
32 "start": { 32 "start": {
33 "line": 30, 33 "line": 32,
34 "column": 19 34 "column": 19
35 }, 35 },
36 "end": { 36 "end": {
37 "line": 33, 37 "line": 35,
38 "column": 3 38 "column": 3
39 } 39 }
40 }, 40 },
@@ -43,11 +43,11 @@
43 "defaultMessage": "!!!Show Ferdi in system tray", 43 "defaultMessage": "!!!Show Ferdi in system tray",
44 "file": "src/containers/settings/EditSettingsScreen.js", 44 "file": "src/containers/settings/EditSettingsScreen.js",
45 "start": { 45 "start": {
46 "line": 34, 46 "line": 36,
47 "column": 20 47 "column": 20
48 }, 48 },
49 "end": { 49 "end": {
50 "line": 37, 50 "line": 39,
51 "column": 3 51 "column": 3
52 } 52 }
53 }, 53 },
@@ -56,11 +56,11 @@
56 "defaultMessage": "!!!Minimize Ferdi to system tray", 56 "defaultMessage": "!!!Minimize Ferdi to system tray",
57 "file": "src/containers/settings/EditSettingsScreen.js", 57 "file": "src/containers/settings/EditSettingsScreen.js",
58 "start": { 58 "start": {
59 "line": 38, 59 "line": 40,
60 "column": 24 60 "column": 24
61 }, 61 },
62 "end": { 62 "end": {
63 "line": 41, 63 "line": 43,
64 "column": 3 64 "column": 3
65 } 65 }
66 }, 66 },
@@ -69,11 +69,11 @@
69 "defaultMessage": "!!!Language", 69 "defaultMessage": "!!!Language",
70 "file": "src/containers/settings/EditSettingsScreen.js", 70 "file": "src/containers/settings/EditSettingsScreen.js",
71 "start": { 71 "start": {
72 "line": 42, 72 "line": 44,
73 "column": 12 73 "column": 12
74 }, 74 },
75 "end": { 75 "end": {
76 "line": 45, 76 "line": 47,
77 "column": 3 77 "column": 3
78 } 78 }
79 }, 79 },
@@ -82,11 +82,11 @@
82 "defaultMessage": "!!!Dark Mode", 82 "defaultMessage": "!!!Dark Mode",
83 "file": "src/containers/settings/EditSettingsScreen.js", 83 "file": "src/containers/settings/EditSettingsScreen.js",
84 "start": { 84 "start": {
85 "line": 46, 85 "line": 48,
86 "column": 12 86 "column": 12
87 }, 87 },
88 "end": { 88 "end": {
89 "line": 49, 89 "line": 51,
90 "column": 3 90 "column": 3
91 } 91 }
92 }, 92 },
@@ -95,11 +95,11 @@
95 "defaultMessage": "!!!Display disabled services tabs", 95 "defaultMessage": "!!!Display disabled services tabs",
96 "file": "src/containers/settings/EditSettingsScreen.js", 96 "file": "src/containers/settings/EditSettingsScreen.js",
97 "start": { 97 "start": {
98 "line": 50, 98 "line": 52,
99 "column": 24 99 "column": 24
100 }, 100 },
101 "end": { 101 "end": {
102 "line": 53, 102 "line": 55,
103 "column": 3 103 "column": 3
104 } 104 }
105 }, 105 },
@@ -108,11 +108,11 @@
108 "defaultMessage": "!!!Show unread message badge when notifications are disabled", 108 "defaultMessage": "!!!Show unread message badge when notifications are disabled",
109 "file": "src/containers/settings/EditSettingsScreen.js", 109 "file": "src/containers/settings/EditSettingsScreen.js",
110 "start": { 110 "start": {
111 "line": 54, 111 "line": 56,
112 "column": 29 112 "column": 29
113 }, 113 },
114 "end": { 114 "end": {
115 "line": 57, 115 "line": 59,
116 "column": 3 116 "column": 3
117 } 117 }
118 }, 118 },
@@ -121,11 +121,11 @@
121 "defaultMessage": "!!!Enable spell checking", 121 "defaultMessage": "!!!Enable spell checking",
122 "file": "src/containers/settings/EditSettingsScreen.js", 122 "file": "src/containers/settings/EditSettingsScreen.js",
123 "start": { 123 "start": {
124 "line": 58, 124 "line": 60,
125 "column": 23 125 "column": 23
126 }, 126 },
127 "end": { 127 "end": {
128 "line": 61, 128 "line": 63,
129 "column": 3 129 "column": 3
130 } 130 }
131 }, 131 },
@@ -134,11 +134,11 @@
134 "defaultMessage": "!!!Enable GPU Acceleration", 134 "defaultMessage": "!!!Enable GPU Acceleration",
135 "file": "src/containers/settings/EditSettingsScreen.js", 135 "file": "src/containers/settings/EditSettingsScreen.js",
136 "start": { 136 "start": {
137 "line": 62, 137 "line": 64,
138 "column": 25 138 "column": 25
139 }, 139 },
140 "end": { 140 "end": {
141 "line": 65, 141 "line": 67,
142 "column": 3 142 "column": 3
143 } 143 }
144 }, 144 },
@@ -147,11 +147,11 @@
147 "defaultMessage": "!!!Include beta versions", 147 "defaultMessage": "!!!Include beta versions",
148 "file": "src/containers/settings/EditSettingsScreen.js", 148 "file": "src/containers/settings/EditSettingsScreen.js",
149 "start": { 149 "start": {
150 "line": 66, 150 "line": 68,
151 "column": 8 151 "column": 8
152 }, 152 },
153 "end": { 153 "end": {
154 "line": 69, 154 "line": 71,
155 "column": 3 155 "column": 3
156 } 156 }
157 } 157 }
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js
index a456195bf..bc01291d8 100644
--- a/src/stores/SettingsStore.js
+++ b/src/stores/SettingsStore.js
@@ -8,6 +8,7 @@ import Store from './lib/Store';
8import Request from './lib/Request'; 8import Request from './lib/Request';
9import CachedRequest from './lib/CachedRequest'; 9import CachedRequest from './lib/CachedRequest';
10import { getLocale } from '../helpers/i18n-helpers'; 10import { getLocale } from '../helpers/i18n-helpers';
11import { API } from '../environment';
11 12
12import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES } from '../config'; 13import { DEFAULT_APP_SETTINGS, FILE_SYSTEM_SETTINGS_TYPES } from '../config';
13import { SPELLCHECKER_LOCALES } from '../i18n/languages'; 14import { SPELLCHECKER_LOCALES } from '../i18n/languages';
@@ -147,6 +148,7 @@ export default class SettingsStore extends Store {
147 runInBackground: legacySettings.runInBackground, 148 runInBackground: legacySettings.runInBackground,
148 enableSystemTray: legacySettings.enableSystemTray, 149 enableSystemTray: legacySettings.enableSystemTray,
149 minimizeToSystemTray: legacySettings.minimizeToSystemTray, 150 minimizeToSystemTray: legacySettings.minimizeToSystemTray,
151 server: API,
150 isAppMuted: legacySettings.isAppMuted, 152 isAppMuted: legacySettings.isAppMuted,
151 enableGPUAcceleration: legacySettings.enableGPUAcceleration, 153 enableGPUAcceleration: legacySettings.enableGPUAcceleration,
152 showMessageBadgeWhenMuted: legacySettings.showMessageBadgeWhenMuted, 154 showMessageBadgeWhenMuted: legacySettings.showMessageBadgeWhenMuted,
diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js
index 104416f06..bd451661a 100644
--- a/src/stores/UserStore.js
+++ b/src/stores/UserStore.js
@@ -84,7 +84,7 @@ export default class UserStore extends Store {
84 84
85 // Reactions 85 // Reactions
86 this.registerReactions([ 86 this.registerReactions([
87 this._requireAuthenticatedUser, 87 // this._requireAuthenticatedUser,
88 this._getUserData.bind(this), 88 this._getUserData.bind(this),
89 ]); 89 ]);
90 } 90 }