diff options
Diffstat (limited to 'src')
49 files changed, 212 insertions, 155 deletions
diff --git a/src/api/apiBase.ts b/src/api/apiBase.ts index d066d1466..fad20ca5e 100644 --- a/src/api/apiBase.ts +++ b/src/api/apiBase.ts | |||
@@ -32,10 +32,12 @@ export default function apiBase(withVersion = true) { | |||
32 | : (window as any).ferdium.stores.settings.all.app.server; | 32 | : (window as any).ferdium.stores.settings.all.app.server; |
33 | 33 | ||
34 | return fixUrl(withVersion ? `${url}/${API_VERSION}` : url); | 34 | return fixUrl(withVersion ? `${url}/${API_VERSION}` : url); |
35 | }; | 35 | } |
36 | 36 | ||
37 | export function needsToken(): boolean { | 37 | export function needsToken(): boolean { |
38 | return (window as any).ferdium.stores.settings.all.app.server === LOCAL_SERVER; | 38 | return ( |
39 | (window as any).ferdium.stores.settings.all.app.server === LOCAL_SERVER | ||
40 | ); | ||
39 | } | 41 | } |
40 | 42 | ||
41 | export function localServerToken(): string | undefined { | 43 | export function localServerToken(): string | undefined { |
@@ -46,9 +48,7 @@ export function localServerToken(): string | undefined { | |||
46 | 48 | ||
47 | export function importExportURL() { | 49 | export function importExportURL() { |
48 | const base = apiBase(false); | 50 | const base = apiBase(false); |
49 | return needsToken() | 51 | return needsToken() ? `${base}/token/${localServerToken()}` : base; |
50 | ? `${base}/token/${localServerToken()}` | ||
51 | : base; | ||
52 | } | 52 | } |
53 | 53 | ||
54 | export function serverBase() { | 54 | export function serverBase() { |
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts index 8b551ade2..a3d873c65 100644 --- a/src/api/server/ServerApi.ts +++ b/src/api/server/ServerApi.ts | |||
@@ -25,7 +25,11 @@ import { SERVER_NOT_LOADED } from '../../config'; | |||
25 | import { userDataRecipesPath, userDataPath } from '../../environment-remote'; | 25 | import { userDataRecipesPath, userDataPath } from '../../environment-remote'; |
26 | import { asarRecipesPath } from '../../helpers/asar-helpers'; | 26 | import { asarRecipesPath } from '../../helpers/asar-helpers'; |
27 | import apiBase from '../apiBase'; | 27 | import apiBase from '../apiBase'; |
28 | import { prepareAuthRequest, prepareLocalToken, sendAuthRequest } from '../utils/auth'; | 28 | import { |
29 | prepareAuthRequest, | ||
30 | prepareLocalToken, | ||
31 | sendAuthRequest, | ||
32 | } from '../utils/auth'; | ||
29 | 33 | ||
30 | import { | 34 | import { |
31 | getRecipeDirectory, | 35 | getRecipeDirectory, |
diff --git a/src/api/utils/auth.ts b/src/api/utils/auth.ts index 282d00459..1f694a781 100644 --- a/src/api/utils/auth.ts +++ b/src/api/utils/auth.ts | |||
@@ -31,15 +31,17 @@ export const prepareAuthRequest = ( | |||
31 | return request; | 31 | return request; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | export const prepareLocalToken = async ( | 34 | export const prepareLocalToken = async (requestData: { |
35 | requestData: { method: string; headers?: any; body?: any }, | 35 | method: string; |
36 | ) => { | 36 | headers?: any; |
37 | body?: any; | ||
38 | }) => { | ||
37 | await when(() => !needsToken() || !!localServerToken(), { timeout: 2000 }); | 39 | await when(() => !needsToken() || !!localServerToken(), { timeout: 2000 }); |
38 | const token = localServerToken(); | 40 | const token = localServerToken(); |
39 | if (token) { | 41 | if (token) { |
40 | requestData.headers['X-Ferdium-Local-Token'] = token; | 42 | requestData.headers['X-Ferdium-Local-Token'] = token; |
41 | } | 43 | } |
42 | } | 44 | }; |
43 | 45 | ||
44 | export const sendAuthRequest = async ( | 46 | export const sendAuthRequest = async ( |
45 | url: RequestInfo, | 47 | url: RequestInfo, |
diff --git a/src/components/auth/Invite.js b/src/components/auth/Invite.js index 9eca924cd..6b0e0e40b 100644 --- a/src/components/auth/Invite.js +++ b/src/components/auth/Invite.js | |||
@@ -70,9 +70,7 @@ class Invite extends Component { | |||
70 | fields: { | 70 | fields: { |
71 | name: { | 71 | name: { |
72 | label: intl.formatMessage(messages.nameLabel), | 72 | label: intl.formatMessage(messages.nameLabel), |
73 | placeholder: intl.formatMessage( | 73 | placeholder: intl.formatMessage(messages.nameLabel), |
74 | messages.nameLabel, | ||
75 | ), | ||
76 | onChange: () => { | 74 | onChange: () => { |
77 | this.setState({ showSuccessInfo: false }); | 75 | this.setState({ showSuccessInfo: false }); |
78 | }, | 76 | }, |
@@ -80,9 +78,7 @@ class Invite extends Component { | |||
80 | }, | 78 | }, |
81 | email: { | 79 | email: { |
82 | label: intl.formatMessage(messages.emailLabel), | 80 | label: intl.formatMessage(messages.emailLabel), |
83 | placeholder: intl.formatMessage( | 81 | placeholder: intl.formatMessage(messages.emailLabel), |
84 | messages.emailLabel, | ||
85 | ), | ||
86 | onChange: () => { | 82 | onChange: () => { |
87 | this.setState({ showSuccessInfo: false }); | 83 | this.setState({ showSuccessInfo: false }); |
88 | }, | 84 | }, |
diff --git a/src/components/auth/Locked.js b/src/components/auth/Locked.js index 90ee46722..6e32dd980 100644 --- a/src/components/auth/Locked.js +++ b/src/components/auth/Locked.js | |||
@@ -54,17 +54,19 @@ class Locked extends Component { | |||
54 | 54 | ||
55 | form = (() => { | 55 | form = (() => { |
56 | const { intl } = this.props; | 56 | const { intl } = this.props; |
57 | return new Form({ | 57 | return new Form( |
58 | fields: { | 58 | { |
59 | password: { | 59 | fields: { |
60 | label: intl.formatMessage(messages.passwordLabel), | 60 | password: { |
61 | value: '', | 61 | label: intl.formatMessage(messages.passwordLabel), |
62 | type: 'password', | 62 | value: '', |
63 | type: 'password', | ||
64 | }, | ||
63 | }, | 65 | }, |
64 | }, | 66 | }, |
65 | }, | 67 | intl, |
66 | intl, | 68 | ); |
67 | )})(); | 69 | })(); |
68 | 70 | ||
69 | submit(e) { | 71 | submit(e) { |
70 | e.preventDefault(); | 72 | e.preventDefault(); |
diff --git a/src/components/auth/Password.js b/src/components/auth/Password.js index 0daa4c77a..5086b0bbd 100644 --- a/src/components/auth/Password.js +++ b/src/components/auth/Password.js | |||
@@ -50,17 +50,19 @@ class Password extends Component { | |||
50 | 50 | ||
51 | form = (() => { | 51 | form = (() => { |
52 | const { intl } = this.props; | 52 | const { intl } = this.props; |
53 | return new Form({ | 53 | return new Form( |
54 | fields: { | 54 | { |
55 | email: { | 55 | fields: { |
56 | label: intl.formatMessage(messages.emailLabel), | 56 | email: { |
57 | value: '', | 57 | label: intl.formatMessage(messages.emailLabel), |
58 | validators: [required, email], | 58 | value: '', |
59 | validators: [required, email], | ||
60 | }, | ||
59 | }, | 61 | }, |
60 | }, | 62 | }, |
61 | }, | 63 | intl, |
62 | intl, | 64 | ); |
63 | )})(); | 65 | })(); |
64 | 66 | ||
65 | submit(e) { | 67 | submit(e) { |
66 | e.preventDefault(); | 68 | e.preventDefault(); |
@@ -80,7 +82,9 @@ class Password extends Component { | |||
80 | return ( | 82 | return ( |
81 | <div className="auth__container"> | 83 | <div className="auth__container"> |
82 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> | 84 | <form className="franz-form auth__form" onSubmit={e => this.submit(e)}> |
83 | <Link to='/auth/welcome'><img src="./assets/images/logo.svg" className="auth__logo" alt="" /></Link> | 85 | <Link to="/auth/welcome"> |
86 | <img src="./assets/images/logo.svg" className="auth__logo" alt="" /> | ||
87 | </Link> | ||
84 | <H1>{intl.formatMessage(messages.headline)}</H1> | 88 | <H1>{intl.formatMessage(messages.headline)}</H1> |
85 | {status.length > 0 && status.includes('sent') && ( | 89 | {status.length > 0 && status.includes('sent') && ( |
86 | <Infobox type="success" icon="checkbox-marked-circle-outline"> | 90 | <Infobox type="success" icon="checkbox-marked-circle-outline"> |
diff --git a/src/components/auth/Welcome.jsx b/src/components/auth/Welcome.jsx index c784b75c3..9e5d10126 100644 --- a/src/components/auth/Welcome.jsx +++ b/src/components/auth/Welcome.jsx | |||
@@ -21,7 +21,8 @@ const messages = defineMessages({ | |||
21 | }, | 21 | }, |
22 | changeServerMessage: { | 22 | changeServerMessage: { |
23 | id: 'login.changeServerMessage', | 23 | id: 'login.changeServerMessage', |
24 | defaultMessage: 'You are using {serverNameParse} Server, do you want to switch?' | 24 | defaultMessage: |
25 | 'You are using {serverNameParse} Server, do you want to switch?', | ||
25 | }, | 26 | }, |
26 | changeServer: { | 27 | changeServer: { |
27 | id: 'login.changeServer', | 28 | id: 'login.changeServer', |
@@ -78,7 +79,9 @@ class Welcome extends Component { | |||
78 | </Link> | 79 | </Link> |
79 | <div className="welcome__text__change-server"> | 80 | <div className="welcome__text__change-server"> |
80 | <span> | 81 | <span> |
81 | {intl.formatMessage(messages.changeServerMessage, { serverNameParse })} | 82 | {intl.formatMessage(messages.changeServerMessage, { |
83 | serverNameParse, | ||
84 | })} | ||
82 | </span> | 85 | </span> |
83 | <Link to={changeServerRoute} className="button__change-server"> | 86 | <Link to={changeServerRoute} className="button__change-server"> |
84 | <span>{intl.formatMessage(messages.changeServer)}</span> | 87 | <span>{intl.formatMessage(messages.changeServer)}</span> |
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js index 504325c3a..47d84fead 100644 --- a/src/components/services/content/ServiceView.js +++ b/src/components/services/content/ServiceView.js | |||
@@ -77,7 +77,8 @@ class ServiceView extends Component { | |||
77 | isSpellcheckerEnabled, | 77 | isSpellcheckerEnabled, |
78 | } = this.props; | 78 | } = this.props; |
79 | 79 | ||
80 | const { navigationBarBehaviour, navigationBarManualActive } = stores.settings.app; | 80 | const { navigationBarBehaviour, navigationBarManualActive } = |
81 | stores.settings.app; | ||
81 | 82 | ||
82 | const showNavBar = | 83 | const showNavBar = |
83 | navigationBarBehaviour === 'always' || | 84 | navigationBarBehaviour === 'always' || |
@@ -98,7 +99,11 @@ class ServiceView extends Component { | |||
98 | } | 99 | } |
99 | 100 | ||
100 | return ( | 101 | return ( |
101 | <div className={webviewClasses} data-name={service.name} style={{order: service.order}}> | 102 | <div |
103 | className={webviewClasses} | ||
104 | data-name={service.name} | ||
105 | style={{ order: service.order }} | ||
106 | > | ||
102 | {service.isActive && service.isEnabled && ( | 107 | {service.isActive && service.isEnabled && ( |
103 | <> | 108 | <> |
104 | {service.hasCrashed && ( | 109 | {service.hasCrashed && ( |
@@ -115,9 +120,9 @@ class ServiceView extends Component { | |||
115 | !service.isServiceAccessRestricted && ( | 120 | !service.isServiceAccessRestricted && ( |
116 | <WebviewLoader loaded={false} name={service.name} /> | 121 | <WebviewLoader loaded={false} name={service.name} /> |
117 | )} | 122 | )} |
118 | {service.isProgressbarEnabled && service.isLoadingPage && !service.isFirstLoad && ( | 123 | {service.isProgressbarEnabled && |
119 | <TopBarProgress /> | 124 | service.isLoadingPage && |
120 | )} | 125 | !service.isFirstLoad && <TopBarProgress />} |
121 | {service.isError && ( | 126 | {service.isError && ( |
122 | <WebviewErrorHandler | 127 | <WebviewErrorHandler |
123 | name={service.recipe.name} | 128 | name={service.recipe.name} |
@@ -151,11 +156,26 @@ class ServiceView extends Component { | |||
151 | /> | 156 | /> |
152 | </> | 157 | </> |
153 | ) : ( | 158 | ) : ( |
154 | <div style={{display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', textAlign: 'center' }}> | 159 | <div |
155 | <span role="img" aria-label="Sleeping Emoji" style={{fontSize: 42}}> | 160 | style={{ |
161 | display: 'flex', | ||
162 | flexDirection: 'column', | ||
163 | justifyContent: 'center', | ||
164 | alignItems: 'center', | ||
165 | textAlign: 'center', | ||
166 | }} | ||
167 | > | ||
168 | <span | ||
169 | role="img" | ||
170 | aria-label="Sleeping Emoji" | ||
171 | style={{ fontSize: 42 }} | ||
172 | > | ||
156 | 😴 | 173 | 😴 |
157 | </span><br/><br/> | 174 | </span> |
158 | This service is currently hibernating.<br/> | 175 | <br /> |
176 | <br /> | ||
177 | This service is currently hibernating. | ||
178 | <br /> | ||
159 | Try switching services or reloading Ferdium. | 179 | Try switching services or reloading Ferdium. |
160 | </div> | 180 | </div> |
161 | )} | 181 | )} |
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.js index 8ebf1ac5f..a1612cf8b 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.js | |||
@@ -106,7 +106,7 @@ class AccountDashboard extends Component { | |||
106 | <div className="settings__body"> | 106 | <div className="settings__body"> |
107 | {isUsingWithoutAccount && ( | 107 | {isUsingWithoutAccount && ( |
108 | <> | 108 | <> |
109 | <H1 className='.no-bottom-margin'> | 109 | <H1 className=".no-bottom-margin"> |
110 | {intl.formatMessage(messages.accountUnavailable)} | 110 | {intl.formatMessage(messages.accountUnavailable)} |
111 | </H1> | 111 | </H1> |
112 | <p | 112 | <p |
diff --git a/src/components/settings/recipes/RecipesDashboard.jsx b/src/components/settings/recipes/RecipesDashboard.jsx index 589b97ecd..d6150d300 100644 --- a/src/components/settings/recipes/RecipesDashboard.jsx +++ b/src/components/settings/recipes/RecipesDashboard.jsx | |||
@@ -191,7 +191,9 @@ class RecipesDashboard extends Component { | |||
191 | <NavLink | 191 | <NavLink |
192 | to="/settings/recipes/all" | 192 | to="/settings/recipes/all" |
193 | className={({ isActive }) => | 193 | className={({ isActive }) => |
194 | isActive && recipeFilter === 'all' ? 'badge badge--primary' : 'badge' | 194 | isActive && recipeFilter === 'all' |
195 | ? 'badge badge--primary' | ||
196 | : 'badge' | ||
195 | } | 197 | } |
196 | onClick={() => resetSearch()} | 198 | onClick={() => resetSearch()} |
197 | > | 199 | > |
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index 73136529a..ab43bace9 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -505,9 +505,7 @@ class EditServiceForm extends Component { | |||
505 | </div> | 505 | </div> |
506 | <div className="settings__controls"> | 506 | <div className="settings__controls"> |
507 | {/* Delete Button */} | 507 | {/* Delete Button */} |
508 | <div> | 508 | <div>{action === 'edit' && deleteButton}</div> |
509 | {action === 'edit' && deleteButton} | ||
510 | </div> | ||
511 | 509 | ||
512 | {/* Save Button */} | 510 | {/* Save Button */} |
513 | {isSaving || isValidatingCustomUrl ? ( | 511 | {isSaving || isValidatingCustomUrl ? ( |
diff --git a/src/components/ui/ColorPickerInput.tsx b/src/components/ui/ColorPickerInput.tsx index 8a4d3129a..710d05586 100644 --- a/src/components/ui/ColorPickerInput.tsx +++ b/src/components/ui/ColorPickerInput.tsx | |||
@@ -8,7 +8,7 @@ interface IProps { | |||
8 | field: Field; | 8 | field: Field; |
9 | className?: string; | 9 | className?: string; |
10 | focus?: boolean; | 10 | focus?: boolean; |
11 | }; | 11 | } |
12 | 12 | ||
13 | class ColorPickerInput extends Component<IProps> { | 13 | class ColorPickerInput extends Component<IProps> { |
14 | static defaultProps = { | 14 | static defaultProps = { |
@@ -34,16 +34,13 @@ class ColorPickerInput extends Component<IProps> { | |||
34 | this.inputElement?.focus(); | 34 | this.inputElement?.focus(); |
35 | } | 35 | } |
36 | 36 | ||
37 | handleChangeComplete = (color: { hex: string; }) => { | 37 | handleChangeComplete = (color: { hex: string }) => { |
38 | const { field } = this.props; | 38 | const { field } = this.props; |
39 | field.value = color.hex | 39 | field.value = color.hex; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | render() { | 42 | render() { |
43 | const { | 43 | const { field, className } = this.props; |
44 | field, | ||
45 | className, | ||
46 | } = this.props; | ||
47 | 44 | ||
48 | let { type } = field; | 45 | let { type } = field; |
49 | type = 'text'; | 46 | type = 'text'; |
@@ -57,8 +54,8 @@ class ColorPickerInput extends Component<IProps> { | |||
57 | })} | 54 | })} |
58 | > | 55 | > |
59 | <SliderPicker | 56 | <SliderPicker |
60 | color={ field.value } | 57 | color={field.value} |
61 | onChangeComplete={ this.handleChangeComplete } | 58 | onChangeComplete={this.handleChangeComplete} |
62 | id={field.id} | 59 | id={field.id} |
63 | type={type} | 60 | type={type} |
64 | className="franz-form__input" | 61 | className="franz-form__input" |
diff --git a/src/components/ui/FullscreenLoader/index.js b/src/components/ui/FullscreenLoader/index.js index 983e7ea6c..f8c6b92ee 100644 --- a/src/components/ui/FullscreenLoader/index.js +++ b/src/components/ui/FullscreenLoader/index.js | |||
@@ -23,7 +23,7 @@ class FullscreenLoader extends Component { | |||
23 | className: null, | 23 | className: null, |
24 | spinnerColor: null, | 24 | spinnerColor: null, |
25 | children: null, | 25 | children: null, |
26 | title: null | 26 | title: null, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | render() { | 29 | render() { |
diff --git a/src/components/ui/loader/index.tsx b/src/components/ui/loader/index.tsx index 4d52f320e..45f81ff3b 100644 --- a/src/components/ui/loader/index.tsx +++ b/src/components/ui/loader/index.tsx | |||
@@ -41,6 +41,4 @@ class LoaderComponent extends Component<IProps> { | |||
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | export default injectStyle(styles, { injectTheme: true })( | 44 | export default injectStyle(styles, { injectTheme: true })(LoaderComponent); |
45 | LoaderComponent, | ||
46 | ); | ||
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx index 1ce6c674b..805836130 100644 --- a/src/components/ui/select/index.tsx +++ b/src/components/ui/select/index.tsx | |||
@@ -463,6 +463,4 @@ class SelectComponent extends Component<IProps> { | |||
463 | } | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | export default injectStyle(styles, { injectTheme: true })( | 466 | export default injectStyle(styles, { injectTheme: true })(SelectComponent); |
467 | SelectComponent, | ||
468 | ); | ||
diff --git a/src/components/ui/textarea/index.tsx b/src/components/ui/textarea/index.tsx index 6796ab83d..d4ea424be 100644 --- a/src/components/ui/textarea/index.tsx +++ b/src/components/ui/textarea/index.tsx | |||
@@ -121,6 +121,4 @@ class TextareaComponent extends Component<IProps> { | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | export default injectSheet(styles, { injectTheme: true })( | 124 | export default injectSheet(styles, { injectTheme: true })(TextareaComponent); |
125 | TextareaComponent, | ||
126 | ); | ||
diff --git a/src/components/ui/wrapper/index.tsx b/src/components/ui/wrapper/index.tsx index e7477a25c..d733d050e 100644 --- a/src/components/ui/wrapper/index.tsx +++ b/src/components/ui/wrapper/index.tsx | |||
@@ -33,6 +33,4 @@ class WrapperComponent extends Component<IProps> { | |||
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | export default injectStyle(styles, { injectTheme: true })( | 36 | export default injectStyle(styles, { injectTheme: true })(WrapperComponent); |
37 | WrapperComponent, | ||
38 | ); | ||
diff --git a/src/containers/auth/LoginScreen.tsx b/src/containers/auth/LoginScreen.tsx index 5c30e6569..64e06e59d 100644 --- a/src/containers/auth/LoginScreen.tsx +++ b/src/containers/auth/LoginScreen.tsx | |||
@@ -1,6 +1,9 @@ | |||
1 | import { Component, ReactElement } from 'react'; | 1 | import { Component, ReactElement } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | import { StoresProps, GlobalError } from '../../@types/ferdium-components.types'; | 3 | import { |
4 | StoresProps, | ||
5 | GlobalError, | ||
6 | } from '../../@types/ferdium-components.types'; | ||
4 | import Login from '../../components/auth/Login'; | 7 | import Login from '../../components/auth/Login'; |
5 | 8 | ||
6 | interface LoginScreenProps extends StoresProps { | 9 | interface LoginScreenProps extends StoresProps { |
diff --git a/src/containers/auth/SignupScreen.tsx b/src/containers/auth/SignupScreen.tsx index f3675c286..bf7ffe778 100644 --- a/src/containers/auth/SignupScreen.tsx +++ b/src/containers/auth/SignupScreen.tsx | |||
@@ -1,7 +1,10 @@ | |||
1 | import { Component, ReactElement } from 'react'; | 1 | import { Component, ReactElement } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | 3 | ||
4 | import { StoresProps, GlobalError } from '../../@types/ferdium-components.types'; | 4 | import { |
5 | StoresProps, | ||
6 | GlobalError, | ||
7 | } from '../../@types/ferdium-components.types'; | ||
5 | import Signup from '../../components/auth/Signup'; | 8 | import Signup from '../../components/auth/Signup'; |
6 | 9 | ||
7 | interface SignUpScreenComponents extends StoresProps { | 10 | interface SignUpScreenComponents extends StoresProps { |
diff --git a/src/electron/ipc-api/autoUpdate.ts b/src/electron/ipc-api/autoUpdate.ts index 262d396ec..bf3e79c85 100644 --- a/src/electron/ipc-api/autoUpdate.ts +++ b/src/electron/ipc-api/autoUpdate.ts | |||
@@ -28,7 +28,7 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
28 | appEvents.emit('install-update'); | 28 | appEvents.emit('install-update'); |
29 | 29 | ||
30 | const openedWindows = BrowserWindow.getAllWindows(); | 30 | const openedWindows = BrowserWindow.getAllWindows(); |
31 | for (const window of openedWindows) window.close(); | 31 | for (const window of openedWindows) window.close(); |
32 | 32 | ||
33 | autoUpdater.quitAndInstall(); | 33 | autoUpdater.quitAndInstall(); |
34 | } | 34 | } |
diff --git a/src/electron/ipc-api/languageDetect.ts b/src/electron/ipc-api/languageDetect.ts index d344f7097..6314ea12b 100644 --- a/src/electron/ipc-api/languageDetect.ts +++ b/src/electron/ipc-api/languageDetect.ts | |||
@@ -2,7 +2,9 @@ import { ipcMain } from 'electron'; | |||
2 | 2 | ||
3 | import LanguageDetect from 'languagedetect'; | 3 | import LanguageDetect from 'languagedetect'; |
4 | 4 | ||
5 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:languageDetect'); | 5 | const debug = require('../../preload-safe-debug')( |
6 | 'Ferdium:ipcApi:languageDetect', | ||
7 | ); | ||
6 | 8 | ||
7 | export default async () => { | 9 | export default async () => { |
8 | ipcMain.handle('detect-language', async (_event, { sample }) => { | 10 | ipcMain.handle('detect-language', async (_event, { sample }) => { |
diff --git a/src/electron/ipc-api/localServer.ts b/src/electron/ipc-api/localServer.ts index 71a3003d1..6264e719d 100644 --- a/src/electron/ipc-api/localServer.ts +++ b/src/electron/ipc-api/localServer.ts | |||
@@ -39,7 +39,10 @@ export default (params: { mainWindow: BrowserWindow }) => { | |||
39 | port += 1; | 39 | port += 1; |
40 | } | 40 | } |
41 | token = randomBytes(256 / 8).toString('base64url'); | 41 | token = randomBytes(256 / 8).toString('base64url'); |
42 | debug('Starting local server at', `http://localhost:${port}/token/${token}`); | 42 | debug( |
43 | 'Starting local server at', | ||
44 | `http://localhost:${port}/token/${token}`, | ||
45 | ); | ||
43 | await server(userDataPath(), port, token); | 46 | await server(userDataPath(), port, token); |
44 | localServerStarted = true; | 47 | localServerStarted = true; |
45 | } | 48 | } |
@@ -49,7 +52,7 @@ export default (params: { mainWindow: BrowserWindow }) => { | |||
49 | port, | 52 | port, |
50 | token, | 53 | token, |
51 | }); | 54 | }); |
52 | })().catch((error) => { | 55 | })().catch(error => { |
53 | console.error('Error while starting local server', error); | 56 | console.error('Error while starting local server', error); |
54 | }); | 57 | }); |
55 | }); | 58 | }); |
diff --git a/src/electron/ipc-api/sessionStorage.ts b/src/electron/ipc-api/sessionStorage.ts index 2a9f4b4d1..39e84d42b 100644 --- a/src/electron/ipc-api/sessionStorage.ts +++ b/src/electron/ipc-api/sessionStorage.ts | |||
@@ -2,7 +2,9 @@ import { ipcMain, Session, session } from 'electron'; | |||
2 | 2 | ||
3 | import { TODOS_PARTITION_ID } from '../../config'; | 3 | import { TODOS_PARTITION_ID } from '../../config'; |
4 | 4 | ||
5 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:sessionStorage'); | 5 | const debug = require('../../preload-safe-debug')( |
6 | 'Ferdium:ipcApi:sessionStorage', | ||
7 | ); | ||
6 | 8 | ||
7 | function deduceSession(serviceId: string | undefined | null): Session { | 9 | function deduceSession(serviceId: string | undefined | null): Session { |
8 | if (serviceId) { | 10 | if (serviceId) { |
diff --git a/src/electron/windowUtils.ts b/src/electron/windowUtils.ts index 3621beb2f..654459320 100644 --- a/src/electron/windowUtils.ts +++ b/src/electron/windowUtils.ts | |||
@@ -1,6 +1,9 @@ | |||
1 | import { screen } from 'electron'; | 1 | import { screen } from 'electron'; |
2 | 2 | ||
3 | export default function isPositionValid(position: { x: number; y: number }): boolean { | 3 | export default function isPositionValid(position: { |
4 | x: number; | ||
5 | y: number; | ||
6 | }): boolean { | ||
4 | const displays = screen.getAllDisplays(); | 7 | const displays = screen.getAllDisplays(); |
5 | const { x, y } = position; | 8 | const { x, y } = position; |
6 | return displays.some( | 9 | return displays.some( |
diff --git a/src/features/basicAuth/mainIpcHandler.ts b/src/features/basicAuth/mainIpcHandler.ts index 5d320df5c..d9cedc974 100644 --- a/src/features/basicAuth/mainIpcHandler.ts +++ b/src/features/basicAuth/mainIpcHandler.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | import { BrowserWindow } from 'electron'; | 1 | import { BrowserWindow } from 'electron'; |
2 | 2 | ||
3 | const debug = require('../../preload-safe-debug')('Ferdium:feature:basicAuth:main'); | 3 | const debug = require('../../preload-safe-debug')( |
4 | 'Ferdium:feature:basicAuth:main', | ||
5 | ); | ||
4 | 6 | ||
5 | export default function mainIpcHandler(mainWindow: BrowserWindow, authInfo) { | 7 | export default function mainIpcHandler(mainWindow: BrowserWindow, authInfo) { |
6 | debug('Sending basic auth call', authInfo); | 8 | debug('Sending basic auth call', authInfo); |
diff --git a/src/features/publishDebugInfo/Component.js b/src/features/publishDebugInfo/Component.js index 1668ea79a..27661d917 100644 --- a/src/features/publishDebugInfo/Component.js +++ b/src/features/publishDebugInfo/Component.js | |||
@@ -14,7 +14,9 @@ import { DEBUG_API } from '../../config'; | |||
14 | import AppStore from '../../stores/AppStore'; | 14 | import AppStore from '../../stores/AppStore'; |
15 | import ServicesStore from '../../stores/ServicesStore'; | 15 | import ServicesStore from '../../stores/ServicesStore'; |
16 | 16 | ||
17 | const debug = require('../../preload-safe-debug')('Ferdium:feature:publishDebugInfo'); | 17 | const debug = require('../../preload-safe-debug')( |
18 | 'Ferdium:feature:publishDebugInfo', | ||
19 | ); | ||
18 | 20 | ||
19 | const messages = defineMessages({ | 21 | const messages = defineMessages({ |
20 | title: { | 22 | title: { |
@@ -89,7 +91,7 @@ class PublishDebugLogModal extends Component { | |||
89 | this.setState({ | 91 | this.setState({ |
90 | log: null, | 92 | log: null, |
91 | error: false, | 93 | error: false, |
92 | isSendingLog: false | 94 | isSendingLog: false, |
93 | }); | 95 | }); |
94 | } | 96 | } |
95 | 97 | ||
@@ -149,17 +151,15 @@ class PublishDebugLogModal extends Component { | |||
149 | className={`${classes.modal} publish-debug`} | 151 | className={`${classes.modal} publish-debug`} |
150 | close={() => this.close()} | 152 | close={() => this.close()} |
151 | > | 153 | > |
152 | <H1 className={classes.headline}>{intl.formatMessage(messages.title)}</H1> | 154 | <H1 className={classes.headline}> |
155 | {intl.formatMessage(messages.title)} | ||
156 | </H1> | ||
153 | {log && ( | 157 | {log && ( |
154 | <> | 158 | <> |
155 | <p className={classes.info}> | 159 | <p className={classes.info}> |
156 | {intl.formatMessage(messages.published)} | 160 | {intl.formatMessage(messages.published)} |
157 | </p> | 161 | </p> |
158 | <Input | 162 | <Input showLabel={false} value={`${DEBUG_API}/${log}`} readonly /> |
159 | showLabel={false} | ||
160 | value={`${DEBUG_API}/${log}`} | ||
161 | readonly | ||
162 | /> | ||
163 | </> | 163 | </> |
164 | )} | 164 | )} |
165 | 165 | ||
@@ -169,9 +169,7 @@ class PublishDebugLogModal extends Component { | |||
169 | 169 | ||
170 | {!log && !error && ( | 170 | {!log && !error && ( |
171 | <> | 171 | <> |
172 | <p className={classes.info}> | 172 | <p className={classes.info}>{intl.formatMessage(messages.info)}</p> |
173 | {intl.formatMessage(messages.info)} | ||
174 | </p> | ||
175 | 173 | ||
176 | <a | 174 | <a |
177 | href={`${DEBUG_API}/privacy.html`} | 175 | href={`${DEBUG_API}/privacy.html`} |
diff --git a/src/features/publishDebugInfo/index.ts b/src/features/publishDebugInfo/index.ts index 597bcdc12..80714a104 100644 --- a/src/features/publishDebugInfo/index.ts +++ b/src/features/publishDebugInfo/index.ts | |||
@@ -3,7 +3,9 @@ import { state as ModalState } from './store'; | |||
3 | export { default as Component } from './Component'; | 3 | export { default as Component } from './Component'; |
4 | 4 | ||
5 | const state = ModalState; | 5 | const state = ModalState; |
6 | const debug = require('../../preload-safe-debug')('Ferdium:feature:publishDebugInfo'); | 6 | const debug = require('../../preload-safe-debug')( |
7 | 'Ferdium:feature:publishDebugInfo', | ||
8 | ); | ||
7 | 9 | ||
8 | export default function initialize() { | 10 | export default function initialize() { |
9 | debug('Initialize publishDebugInfo feature'); | 11 | debug('Initialize publishDebugInfo feature'); |
diff --git a/src/features/quickSwitch/index.ts b/src/features/quickSwitch/index.ts index 9d53d0b2f..e6ee66e16 100644 --- a/src/features/quickSwitch/index.ts +++ b/src/features/quickSwitch/index.ts | |||
@@ -3,7 +3,9 @@ import { state as ModalState } from './store'; | |||
3 | export { default as Component } from './Component'; | 3 | export { default as Component } from './Component'; |
4 | const state = ModalState; | 4 | const state = ModalState; |
5 | 5 | ||
6 | const debug = require('../../preload-safe-debug')('Ferdium:feature:quickSwitch'); | 6 | const debug = require('../../preload-safe-debug')( |
7 | 'Ferdium:feature:quickSwitch', | ||
8 | ); | ||
7 | 9 | ||
8 | export default function initialize() { | 10 | export default function initialize() { |
9 | debug('Initialize quickSwitch feature'); | 11 | debug('Initialize quickSwitch feature'); |
diff --git a/src/features/serviceProxy/index.ts b/src/features/serviceProxy/index.ts index e0d667a72..51e67feca 100644 --- a/src/features/serviceProxy/index.ts +++ b/src/features/serviceProxy/index.ts | |||
@@ -1,7 +1,9 @@ | |||
1 | import { autorun, observable } from 'mobx'; | 1 | import { autorun, observable } from 'mobx'; |
2 | import { session } from '@electron/remote'; | 2 | import { session } from '@electron/remote'; |
3 | 3 | ||
4 | const debug = require('../../preload-safe-debug')('Ferdium:feature:serviceProxy'); | 4 | const debug = require('../../preload-safe-debug')( |
5 | 'Ferdium:feature:serviceProxy', | ||
6 | ); | ||
5 | 7 | ||
6 | export const config = observable({ | 8 | export const config = observable({ |
7 | isEnabled: true, | 9 | isEnabled: true, |
diff --git a/src/features/todos/preload.ts b/src/features/todos/preload.ts index 6c8bc1aea..0d76efd7a 100644 --- a/src/features/todos/preload.ts +++ b/src/features/todos/preload.ts | |||
@@ -1,7 +1,9 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import { IPC } from './constants'; | 2 | import { IPC } from './constants'; |
3 | 3 | ||
4 | const debug = require('../../preload-safe-debug')('Ferdium:feature:todos:preload'); | 4 | const debug = require('../../preload-safe-debug')( |
5 | 'Ferdium:feature:todos:preload', | ||
6 | ); | ||
5 | 7 | ||
6 | debug('Preloading Todos Webview'); | 8 | debug('Preloading Todos Webview'); |
7 | 9 | ||
diff --git a/src/features/workspaces/actions.ts b/src/features/workspaces/actions.ts index b7f8b6b90..b4e1d0758 100644 --- a/src/features/workspaces/actions.ts +++ b/src/features/workspaces/actions.ts | |||
@@ -24,5 +24,5 @@ export default createActionsFromDefinitions( | |||
24 | openWorkspaceSettings: {}, | 24 | openWorkspaceSettings: {}, |
25 | toggleKeepAllWorkspacesLoadedSetting: {}, | 25 | toggleKeepAllWorkspacesLoadedSetting: {}, |
26 | }, | 26 | }, |
27 | PropTypes.checkPropTypes | 27 | PropTypes.checkPropTypes, |
28 | ); | 28 | ); |
diff --git a/src/features/workspaces/api.ts b/src/features/workspaces/api.ts index fb752c565..b8bb703cd 100644 --- a/src/features/workspaces/api.ts +++ b/src/features/workspaces/api.ts | |||
@@ -4,7 +4,9 @@ import Request from '../../stores/lib/Request'; | |||
4 | import Workspace from './models/Workspace'; | 4 | import Workspace from './models/Workspace'; |
5 | import apiBase from '../../api/apiBase'; | 5 | import apiBase from '../../api/apiBase'; |
6 | 6 | ||
7 | const debug = require('../../preload-safe-debug')('Ferdium:feature:workspaces:api'); | 7 | const debug = require('../../preload-safe-debug')( |
8 | 'Ferdium:feature:workspaces:api', | ||
9 | ); | ||
8 | 10 | ||
9 | export const workspaceApi = { | 11 | export const workspaceApi = { |
10 | getUserWorkspaces: async () => { | 12 | getUserWorkspaces: async () => { |
diff --git a/src/features/workspaces/components/EditWorkspaceForm.js b/src/features/workspaces/components/EditWorkspaceForm.js index 7e8541c44..6bc9ae6f0 100644 --- a/src/features/workspaces/components/EditWorkspaceForm.js +++ b/src/features/workspaces/components/EditWorkspaceForm.js | |||
@@ -170,10 +170,7 @@ class EditWorkspaceForm extends Component { | |||
170 | </div> | 170 | </div> |
171 | <div className="settings__body"> | 171 | <div className="settings__body"> |
172 | {updateWorkspaceRequest.error && ( | 172 | {updateWorkspaceRequest.error && ( |
173 | <Infobox | 173 | <Infobox icon="alert" type="danger"> |
174 | icon="alert" | ||
175 | type="danger" | ||
176 | > | ||
177 | Error while saving workspace | 174 | Error while saving workspace |
178 | </Infobox> | 175 | </Infobox> |
179 | )} | 176 | )} |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index e8c5d0590..a8fb493df 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -15,7 +15,9 @@ import { createActionBindings } from '../utils/ActionBinding'; | |||
15 | 15 | ||
16 | import { KEEP_WS_LOADED_USID } from '../../config'; | 16 | import { KEEP_WS_LOADED_USID } from '../../config'; |
17 | 17 | ||
18 | const debug = require('../../preload-safe-debug')('Ferdium:feature:workspaces:store'); | 18 | const debug = require('../../preload-safe-debug')( |
19 | 'Ferdium:feature:workspaces:store', | ||
20 | ); | ||
19 | 21 | ||
20 | export default class WorkspacesStore extends FeatureStore { | 22 | export default class WorkspacesStore extends FeatureStore { |
21 | @observable isFeatureActive = false; | 23 | @observable isFeatureActive = false; |
diff --git a/src/helpers/array-helpers.ts b/src/helpers/array-helpers.ts index 5d28af433..33be12fa7 100644 --- a/src/helpers/array-helpers.ts +++ b/src/helpers/array-helpers.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | export default function shuffleArray(arr: any[]): any[] { | 1 | export default function shuffleArray(arr: any[]): any[] { |
2 | return arr | 2 | return arr |
3 | .map(a => [ Math.random(), a ]) | 3 | .map(a => [Math.random(), a]) |
4 | .sort((a, b) => a[ 0 ] - b[ 0 ]) | 4 | .sort((a, b) => a[0] - b[0]) |
5 | .map(a => a[ 1 ]) | 5 | .map(a => a[1]); |
6 | }; | 6 | } |
diff --git a/src/helpers/url-helpers.ts b/src/helpers/url-helpers.ts index 720f242b4..69a2cc4dc 100644 --- a/src/helpers/url-helpers.ts +++ b/src/helpers/url-helpers.ts | |||
@@ -24,7 +24,12 @@ export function isValidExternalURL(url: string | URL) { | |||
24 | } | 24 | } |
25 | 25 | ||
26 | export function fixUrl(url: string | URL) { | 26 | export function fixUrl(url: string | URL) { |
27 | return url.toString().replaceAll('//', '/').replaceAll('http:/', 'http://').replaceAll('https:/', 'https://').replaceAll('file:/', 'file://'); | 27 | return url |
28 | .toString() | ||
29 | .replaceAll('//', '/') | ||
30 | .replaceAll('http:/', 'http://') | ||
31 | .replaceAll('https:/', 'https://') | ||
32 | .replaceAll('file:/', 'file://'); | ||
28 | } | 33 | } |
29 | 34 | ||
30 | export function isValidFileUrl(path: string) { | 35 | export function isValidFileUrl(path: string) { |
diff --git a/src/helpers/validation-helpers.ts b/src/helpers/validation-helpers.ts index b2b8823af..4e0af8b08 100644 --- a/src/helpers/validation-helpers.ts +++ b/src/helpers/validation-helpers.ts | |||
@@ -13,7 +13,7 @@ const messages = defineMessages({ | |||
13 | }, | 13 | }, |
14 | url: { | 14 | url: { |
15 | id: 'validation.url', | 15 | id: 'validation.url', |
16 | defaultMessage: "{field} is not a valid URL", | 16 | defaultMessage: '{field} is not a valid URL', |
17 | }, | 17 | }, |
18 | minLength: { | 18 | minLength: { |
19 | id: 'validation.minLength', | 19 | id: 'validation.minLength', |
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts index 99c6e1e80..c62256aec 100644 --- a/src/i18n/translations.ts +++ b/src/i18n/translations.ts | |||
@@ -13,4 +13,4 @@ export default function generatedTranslations() { | |||
13 | } | 13 | } |
14 | } | 14 | } |
15 | return translations; | 15 | return translations; |
16 | }; | 16 | } |
diff --git a/src/internal-server/app/Controllers/Http/RecipeController.js b/src/internal-server/app/Controllers/Http/RecipeController.js index eac34aa5c..61fa6be8f 100644 --- a/src/internal-server/app/Controllers/Http/RecipeController.js +++ b/src/internal-server/app/Controllers/Http/RecipeController.js | |||
@@ -4,7 +4,9 @@ const { validateAll } = use('Validator'); | |||
4 | const Env = use('Env'); | 4 | const Env = use('Env'); |
5 | 5 | ||
6 | const fetch = require('node-fetch'); | 6 | const fetch = require('node-fetch'); |
7 | const debug = require('../../../../preload-safe-debug')('Ferdium:internalServer:RecipeController'); | 7 | const debug = require('../../../../preload-safe-debug')( |
8 | 'Ferdium:internalServer:RecipeController', | ||
9 | ); | ||
8 | const { LIVE_FERDIUM_API } = require('../../../../config'); | 10 | const { LIVE_FERDIUM_API } = require('../../../../config'); |
9 | const { convertToJSON } = require('../../../../jsUtils'); | 11 | const { convertToJSON } = require('../../../../jsUtils'); |
10 | const { API_VERSION } = require('../../../../environment-remote'); | 12 | const { API_VERSION } = require('../../../../environment-remote'); |
@@ -87,15 +89,11 @@ class RecipeController { | |||
87 | } | 89 | } |
88 | 90 | ||
89 | // Return an empty array | 91 | // Return an empty array |
90 | update({ | 92 | update({ response }) { |
91 | response, | ||
92 | }) { | ||
93 | return response.send([]); | 93 | return response.send([]); |
94 | } | 94 | } |
95 | 95 | ||
96 | async popularRecipes({ | 96 | async popularRecipes({ response }) { |
97 | response, | ||
98 | }) { | ||
99 | const recipesUrlFetch = await fetch(`${RECIPES_URL}/popular`); | 97 | const recipesUrlFetch = await fetch(`${RECIPES_URL}/popular`); |
100 | const featuredRecipes = convertToJSON(await recipesUrlFetch.text()); | 98 | const featuredRecipes = convertToJSON(await recipesUrlFetch.text()); |
101 | return response.send(featuredRecipes); | 99 | return response.send(featuredRecipes); |
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js index 44e4a7369..226adb134 100644 --- a/src/internal-server/app/Controllers/Http/ServiceController.js +++ b/src/internal-server/app/Controllers/Http/ServiceController.js | |||
@@ -2,7 +2,10 @@ const Service = use('App/Models/Service'); | |||
2 | const { validateAll } = use('Validator'); | 2 | const { validateAll } = use('Validator'); |
3 | 3 | ||
4 | const { v4: uuid } = require('uuid'); | 4 | const { v4: uuid } = require('uuid'); |
5 | const { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } = require('../../../../config'); | 5 | const { |
6 | DEFAULT_SERVICE_ORDER, | ||
7 | DEFAULT_SERVICE_SETTINGS, | ||
8 | } = require('../../../../config'); | ||
6 | const { convertToJSON } = require('../../../../jsUtils'); | 9 | const { convertToJSON } = require('../../../../jsUtils'); |
7 | const { deduceIconUrl, moveIcon } = require('../../ImageHelper'); | 10 | const { deduceIconUrl, moveIcon } = require('../../ImageHelper'); |
8 | 11 | ||
@@ -30,7 +33,8 @@ class ServiceController { | |||
30 | serviceId = uuid(); | 33 | serviceId = uuid(); |
31 | } while ( | 34 | } while ( |
32 | // eslint-disable-next-line no-await-in-loop, unicorn/no-await-expression-member | 35 | // eslint-disable-next-line no-await-in-loop, unicorn/no-await-expression-member |
33 | (await Service.query().where('serviceId', serviceId).fetch()).rows.length > 0 | 36 | (await Service.query().where('serviceId', serviceId).fetch()).rows |
37 | .length > 0 | ||
34 | ); | 38 | ); |
35 | 39 | ||
36 | await Service.create({ | 40 | await Service.create({ |
diff --git a/src/internal-server/app/Controllers/Http/StaticController.js b/src/internal-server/app/Controllers/Http/StaticController.js index ac6f89008..0a0146d6b 100644 --- a/src/internal-server/app/Controllers/Http/StaticController.js +++ b/src/internal-server/app/Controllers/Http/StaticController.js | |||
@@ -4,9 +4,7 @@ | |||
4 | 4 | ||
5 | class StaticController { | 5 | class StaticController { |
6 | // Enable all features | 6 | // Enable all features |
7 | features({ | 7 | features({ response }) { |
8 | response, | ||
9 | }) { | ||
10 | return response.send({ | 8 | return response.send({ |
11 | isServiceProxyEnabled: true, | 9 | isServiceProxyEnabled: true, |
12 | isWorkspaceEnabled: true, | 10 | isWorkspaceEnabled: true, |
@@ -20,9 +18,7 @@ class StaticController { | |||
20 | } | 18 | } |
21 | 19 | ||
22 | // Show announcements | 20 | // Show announcements |
23 | announcement({ | 21 | announcement({ response }) { |
24 | response, | ||
25 | }) { | ||
26 | return response.send({}); | 22 | return response.send({}); |
27 | } | 23 | } |
28 | } | 24 | } |
diff --git a/src/internal-server/app/ImageHelper.js b/src/internal-server/app/ImageHelper.js index e7c981a1d..905ba81ab 100644 --- a/src/internal-server/app/ImageHelper.js +++ b/src/internal-server/app/ImageHelper.js | |||
@@ -6,7 +6,7 @@ const path = require('path'); | |||
6 | const fs = require('fs-extra'); | 6 | const fs = require('fs-extra'); |
7 | const { API_VERSION } = require('../../environment-remote'); | 7 | const { API_VERSION } = require('../../environment-remote'); |
8 | 8 | ||
9 | const moveIcon = async (icon) => { | 9 | const moveIcon = async icon => { |
10 | const iconsPath = path.join(Env.get('USER_PATH'), 'icons'); | 10 | const iconsPath = path.join(Env.get('USER_PATH'), 'icons'); |
11 | await fs.ensureDir(iconsPath); | 11 | await fs.ensureDir(iconsPath); |
12 | 12 | ||
@@ -24,6 +24,11 @@ const moveIcon = async (icon) => { | |||
24 | return !icon.moved() ? '-1' : iconId; | 24 | return !icon.moved() ? '-1' : iconId; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | const deduceIconUrl = (iconId) => iconId ? `http://${Env.get('HOST')}:${Env.get('PORT')}/${API_VERSION}/icon/${iconId}` : null | 27 | const deduceIconUrl = iconId => |
28 | iconId | ||
29 | ? `http://${Env.get('HOST')}:${Env.get( | ||
30 | 'PORT', | ||
31 | )}/${API_VERSION}/icon/${iconId}` | ||
32 | : null; | ||
28 | 33 | ||
29 | module.exports = { moveIcon, deduceIconUrl }; | 34 | module.exports = { moveIcon, deduceIconUrl }; |
diff --git a/src/internal-server/start.ts b/src/internal-server/start.ts index ae28e3313..f5e1953e7 100644 --- a/src/internal-server/start.ts +++ b/src/internal-server/start.ts | |||
@@ -63,12 +63,15 @@ export const server = async (userPath: string, port: number, token: string) => { | |||
63 | returned = true; | 63 | returned = true; |
64 | } | 64 | } |
65 | }); | 65 | }); |
66 | new Ignitor(fold).appRoot(__dirname).fireHttpServer().catch((error) => { | 66 | new Ignitor(fold) |
67 | console.error(error); | 67 | .appRoot(__dirname) |
68 | if (!returned) { | 68 | .fireHttpServer() |
69 | returned = true; | 69 | .catch(error => { |
70 | reject(error); | 70 | console.error(error); |
71 | } | 71 | if (!returned) { |
72 | }); | 72 | returned = true; |
73 | reject(error); | ||
74 | } | ||
75 | }); | ||
73 | }); | 76 | }); |
74 | }; | 77 | }; |
diff --git a/src/internal-server/start/routes.js b/src/internal-server/start/routes.js index 736796bb8..8aca39347 100644 --- a/src/internal-server/start/routes.js +++ b/src/internal-server/start/routes.js | |||
@@ -18,9 +18,13 @@ migrate(); | |||
18 | 18 | ||
19 | async function validateToken(clientToken, response, next) { | 19 | async function validateToken(clientToken, response, next) { |
20 | const serverToken = process.env.FERDIUM_LOCAL_TOKEN; | 20 | const serverToken = process.env.FERDIUM_LOCAL_TOKEN; |
21 | const valid = serverToken && | 21 | const valid = |
22 | serverToken && | ||
22 | clientToken && | 23 | clientToken && |
23 | timingSafeEqual(Buffer.from(clientToken, 'utf8'), Buffer.from(serverToken, 'utf8')); | 24 | timingSafeEqual( |
25 | Buffer.from(clientToken, 'utf8'), | ||
26 | Buffer.from(serverToken, 'utf8'), | ||
27 | ); | ||
24 | if (valid) { | 28 | if (valid) { |
25 | await next(); | 29 | await next(); |
26 | return true; | 30 | return true; |
@@ -41,11 +45,11 @@ const OnlyAllowFerdium = async ({ request, response }, next) => { | |||
41 | const RequireTokenInQS = async ({ request, response }, next) => { | 45 | const RequireTokenInQS = async ({ request, response }, next) => { |
42 | const clientToken = request.get().token; | 46 | const clientToken = request.get().token; |
43 | return validateToken(clientToken, response, next); | 47 | return validateToken(clientToken, response, next); |
44 | } | 48 | }; |
45 | 49 | ||
46 | const FERDIUM_LOCAL_TOKEN_COOKIE = 'ferdium-local-token'; | 50 | const FERDIUM_LOCAL_TOKEN_COOKIE = 'ferdium-local-token'; |
47 | 51 | ||
48 | const RequireAuthenticatedBrowser = async({ request, response }, next) => { | 52 | const RequireAuthenticatedBrowser = async ({ request, response }, next) => { |
49 | const clientToken = request.cookie(FERDIUM_LOCAL_TOKEN_COOKIE); | 53 | const clientToken = request.cookie(FERDIUM_LOCAL_TOKEN_COOKIE); |
50 | return validateToken(clientToken, response, next); | 54 | return validateToken(clientToken, response, next); |
51 | }; | 55 | }; |
diff --git a/src/jsUtils.ts b/src/jsUtils.ts index 36d70da25..ba7542eab 100644 --- a/src/jsUtils.ts +++ b/src/jsUtils.ts | |||
@@ -21,4 +21,4 @@ export const convertToJSON = (data: string | any | undefined | null) => | |||
21 | export const cleanseJSObject = (data: any | undefined | null) => | 21 | export const cleanseJSObject = (data: any | undefined | null) => |
22 | JSON.parse(JSON.stringify(data)); | 22 | JSON.parse(JSON.stringify(data)); |
23 | 23 | ||
24 | export const isEscKeyPress = (keyCode : Number) => keyCode === 27; | 24 | export const isEscKeyPress = (keyCode: Number) => keyCode === 27; |
diff --git a/src/lib/Tray.js b/src/lib/Tray.js index 0e935d891..fffdec64d 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js | |||
@@ -224,15 +224,9 @@ export default class TrayIcon { | |||
224 | _getAsset(type, asset) { | 224 | _getAsset(type, asset) { |
225 | let { platform } = process; | 225 | let { platform } = process; |
226 | 226 | ||
227 | if ( | 227 | if (isMac && macosVersion.isGreaterThanOrEqualTo('11')) { |
228 | isMac && | ||
229 | macosVersion.isGreaterThanOrEqualTo('11') | ||
230 | ) { | ||
231 | platform = `${platform}-20`; | 228 | platform = `${platform}-20`; |
232 | } else if ( | 229 | } else if (isMac && nativeTheme.shouldUseDarkColors) { |
233 | isMac && | ||
234 | nativeTheme.shouldUseDarkColors | ||
235 | ) { | ||
236 | platform = `${platform}-dark`; | 230 | platform = `${platform}-dark`; |
237 | } | 231 | } |
238 | 232 | ||
diff --git a/src/preload-safe-debug.ts b/src/preload-safe-debug.ts index 1136e93c1..d18dd8639 100644 --- a/src/preload-safe-debug.ts +++ b/src/preload-safe-debug.ts | |||
@@ -9,20 +9,22 @@ | |||
9 | * because they correspond to preload scripts. | 9 | * because they correspond to preload scripts. |
10 | */ | 10 | */ |
11 | module.exports = function debug(namespace: string): (...params: any[]) => void { | 11 | module.exports = function debug(namespace: string): (...params: any[]) => void { |
12 | if (typeof process === 'object' && | 12 | if ( |
13 | 'contextIsolated' in process && | 13 | typeof process === 'object' && |
14 | (process as unknown as { contextIsolated: string }).contextIsolated) { | 14 | 'contextIsolated' in process && |
15 | (process as unknown as { contextIsolated: string }).contextIsolated | ||
16 | ) { | ||
15 | // Only output debug messages to the console if debugging is requested. | 17 | // Only output debug messages to the console if debugging is requested. |
16 | // We don't reimplement the matching algorithm from `debug` and just dump all | 18 | // We don't reimplement the matching algorithm from `debug` and just dump all |
17 | // messages to the console if some form of `Ferdium` debugging is enabled. | 19 | // messages to the console if some form of `Ferdium` debugging is enabled. |
18 | if (process.env.DEBUG?.startsWith('Ferdium:')) { | 20 | if (process.env.DEBUG?.startsWith('Ferdium:')) { |
19 | return (...params) => console.debug(`[${namespace}]`, ...params); | 21 | return (...params) => console.debug(`[${namespace}]`, ...params); |
20 | } | 22 | } |
21 | return () => { }; | 23 | return () => {}; |
22 | } | 24 | } |
23 | /* | 25 | /* |
24 | eslint-disable-next-line global-require -- | 26 | eslint-disable-next-line global-require -- |
25 | This file contains a workaround for situations were global require is problematic. | 27 | This file contains a workaround for situations were global require is problematic. |
26 | */ | 28 | */ |
27 | return require('debug')(namespace); | 29 | return require('debug')(namespace); |
28 | } | 30 | }; |
diff --git a/src/stores/SettingsStore.ts b/src/stores/SettingsStore.ts index a03d3c188..e2903c952 100644 --- a/src/stores/SettingsStore.ts +++ b/src/stores/SettingsStore.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
3 | import { getCurrentWindow } from '@electron/remote'; | 2 | import { getCurrentWindow } from '@electron/remote'; |
4 | import { action, computed, makeObservable, observable, reaction } from 'mobx'; | 3 | import { action, computed, makeObservable, observable, reaction } from 'mobx'; |
diff --git a/src/webview/dialogTitle.ts b/src/webview/dialogTitle.ts index 67b4e5b6b..14676100c 100644 --- a/src/webview/dialogTitle.ts +++ b/src/webview/dialogTitle.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | 2 | ||
3 | const debug = require('../preload-safe-debug')('Ferdium:Plugin:DialogTitleHandler'); | 3 | const debug = require('../preload-safe-debug')( |
4 | 'Ferdium:Plugin:DialogTitleHandler', | ||
5 | ); | ||
4 | 6 | ||
5 | export default class DialogTitleHandler { | 7 | export default class DialogTitleHandler { |
6 | titleCache: { title: string }; | 8 | titleCache: { title: string }; |