diff --git a/middleware/auth.ts b/middleware/auth.ts index 7d5c36c4..2f048b7e 100644 --- a/middleware/auth.ts +++ b/middleware/auth.ts @@ -15,6 +15,14 @@ export default defineNuxtRouteMiddleware((to) => { function handleAuth(to: RouteLocationNormalized) { if (to.path === '/') { + // handle PWA protocol handler + if (to.query['protocol-handler'] && to.query.target) { + const target = decodeURIComponent(to.query.target as string).replace(/^web\+ap:\/\//, 'https://') + // eslint-disable-next-line no-console + console.log(target) + return navigateTo('/home') + } + // Installed PWA shortcut to notifications if (to.query['notifications-pwa-shortcut'] !== undefined) { if (currentUser.value) diff --git a/modules/pwa/i18n.ts b/modules/pwa/i18n.ts index e1cfe25b..f489e021 100644 --- a/modules/pwa/i18n.ts +++ b/modules/pwa/i18n.ts @@ -124,6 +124,10 @@ export async function createI18n(): Promise { edge_side_panel: { preferred_width: 480, }, + protocol_handlers: [{ + protocol: 'web+ap', + url: '/?protocol-handler=1&target=%s', + }], } if (env === 'release') {