diff options
-rw-r--r-- | src/@types/stores.types.ts | 8 | ||||
-rw-r--r-- | src/api/UserApi.ts | 4 | ||||
-rw-r--r-- | src/api/server/ServerApi.ts | 36 | ||||
-rw-r--r-- | src/config.ts | 11 | ||||
-rw-r--r-- | src/environment-remote.ts | 7 | ||||
-rw-r--r-- | src/features/workspaces/store.ts | 5 | ||||
-rw-r--r-- | src/models/User.ts | 2 | ||||
-rw-r--r-- | src/stores/AppStore.ts | 2 | ||||
-rw-r--r-- | src/stores/SettingsStore.ts | 6 | ||||
-rw-r--r-- | src/stores/UserStore.ts | 27 | ||||
-rw-r--r-- | src/stores/lib/Request.ts | 9 |
11 files changed, 2 insertions, 115 deletions
diff --git a/src/@types/stores.types.ts b/src/@types/stores.types.ts index 973889802..d036f8ee1 100644 --- a/src/@types/stores.types.ts +++ b/src/@types/stores.types.ts | |||
@@ -90,7 +90,6 @@ export interface AppStore extends TypedStore { | |||
90 | clearAppCacheRequest: () => void; | 90 | clearAppCacheRequest: () => void; |
91 | clipboardNotifications: boolean; | 91 | clipboardNotifications: boolean; |
92 | darkMode: boolean; | 92 | darkMode: boolean; |
93 | dictionaries: []; | ||
94 | enableSpellchecking: boolean; | 93 | enableSpellchecking: boolean; |
95 | enableTranslator: boolean; | 94 | enableTranslator: boolean; |
96 | fetchDataInterval: 4; | 95 | fetchDataInterval: 4; |
@@ -234,7 +233,6 @@ interface SettingsStore extends TypedStore { | |||
234 | remove: (value: any) => void; | 233 | remove: (value: any) => void; |
235 | fileSystemSettingsTypes: any[]; | 234 | fileSystemSettingsTypes: any[]; |
236 | loaded: boolean; | 235 | loaded: boolean; |
237 | updateAppSettingsRequest: () => void; | ||
238 | _fileSystemSettingsCache: () => void; | 236 | _fileSystemSettingsCache: () => void; |
239 | all: ISettings; | 237 | all: ISettings; |
240 | app: AppStore; | 238 | app: AppStore; |
@@ -304,7 +302,6 @@ interface UserStore extends TypedStore { | |||
304 | accountType: () => void; | 302 | accountType: () => void; |
305 | authToken: () => void; | 303 | authToken: () => void; |
306 | deleteAccountRequest: () => void; | 304 | deleteAccountRequest: () => void; |
307 | fetchUserInfoInterval: null; | ||
308 | getLegacyServicesRequest: () => void; | 305 | getLegacyServicesRequest: () => void; |
309 | getUserInfoRequest: CachedRequest; | 306 | getUserInfoRequest: CachedRequest; |
310 | hasCompletedSignup: () => void; | 307 | hasCompletedSignup: () => void; |
@@ -327,15 +324,10 @@ interface UserStore extends TypedStore { | |||
327 | _retrievePassword: () => void; | 324 | _retrievePassword: () => void; |
328 | changeServerRoute: () => void; | 325 | changeServerRoute: () => void; |
329 | data: User; | 326 | data: User; |
330 | importRoute: string; | ||
331 | inviteRoute: string; | ||
332 | isLoggedIn: boolean; | 327 | isLoggedIn: boolean; |
333 | isTokenExpired: boolean; | 328 | isTokenExpired: boolean; |
334 | legacyServices: () => void; | ||
335 | loginRoute: string; | 329 | loginRoute: string; |
336 | logoutRoute: string; | ||
337 | passwordRoute: string; | 330 | passwordRoute: string; |
338 | setupRoute: string; | ||
339 | signupRoute: string; | 331 | signupRoute: string; |
340 | team: () => void; | 332 | team: () => void; |
341 | } | 333 | } |
diff --git a/src/api/UserApi.ts b/src/api/UserApi.ts index 9364b3383..38f489131 100644 --- a/src/api/UserApi.ts +++ b/src/api/UserApi.ts | |||
@@ -52,10 +52,6 @@ export default class UserApi { | |||
52 | return this.server.updateUserInfo(userData); | 52 | return this.server.updateUserInfo(userData); |
53 | } | 53 | } |
54 | 54 | ||
55 | getLegacyServices() { | ||
56 | return this.server.getLegacyServices(); | ||
57 | } | ||
58 | |||
59 | delete() { | 55 | delete() { |
60 | return this.server.deleteAccount(); | 56 | return this.server.deleteAccount(); |
61 | } | 57 | } |
diff --git a/src/api/server/ServerApi.ts b/src/api/server/ServerApi.ts index 1530dd478..9e7582e1e 100644 --- a/src/api/server/ServerApi.ts +++ b/src/api/server/ServerApi.ts | |||
@@ -22,7 +22,7 @@ import UserModel from '../../models/User'; | |||
22 | import sleep from '../../helpers/async-helpers'; | 22 | import sleep from '../../helpers/async-helpers'; |
23 | 23 | ||
24 | import { SERVER_NOT_LOADED } from '../../config'; | 24 | import { SERVER_NOT_LOADED } from '../../config'; |
25 | import { userDataRecipesPath, userDataPath } from '../../environment-remote'; | 25 | import { userDataRecipesPath } 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 { | 28 | import { |
@@ -500,40 +500,6 @@ export default class ServerApi { | |||
500 | debug('ServerApi::healthCheck resolves'); | 500 | debug('ServerApi::healthCheck resolves'); |
501 | } | 501 | } |
502 | 502 | ||
503 | async getLegacyServices() { | ||
504 | const file = userDataPath('settings', 'services.json'); | ||
505 | |||
506 | try { | ||
507 | const config = readJsonSync(file); | ||
508 | |||
509 | if (Object.hasOwn(config, 'services')) { | ||
510 | const services = await Promise.all( | ||
511 | config.services.map(async (s: { service: any }) => { | ||
512 | const service = s; | ||
513 | const request = await sendAuthRequest( | ||
514 | `${apiBase()}/recipes/${s.service}`, | ||
515 | ); | ||
516 | |||
517 | if (request.status === 200) { | ||
518 | const data = await request.json(); | ||
519 | // @ts-expect-error Property 'recipe' does not exist on type '{ service: any; }'. | ||
520 | service.recipe = new RecipePreviewModel(data); | ||
521 | } | ||
522 | |||
523 | return service; | ||
524 | }), | ||
525 | ); | ||
526 | |||
527 | debug('ServerApi::getLegacyServices resolves', services); | ||
528 | return services; | ||
529 | } | ||
530 | } catch { | ||
531 | console.error('ServerApi::getLegacyServices no config found'); | ||
532 | } | ||
533 | |||
534 | return []; | ||
535 | } | ||
536 | |||
537 | // Helper | 503 | // Helper |
538 | async _mapServiceModels(services: any[]) { | 504 | async _mapServiceModels(services: any[]) { |
539 | const recipes = services.map((s: { recipeId: string }) => s.recipeId); | 505 | const recipes = services.map((s: { recipeId: string }) => s.recipeId); |
diff --git a/src/config.ts b/src/config.ts index 922b01628..fd1b1cced 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -27,12 +27,8 @@ export const LIVE_API_FERDIUM_WEBSITE = 'https://ferdium.org'; | |||
27 | export const LIVE_API_FERDIUM_LIBRETRANSLATE = | 27 | export const LIVE_API_FERDIUM_LIBRETRANSLATE = |
28 | 'https://translator.ferdium.org/translate'; | 28 | 'https://translator.ferdium.org/translate'; |
29 | 29 | ||
30 | export const STATS_API = 'https://stats.franzinfra.com'; | ||
31 | |||
32 | export const LOCAL_TODOS_FRONTEND_URL = 'http://localhost:4000'; | 30 | export const LOCAL_TODOS_FRONTEND_URL = 'http://localhost:4000'; |
33 | export const PRODUCTION_TODOS_FRONTEND_URL = 'https://app.franztodos.com'; | 31 | export const PRODUCTION_TODOS_FRONTEND_URL = 'https://app.franztodos.com'; |
34 | export const DEVELOPMENT_TODOS_FRONTEND_URL = | ||
35 | 'https://development--franz-todos.netlify.com'; | ||
36 | 32 | ||
37 | export const CDN_URL = 'https://cdn.franzinfra.com'; | 33 | export const CDN_URL = 'https://cdn.franzinfra.com'; |
38 | 34 | ||
@@ -282,11 +278,6 @@ export const TODO_APPS = { | |||
282 | [CUSTOM_TODO_SERVICE]: 'Other service', | 278 | [CUSTOM_TODO_SERVICE]: 'Other service', |
283 | }; | 279 | }; |
284 | 280 | ||
285 | export const DEFAULT_TODO_SERVICE = TODO_TODOIST_URL; | ||
286 | export const DEFAULT_TODO_RECIPE_ID = | ||
287 | TODO_SERVICE_RECIPE_IDS[DEFAULT_TODO_SERVICE]; | ||
288 | export const DEFAULT_TODO_SERVICE_NAME = TODO_APPS[DEFAULT_TODO_SERVICE]; | ||
289 | |||
290 | export const SIDEBAR_WIDTH = { | 281 | export const SIDEBAR_WIDTH = { |
291 | 35: 'Extremely slim sidebar', | 282 | 35: 'Extremely slim sidebar', |
292 | 45: 'Very slim sidebar', | 283 | 45: 'Very slim sidebar', |
@@ -385,7 +376,7 @@ export const DEFAULT_APP_SETTINGS = { | |||
385 | 376 | ||
386 | // Ferdium specific options | 377 | // Ferdium specific options |
387 | server: LIVE_FERDIUM_API, | 378 | server: LIVE_FERDIUM_API, |
388 | predefinedTodoServer: DEFAULT_TODO_SERVICE, | 379 | predefinedTodoServer: TODO_TODOIST_URL, |
389 | autohideMenuBar: false, | 380 | autohideMenuBar: false, |
390 | lockingFeatureEnabled: false, | 381 | lockingFeatureEnabled: false, |
391 | locked: false, | 382 | locked: false, |
diff --git a/src/environment-remote.ts b/src/environment-remote.ts index da1477346..7662d69a0 100644 --- a/src/environment-remote.ts +++ b/src/environment-remote.ts | |||
@@ -10,8 +10,6 @@ import { | |||
10 | LIVE_WS_API, | 10 | LIVE_WS_API, |
11 | LOCAL_WS_API, | 11 | LOCAL_WS_API, |
12 | DEV_WS_API, | 12 | DEV_WS_API, |
13 | LOCAL_TODOS_FRONTEND_URL, | ||
14 | PRODUCTION_TODOS_FRONTEND_URL, | ||
15 | } from './config'; | 13 | } from './config'; |
16 | import { isWindows } from './environment'; | 14 | import { isWindows } from './environment'; |
17 | 15 | ||
@@ -56,28 +54,23 @@ export const useLiveAPI = process.env.USE_LIVE_API; | |||
56 | let api: string; | 54 | let api: string; |
57 | let wsApi: string; | 55 | let wsApi: string; |
58 | let web: string; | 56 | let web: string; |
59 | let todos: string; | ||
60 | if (!isDevMode || (isDevMode && useLiveAPI)) { | 57 | if (!isDevMode || (isDevMode && useLiveAPI)) { |
61 | api = LIVE_FERDIUM_API; | 58 | api = LIVE_FERDIUM_API; |
62 | wsApi = LIVE_WS_API; | 59 | wsApi = LIVE_WS_API; |
63 | web = LIVE_API_FERDIUM_WEBSITE; | 60 | web = LIVE_API_FERDIUM_WEBSITE; |
64 | todos = PRODUCTION_TODOS_FRONTEND_URL; | ||
65 | } else if (isDevMode && useLocalAPI) { | 61 | } else if (isDevMode && useLocalAPI) { |
66 | api = LOCAL_API; | 62 | api = LOCAL_API; |
67 | wsApi = LOCAL_WS_API; | 63 | wsApi = LOCAL_WS_API; |
68 | web = LOCAL_API_WEBSITE; | 64 | web = LOCAL_API_WEBSITE; |
69 | todos = LOCAL_TODOS_FRONTEND_URL; | ||
70 | } else { | 65 | } else { |
71 | api = DEV_FRANZ_API; | 66 | api = DEV_FRANZ_API; |
72 | wsApi = DEV_WS_API; | 67 | wsApi = DEV_WS_API; |
73 | web = DEV_API_FRANZ_WEBSITE; | 68 | web = DEV_API_FRANZ_WEBSITE; |
74 | todos = PRODUCTION_TODOS_FRONTEND_URL; | ||
75 | } | 69 | } |
76 | 70 | ||
77 | export const API: string = api; | 71 | export const API: string = api; |
78 | export const API_VERSION: string = 'v1'; | 72 | export const API_VERSION: string = 'v1'; |
79 | export const WS_API: string = wsApi; | 73 | export const WS_API: string = wsApi; |
80 | export const WEBSITE: string = web; | 74 | export const WEBSITE: string = web; |
81 | export const TODOS_FRONTEND: string = todos; | ||
82 | // For deeplink protocol: 'ferdium' or 'ferdium-dev' if we want '{DEEPLINK_PROTOCOL_CLIENT}://' | 75 | // For deeplink protocol: 'ferdium' or 'ferdium-dev' if we want '{DEEPLINK_PROTOCOL_CLIENT}://' |
83 | export const protocolClient = isDevMode ? 'ferdium-dev' : 'ferdium'; | 76 | export const protocolClient = isDevMode ? 'ferdium-dev' : 'ferdium'; |
diff --git a/src/features/workspaces/store.ts b/src/features/workspaces/store.ts index 34a4126c8..f97009186 100644 --- a/src/features/workspaces/store.ts +++ b/src/features/workspaces/store.ts | |||
@@ -51,11 +51,6 @@ export default class WorkspacesStore extends FeatureStore { | |||
51 | return getUserWorkspacesRequest.result || []; | 51 | return getUserWorkspacesRequest.result || []; |
52 | } | 52 | } |
53 | 53 | ||
54 | @computed get isLoadingWorkspaces() { | ||
55 | if (!this.isFeatureActive) return false; | ||
56 | return getUserWorkspacesRequest.isExecutingFirstTime; | ||
57 | } | ||
58 | |||
59 | @computed get settings() { | 54 | @computed get settings() { |
60 | return localStorage.getItem('workspaces') || {}; | 55 | return localStorage.getItem('workspaces') || {}; |
61 | } | 56 | } |
diff --git a/src/models/User.ts b/src/models/User.ts index 6540a14e9..f89ea0465 100644 --- a/src/models/User.ts +++ b/src/models/User.ts | |||
@@ -27,8 +27,6 @@ export default class User { | |||
27 | 27 | ||
28 | @observable accountType: string | null = null; | 28 | @observable accountType: string | null = null; |
29 | 29 | ||
30 | @observable emailIsConfirmed = true; | ||
31 | |||
32 | // Note: Kept around to be able to handle the response from Franz server | 30 | // Note: Kept around to be able to handle the response from Franz server |
33 | // better assume it's confirmed to avoid noise | 31 | // better assume it's confirmed to avoid noise |
34 | @observable subscription = {}; | 32 | @observable subscription = {}; |
diff --git a/src/stores/AppStore.ts b/src/stores/AppStore.ts index 9af0a9a4f..b8c980dea 100644 --- a/src/stores/AppStore.ts +++ b/src/stores/AppStore.ts | |||
@@ -126,8 +126,6 @@ export default class AppStore extends TypedStore { | |||
126 | 126 | ||
127 | @observable launchInBackground = DEFAULT_APP_SETTINGS.autoLaunchInBackground; | 127 | @observable launchInBackground = DEFAULT_APP_SETTINGS.autoLaunchInBackground; |
128 | 128 | ||
129 | dictionaries = []; | ||
130 | |||
131 | fetchDataInterval: NodeJS.Timeout | null = null; | 129 | fetchDataInterval: NodeJS.Timeout | null = null; |
132 | 130 | ||
133 | @observable downloads: Download[] = []; | 131 | @observable downloads: Download[] = []; |
diff --git a/src/stores/SettingsStore.ts b/src/stores/SettingsStore.ts index 90cd82690..2e8568134 100644 --- a/src/stores/SettingsStore.ts +++ b/src/stores/SettingsStore.ts | |||
@@ -11,17 +11,11 @@ import { | |||
11 | LOCAL_SERVER, | 11 | LOCAL_SERVER, |
12 | } from '../config'; | 12 | } from '../config'; |
13 | import { hash } from '../helpers/password-helpers'; | 13 | import { hash } from '../helpers/password-helpers'; |
14 | import Request from './lib/Request'; | ||
15 | import TypedStore from './lib/TypedStore'; | 14 | import TypedStore from './lib/TypedStore'; |
16 | 15 | ||
17 | const debug = require('../preload-safe-debug')('Ferdium:SettingsStore'); | 16 | const debug = require('../preload-safe-debug')('Ferdium:SettingsStore'); |
18 | 17 | ||
19 | export default class SettingsStore extends TypedStore { | 18 | export default class SettingsStore extends TypedStore { |
20 | @observable updateAppSettingsRequest = new Request( | ||
21 | this.api.local, | ||
22 | 'updateAppSettings', | ||
23 | ); | ||
24 | |||
25 | @observable loaded: boolean = false; | 19 | @observable loaded: boolean = false; |
26 | 20 | ||
27 | fileSystemSettingsTypes = FILE_SYSTEM_SETTINGS_TYPES; | 21 | fileSystemSettingsTypes = FILE_SYSTEM_SETTINGS_TYPES; |
diff --git a/src/stores/UserStore.ts b/src/stores/UserStore.ts index f98f7d340..9c3fcd3b9 100644 --- a/src/stores/UserStore.ts +++ b/src/stores/UserStore.ts | |||
@@ -60,11 +60,6 @@ export default class UserStore extends TypedStore { | |||
60 | 'updateInfo', | 60 | 'updateInfo', |
61 | ); | 61 | ); |
62 | 62 | ||
63 | @observable getLegacyServicesRequest: CachedRequest = new CachedRequest( | ||
64 | this.api.user, | ||
65 | 'getLegacyServices', | ||
66 | ); | ||
67 | |||
68 | @observable deleteAccountRequest: CachedRequest = new CachedRequest( | 63 | @observable deleteAccountRequest: CachedRequest = new CachedRequest( |
69 | this.api.user, | 64 | this.api.user, |
70 | 'delete', | 65 | 'delete', |
@@ -93,8 +88,6 @@ export default class UserStore extends TypedStore { | |||
93 | 88 | ||
94 | @observable logoutReason: string | null = null; | 89 | @observable logoutReason: string | null = null; |
95 | 90 | ||
96 | fetchUserInfoInterval = null; | ||
97 | |||
98 | constructor(stores: Stores, api: ApiInterface, actions: Actions) { | 91 | constructor(stores: Stores, api: ApiInterface, actions: Actions) { |
99 | super(stores, api, actions); | 92 | super(stores, api, actions); |
100 | 93 | ||
@@ -132,26 +125,10 @@ export default class UserStore extends TypedStore { | |||
132 | return this.LOGIN_ROUTE; | 125 | return this.LOGIN_ROUTE; |
133 | } | 126 | } |
134 | 127 | ||
135 | get logoutRoute(): string { | ||
136 | return this.LOGOUT_ROUTE; | ||
137 | } | ||
138 | |||
139 | get signupRoute(): string { | 128 | get signupRoute(): string { |
140 | return this.SIGNUP_ROUTE; | 129 | return this.SIGNUP_ROUTE; |
141 | } | 130 | } |
142 | 131 | ||
143 | get setupRoute(): string { | ||
144 | return this.SETUP_ROUTE; | ||
145 | } | ||
146 | |||
147 | get inviteRoute(): string { | ||
148 | return this.INVITE_ROUTE; | ||
149 | } | ||
150 | |||
151 | get importRoute(): string { | ||
152 | return this.IMPORT_ROUTE; | ||
153 | } | ||
154 | |||
155 | get passwordRoute(): string { | 132 | get passwordRoute(): string { |
156 | return this.PASSWORD_ROUTE; | 133 | return this.PASSWORD_ROUTE; |
157 | } | 134 | } |
@@ -191,10 +168,6 @@ export default class UserStore extends TypedStore { | |||
191 | return this.data.team || null; | 168 | return this.data.team || null; |
192 | } | 169 | } |
193 | 170 | ||
194 | @computed get legacyServices(): any { | ||
195 | return this.getLegacyServicesRequest.execute() || {}; | ||
196 | } | ||
197 | |||
198 | // Actions | 171 | // Actions |
199 | @action async _login({ email, password }): Promise<void> { | 172 | @action async _login({ email, password }): Promise<void> { |
200 | const authToken = await this.loginRequest.execute(email, password).promise; | 173 | const authToken = await this.loginRequest.execute(email, password).promise; |
diff --git a/src/stores/lib/Request.ts b/src/stores/lib/Request.ts index 911c5ccfb..587af87d7 100644 --- a/src/stores/lib/Request.ts +++ b/src/stores/lib/Request.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { observable, action, computed, makeObservable } from 'mobx'; | 1 | import { observable, action, computed, makeObservable } from 'mobx'; |
2 | import { isEqual } from 'lodash/fp'; | ||
3 | 2 | ||
4 | // eslint-disable-next-line no-use-before-define | 3 | // eslint-disable-next-line no-use-before-define |
5 | type Hook = (request: Request) => void; | 4 | type Hook = (request: Request) => void; |
@@ -123,14 +122,6 @@ export default class Request { | |||
123 | return this.execute(...args); | 122 | return this.execute(...args); |
124 | } | 123 | } |
125 | 124 | ||
126 | isExecutingWithArgs(...args: any[]): boolean { | ||
127 | return ( | ||
128 | this.isExecuting && | ||
129 | this.currentApiCall && | ||
130 | isEqual(this.currentApiCall.args, args) | ||
131 | ); | ||
132 | } | ||
133 | |||
134 | @computed get isExecutingFirstTime(): boolean { | 125 | @computed get isExecutingFirstTime(): boolean { |
135 | return !this.wasExecuted && this.isExecuting; | 126 | return !this.wasExecuted && this.isExecuting; |
136 | } | 127 | } |