ENH - complete and secure EasyShare integration

This commit is contained in:
smx.pusha
2026-08-12 07:15:26 +02:00
parent 14f0b7a178
commit eeb3396f52
18 changed files with 959 additions and 39 deletions
+40
View File
@@ -0,0 +1,40 @@
import type { Router } from 'vue-router'
import { getPhoneApp } from '@/config/apps'
import type { EasySharePayload } from '@/types/easyshare'
const schemeRoutes: Record<string, string> = {
location: '/apps/map',
media: '/apps/photos',
phone: '/apps/phone',
}
export function easyShareRoute(payload: EasySharePayload): {
path: string
query: Record<string, string>
} {
const match = payload.link?.match(/^skyphone:\/\/([^/]+)(?:\/([^/]+))?(?:\/(.+))?$/)
const schemeApp = match?.[1]
const app = schemeApp ? getPhoneApp(schemeApp) : getPhoneApp(payload.appId)
const path =
(schemeApp && schemeRoutes[schemeApp]) || app?.route || '/'
const query: Record<string, string> = {
easyShareId: String(payload.id ?? match?.[3] ?? match?.[2] ?? ''),
easyShareKind: payload.kind,
easyShareLink: payload.link ?? '',
}
if (schemeApp === 'citymarkt' && match?.[2] === 'listing' && match[3]) {
query.listingId = decodeURIComponent(match[3])
}
return {
path,
query,
}
}
export async function openEasySharePayload(
router: Router,
payload: EasySharePayload,
): Promise<void> {
await router.push(easyShareRoute(payload))
}