diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/electron/deepLinking.ts | 3 | ||||
-rw-r--r-- | src/environment-remote.ts | 2 | ||||
-rw-r--r-- | src/index.ts | 2 | ||||
-rw-r--r-- | src/stores/AppStore.ts | 14 |
4 files changed, 19 insertions, 2 deletions
diff --git a/src/electron/deepLinking.ts b/src/electron/deepLinking.ts index 104aa2d83..14cb8e5b1 100644 --- a/src/electron/deepLinking.ts +++ b/src/electron/deepLinking.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { BrowserWindow } from 'electron'; | 1 | import { BrowserWindow } from 'electron'; |
2 | import { protocolClient } from '../environment-remote'; | ||
2 | 3 | ||
3 | export default function handleDeepLink( | 4 | export default function handleDeepLink( |
4 | window: BrowserWindow, | 5 | window: BrowserWindow, |
@@ -8,7 +9,7 @@ export default function handleDeepLink( | |||
8 | return; | 9 | return; |
9 | } | 10 | } |
10 | 11 | ||
11 | const url = rawUrl.replace('ferdium://', ''); | 12 | const url = rawUrl.replace(`${protocolClient}://`, ''); |
12 | 13 | ||
13 | // The next line is a workaround after this 71c5237 [chore: Mobx & React-Router upgrade (#406)]. | 14 | // The next line is a workaround after this 71c5237 [chore: Mobx & React-Router upgrade (#406)]. |
14 | // For some reason, the app won't start until because it's trying to route to './build'. | 15 | // For some reason, the app won't start until because it's trying to route to './build'. |
diff --git a/src/environment-remote.ts b/src/environment-remote.ts index 691e19ef4..da1477346 100644 --- a/src/environment-remote.ts +++ b/src/environment-remote.ts | |||
@@ -79,3 +79,5 @@ export const API_VERSION: string = 'v1'; | |||
79 | export const WS_API: string = wsApi; | 79 | export const WS_API: string = wsApi; |
80 | export const WEBSITE: string = web; | 80 | export const WEBSITE: string = web; |
81 | export const TODOS_FRONTEND: string = todos; | 81 | export const TODOS_FRONTEND: string = todos; |
82 | // For deeplink protocol: 'ferdium' or 'ferdium-dev' if we want '{DEEPLINK_PROTOCOL_CLIENT}://' | ||
83 | export const protocolClient = isDevMode ? 'ferdium-dev' : 'ferdium'; | ||
diff --git a/src/index.ts b/src/index.ts index 5accc4570..c765bac73 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -29,6 +29,7 @@ import { | |||
29 | isDevMode, | 29 | isDevMode, |
30 | userDataRecipesPath, | 30 | userDataRecipesPath, |
31 | userDataPath, | 31 | userDataPath, |
32 | protocolClient, | ||
32 | } from './environment-remote'; | 33 | } from './environment-remote'; |
33 | import { ifUndefined } from './jsUtils'; | 34 | import { ifUndefined } from './jsUtils'; |
34 | 35 | ||
@@ -469,7 +470,6 @@ app.on('ready', () => { | |||
469 | enforceMacOSAppLocation(); | 470 | enforceMacOSAppLocation(); |
470 | 471 | ||
471 | // Register App URL | 472 | // Register App URL |
472 | const protocolClient = isDevMode ? 'ferdium-dev' : 'ferdium'; | ||
473 | if (!app.isDefaultProtocolClient(protocolClient, process.execPath)) { | 473 | if (!app.isDefaultProtocolClient(protocolClient, process.execPath)) { |
474 | app.setAsDefaultProtocolClient(protocolClient, process.execPath); | 474 | app.setAsDefaultProtocolClient(protocolClient, process.execPath); |
475 | } | 475 | } |
diff --git a/src/stores/AppStore.ts b/src/stores/AppStore.ts index 1c1336819..df8c17c01 100644 --- a/src/stores/AppStore.ts +++ b/src/stores/AppStore.ts | |||
@@ -263,6 +263,20 @@ export default class AppStore extends TypedStore { | |||
263 | url = url.replace(/\/$/, ''); | 263 | url = url.replace(/\/$/, ''); |
264 | url = url.replace(/\s?--(updated)/, ''); | 264 | url = url.replace(/\s?--(updated)/, ''); |
265 | 265 | ||
266 | if (url.startsWith('service/')) { | ||
267 | const pattern = /service\/([^/]+)/; | ||
268 | // Use the exec method to extract the id from the URL | ||
269 | const match = pattern.exec(url); | ||
270 | |||
271 | if (match) { | ||
272 | const id = match[1]; // The id is captured in the first capture group | ||
273 | this.actions.service.setActive({ | ||
274 | serviceId: id, | ||
275 | }); | ||
276 | } | ||
277 | return; | ||
278 | } | ||
279 | |||
266 | this.stores.router.push(url); | 280 | this.stores.router.push(url); |
267 | }); | 281 | }); |
268 | 282 | ||