aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <properly@protonmail.com>2019-08-26 21:25:59 +0200
committerLibravatar vantezzen <properly@protonmail.com>2019-08-26 21:25:59 +0200
commit8ab680e9648adf342d3dbd42cd0ebe02e31a00a8 (patch)
treeb419545dab6c2864641dd9ccc5d2188fb56c48b1
parentLint (diff)
downloadferdium-app-8ab680e9648adf342d3dbd42cd0ebe02e31a00a8.tar.gz
ferdium-app-8ab680e9648adf342d3dbd42cd0ebe02e31a00a8.tar.zst
ferdium-app-8ab680e9648adf342d3dbd42cd0ebe02e31a00a8.zip
Improve apibase function
-rw-r--r--README.md3
-rw-r--r--src/api/apiBase.js9
-rw-r--r--src/components/settings/settings/EditSettingsForm.js5
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 @@
6 6
7## Features 7## Features
8- [x] Removes the fullscreen app delay inviting users to upgrade 8- [x] Removes the fullscreen app delay inviting users to upgrade
9- [x] Removes pages begging you to donate afte registration 9- [x] Removes pages begging you to donate after registration
10- [x] Makes all users premium 10- [x] Makes all users premium
11- [x] Add option to change server to a custom [ferdi-server](https://github.com/vantezzen/ferdi-server) 11- [x] Add option to change server to a custom [ferdi-server](https://github.com/vantezzen/ferdi-server)
12- [x] Custom branding
12- [ ] [#5](https://github.com/kytwb/Ferdi/issues/5) Makes it optional to create an account 13- [ ] [#5](https://github.com/kytwb/Ferdi/issues/5) Makes it optional to create an account
13- [ ] [#6](https://github.com/kytwb/Ferdi/issues/6) Makes RocketChat self-hosted generally available 14- [ ] [#6](https://github.com/kytwb/Ferdi/issues/6) Makes RocketChat self-hosted generally available
14 15
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 {
8 8
9const apiBase = () => { 9const apiBase = () => {
10 let url; 10 let url;
11
11 if (!window.ferdi 12 if (!window.ferdi
12 || !window.ferdi.stores.settings 13 || !window.ferdi.stores.settings
13 || !window.ferdi.stores.settings.all) { 14 || !window.ferdi.stores.settings.all
15 || !window.ferdi.stores.settings.all.app.server) {
14 // Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded 16 // Stores have not yet been loaded - send invalid URL to force a retry when stores are loaded
15 // "Why 1.1.1.1 as the default, invalid URL?" 17 // "Why 1.1.1.1 as the default, invalid URL?"
16 // 1.1.1.1 is the server for Cloudflare's DNS service and will be the same across most networks. 18 // 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 = () => {
20 // on some routes. This would result in Ferdi deleting its current authToken as it thinks it 22 // on some routes. This would result in Ferdi deleting its current authToken as it thinks it
21 // has gone invalid. 23 // has gone invalid.
22 url = 'https://1.1.1.1'; 24 url = 'https://1.1.1.1';
23 } else if (window.ferdi.stores.settings.all.app.server) { 25 } else {
24 // Load URL from store 26 // Load URL from store
25 url = window.ferdi.stores.settings.all.app.server; 27 url = window.ferdi.stores.settings.all.app.server;
26 } else {
27 // Use default server url
28 url = API;
29 } 28 }
30 29
31 return `${url}/${API_VERSION}`; 30 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 {
254 <span className="mdi mdi-information" /> 254 <span className="mdi mdi-information" />
255 {intl.formatMessage(messages.languageDisclaimer)} 255 {intl.formatMessage(messages.languageDisclaimer)}
256 </p> 256 </p>
257 <p className="settings__message">
258 <span className="mdi mdi-github-face" />
259 Ferdi is based on <a href="https://github.com/meetfranz/franz">Franz</a>, a project published
260 under the <a href="https://github.com/meetfranz/franz/blob/master/LICENSE">Apache-2.0 License</a>
261 </p>
257 </form> 262 </form>
258 </div> 263 </div>
259 </div> 264 </div>