From 8ab680e9648adf342d3dbd42cd0ebe02e31a00a8 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Mon, 26 Aug 2019 21:25:59 +0200 Subject: Improve apibase function --- README.md | 3 ++- src/api/apiBase.js | 9 ++++----- src/components/settings/settings/EditSettingsForm.js | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 43c5a576a..5d1d9888f 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ ## Features - [x] Removes the fullscreen app delay inviting users to upgrade -- [x] Removes pages begging you to donate afte registration +- [x] Removes pages begging you to donate after registration - [x] Makes all users premium - [x] Add option to change server to a custom [ferdi-server](https://github.com/vantezzen/ferdi-server) +- [x] Custom branding - [ ] [#5](https://github.com/kytwb/Ferdi/issues/5) Makes it optional to create an account - [ ] [#6](https://github.com/kytwb/Ferdi/issues/6) Makes RocketChat self-hosted generally available diff --git a/src/api/apiBase.js b/src/api/apiBase.js index ce02922ac..b40673e44 100644 --- a/src/api/apiBase.js +++ b/src/api/apiBase.js @@ -8,9 +8,11 @@ import { const apiBase = () => { let url; + if (!window.ferdi || !window.ferdi.stores.settings - || !window.ferdi.stores.settings.all) { + || !window.ferdi.stores.settings.all + || !window.ferdi.stores.settings.all.app.server) { // Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded // "Why 1.1.1.1 as the default, invalid URL?" // 1.1.1.1 is the server for Cloudflare's DNS service and will be the same across most networks. @@ -20,12 +22,9 @@ const apiBase = () => { // on some routes. This would result in Ferdi deleting its current authToken as it thinks it // has gone invalid. url = 'https://1.1.1.1'; - } else if (window.ferdi.stores.settings.all.app.server) { + } else { // Load URL from store url = window.ferdi.stores.settings.all.app.server; - } else { - // Use default server url - url = API; } return `${url}/${API_VERSION}`; diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index de324b115..6d2dd0572 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js @@ -254,6 +254,11 @@ export default @observer class EditSettingsForm extends Component { {intl.formatMessage(messages.languageDisclaimer)}

+

+ + Ferdi is based on Franz, a project published + under the Apache-2.0 License +

-- cgit v1.2.3-70-g09d2