diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2022-04-27 15:07:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 14:07:24 +0000 |
commit | c7c774c6318fcc8a13cb7f31e2672eea4ebfc777 (patch) | |
tree | 72b23f2031e00489118add998c3fed6bdbc8b9d8 | |
parent | 6.0.0-nightly.13 [skip ci] (diff) | |
download | ferdium-app-c7c774c6318fcc8a13cb7f31e2672eea4ebfc777.tar.gz ferdium-app-c7c774c6318fcc8a13cb7f31e2672eea4ebfc777.tar.zst ferdium-app-c7c774c6318fcc8a13cb7f31e2672eea4ebfc777.zip |
Add Ferdi server to hosted services (#49)
* 'SettingsNavigation.js' and 'TeamDashboard.js' also have a call to 'LIVE_FERDI_API', but it handles the teams feature that I think neither Ferdi or Ferdium provide.
* Removes comment on 'apiBase.ts' because I tested and the Terms was redirecting fine on the 'Help' Menu.
-rw-r--r-- | src/api/apiBase.ts | 1 | ||||
-rw-r--r-- | src/components/auth/ChangeServer.js | 11 | ||||
-rw-r--r-- | src/components/auth/Login.js | 20 | ||||
-rw-r--r-- | src/components/settings/account/AccountDashboard.js | 26 | ||||
-rw-r--r-- | src/config.ts | 1 |
5 files changed, 52 insertions, 7 deletions
diff --git a/src/api/apiBase.ts b/src/api/apiBase.ts index c41fbe8ba..7ed3616a8 100644 --- a/src/api/apiBase.ts +++ b/src/api/apiBase.ts | |||
@@ -34,7 +34,6 @@ const apiBase = (withVersion = true) => { | |||
34 | export default apiBase; | 34 | export default apiBase; |
35 | 35 | ||
36 | export function termsBase() { | 36 | export function termsBase() { |
37 | // TODO: This needs to handle local vs ferdium vs franz servers | ||
38 | return (window as any).ferdium.stores.settings.all.app.server !== LIVE_FRANZ_API | 37 | return (window as any).ferdium.stores.settings.all.app.server !== LIVE_FRANZ_API |
39 | ? (window as any).ferdium.stores.settings.all.app.server | 38 | ? (window as any).ferdium.stores.settings.all.app.server |
40 | : DEV_API_FRANZ_WEBSITE; | 39 | : DEV_API_FRANZ_WEBSITE; |
diff --git a/src/components/auth/ChangeServer.js b/src/components/auth/ChangeServer.js index 682f6512c..7e74fe779 100644 --- a/src/components/auth/ChangeServer.js +++ b/src/components/auth/ChangeServer.js | |||
@@ -9,7 +9,7 @@ import Button from '../ui/Button'; | |||
9 | import Link from '../ui/Link'; | 9 | import Link from '../ui/Link'; |
10 | import Infobox from '../ui/Infobox'; | 10 | import Infobox from '../ui/Infobox'; |
11 | import { url, required } from '../../helpers/validation-helpers'; | 11 | import { url, required } from '../../helpers/validation-helpers'; |
12 | import { LIVE_FERDIUM_API, LIVE_FRANZ_API } from '../../config'; | 12 | import { LIVE_FERDIUM_API, LIVE_FRANZ_API, LIVE_FERDI_API } from '../../config'; |
13 | import globalMessages from '../../i18n/globalMessages'; | 13 | import globalMessages from '../../i18n/globalMessages'; |
14 | 14 | ||
15 | const messages = defineMessages({ | 15 | const messages = defineMessages({ |
@@ -43,9 +43,11 @@ class ChangeServer extends Component { | |||
43 | 43 | ||
44 | ferdiumServer = LIVE_FERDIUM_API; | 44 | ferdiumServer = LIVE_FERDIUM_API; |
45 | 45 | ||
46 | ferdiServer = LIVE_FERDI_API; | ||
47 | |||
46 | franzServer = LIVE_FRANZ_API; | 48 | franzServer = LIVE_FRANZ_API; |
47 | 49 | ||
48 | defaultServers = [this.franzServer, this.ferdiumServer]; | 50 | defaultServers = [this.ferdiumServer, this.franzServer, this.ferdiServer]; |
49 | 51 | ||
50 | form = new Form( | 52 | form = new Form( |
51 | { | 53 | { |
@@ -54,8 +56,9 @@ class ChangeServer extends Component { | |||
54 | label: this.props.intl.formatMessage(messages.label), | 56 | label: this.props.intl.formatMessage(messages.label), |
55 | value: this.props.server, | 57 | value: this.props.server, |
56 | options: [ | 58 | options: [ |
57 | { value: this.ferdiumServer, label: 'Ferdium' }, | 59 | { value: this.ferdiumServer, label: 'Ferdium (Default)' }, |
58 | { value: this.franzServer, label: 'Franz' }, | 60 | { value: this.franzServer, label: 'Franz' }, |
61 | { value: this.ferdiServer, label: 'Ferdi' }, | ||
59 | { | 62 | { |
60 | value: this.defaultServers.includes(this.props.server) | 63 | value: this.defaultServers.includes(this.props.server) |
61 | ? '' | 64 | ? '' |
@@ -108,7 +111,7 @@ class ChangeServer extends Component { | |||
108 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> | 111 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> |
109 | <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link> | 112 | <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link> |
110 | <h1>{intl.formatMessage(messages.headline)}</h1> | 113 | <h1>{intl.formatMessage(messages.headline)}</h1> |
111 | {form.$('server').value === this.franzServer && ( | 114 | {(form.$('server').value === this.franzServer || form.$('server').value === this.ferdiServer) && ( |
112 | <Infobox type="warning"> | 115 | <Infobox type="warning"> |
113 | {intl.formatMessage(messages.warning)} | 116 | {intl.formatMessage(messages.warning)} |
114 | </Infobox> | 117 | </Infobox> |
diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 3c9c07f0d..ccffd0c6a 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js | |||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; | |||
4 | import { observer, inject } from 'mobx-react'; | 4 | import { observer, inject } from 'mobx-react'; |
5 | import { defineMessages, injectIntl } from 'react-intl'; | 5 | import { defineMessages, injectIntl } from 'react-intl'; |
6 | 6 | ||
7 | import { LIVE_FRANZ_API } from '../../config'; | 7 | import { LIVE_FRANZ_API, LIVE_FERDI_API } from '../../config'; |
8 | import { API_VERSION } from '../../environment-remote'; | 8 | import { API_VERSION } from '../../environment-remote'; |
9 | import Form from '../../lib/Form'; | 9 | import Form from '../../lib/Form'; |
10 | import { required, email } from '../../helpers/validation-helpers'; | 10 | import { required, email } from '../../helpers/validation-helpers'; |
@@ -153,6 +153,24 @@ class Login extends Component { | |||
153 | </Link> | 153 | </Link> |
154 | </p> | 154 | </p> |
155 | )} | 155 | )} |
156 | {window['ferdium'].stores.settings.all.app.server !== | ||
157 | LIVE_FERDI_API && ( | ||
158 | <p className="error-message center"> | ||
159 | {intl.formatMessage(messages.customServerQuestion)}{' '} | ||
160 | <Link | ||
161 | to={`${window[ | ||
162 | 'ferdium' | ||
163 | ].stores.settings.all.app.server.replace( | ||
164 | API_VERSION, | ||
165 | '', | ||
166 | )}/import`} | ||
167 | target="_blank" | ||
168 | style={{ cursor: 'pointer', textDecoration: 'underline' }} | ||
169 | > | ||
170 | {intl.formatMessage(messages.customServerSuggestion)} | ||
171 | </Link> | ||
172 | </p> | ||
173 | )} | ||
156 | </> | 174 | </> |
157 | )} | 175 | )} |
158 | {isSubmitting ? ( | 176 | {isSubmitting ? ( |
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index b500b82cf..78d41a273 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js | |||
@@ -8,7 +8,7 @@ import { H1, H2 } from '../../ui/headline'; | |||
8 | import Loader from '../../ui/Loader'; | 8 | import Loader from '../../ui/Loader'; |
9 | import Button from '../../ui/Button'; | 9 | import Button from '../../ui/Button'; |
10 | import Infobox from '../../ui/Infobox'; | 10 | import Infobox from '../../ui/Infobox'; |
11 | import { LOCAL_SERVER, LIVE_FRANZ_API } from '../../../config'; | 11 | import { LOCAL_SERVER, LIVE_FRANZ_API, LIVE_FERDI_API } from '../../../config'; |
12 | 12 | ||
13 | const messages = defineMessages({ | 13 | const messages = defineMessages({ |
14 | headline: { | 14 | headline: { |
@@ -95,6 +95,7 @@ class AccountDashboard extends Component { | |||
95 | 95 | ||
96 | const isUsingWithoutAccount = server === LOCAL_SERVER; | 96 | const isUsingWithoutAccount = server === LOCAL_SERVER; |
97 | const isUsingFranzServer = server === LIVE_FRANZ_API; | 97 | const isUsingFranzServer = server === LIVE_FRANZ_API; |
98 | const isUsingFerdiServer = server === LIVE_FERDI_API; | ||
98 | 99 | ||
99 | return ( | 100 | return ( |
100 | <div className="settings__main"> | 101 | <div className="settings__main"> |
@@ -210,6 +211,29 @@ class AccountDashboard extends Component { | |||
210 | </div> | 211 | </div> |
211 | </div> | 212 | </div> |
212 | )} | 213 | )} |
214 | {isUsingFerdiServer && ( | ||
215 | <div className="account franz-form"> | ||
216 | <div className="account__box"> | ||
217 | <H2> | ||
218 | {intl.formatMessage(messages.headlineDangerZone)} | ||
219 | </H2> | ||
220 | {!isDeleteAccountSuccessful && ( | ||
221 | <div className="account__subscription"> | ||
222 | <p>{intl.formatMessage(messages.deleteInfo)}</p> | ||
223 | <Button | ||
224 | label={intl.formatMessage(messages.deleteAccount)} | ||
225 | buttonType="danger" | ||
226 | onClick={() => deleteAccount()} | ||
227 | loaded={!isLoadingDeleteAccount} | ||
228 | /> | ||
229 | </div> | ||
230 | )} | ||
231 | {isDeleteAccountSuccessful && ( | ||
232 | <p>{intl.formatMessage(messages.deleteEmailSent)}</p> | ||
233 | )} | ||
234 | </div> | ||
235 | </div> | ||
236 | )} | ||
213 | </> | 237 | </> |
214 | )} | 238 | )} |
215 | </> | 239 | </> |
diff --git a/src/config.ts b/src/config.ts index 5aa5ea5aa..4ea762311 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -13,6 +13,7 @@ export const DEV_FRANZ_API = 'https://dev.franzinfra.com'; | |||
13 | 13 | ||
14 | export const LIVE_FERDIUM_API = 'https://api.ferdium.org'; | 14 | export const LIVE_FERDIUM_API = 'https://api.ferdium.org'; |
15 | export const LIVE_FRANZ_API = 'https://api.franzinfra.com'; | 15 | export const LIVE_FRANZ_API = 'https://api.franzinfra.com'; |
16 | export const LIVE_FERDI_API = 'https://api.getferdi.com'; | ||
16 | 17 | ||
17 | // URL used to submit debugger information, see https://github.com/ferdium/debugger | 18 | // URL used to submit debugger information, see https://github.com/ferdium/debugger |
18 | export const DEBUG_API = 'https://debug.ferdium.org'; | 19 | export const DEBUG_API = 'https://debug.ferdium.org'; |