mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-02-12 15:02:45 +00:00
update tag schema
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
import { lprBaseTags } from "@/constants";
|
||||
|
||||
export function createDeflockProfileUrl(obj: Record<string, string>): string {
|
||||
interface DeflockProfileTags {
|
||||
name: string;
|
||||
tags: Record<string, string>;
|
||||
requiresDirection: boolean;
|
||||
submittable: boolean;
|
||||
fov: number;
|
||||
}
|
||||
|
||||
export function createDeflockProfileUrl(name: string, obj: Record<string, string>): string {
|
||||
const tags = { ...lprBaseTags, ...obj };
|
||||
const payload = btoa(JSON.stringify(tags));
|
||||
const profile: DeflockProfileTags = {
|
||||
name,
|
||||
tags,
|
||||
requiresDirection: true,
|
||||
submittable: true,
|
||||
fov: 90.0,
|
||||
};
|
||||
const payload = btoa(JSON.stringify(profile));
|
||||
return `deflockapp://profiles/add?p=${payload}`;
|
||||
}
|
||||
@@ -226,7 +226,7 @@ onMounted(async () => {
|
||||
const router = useRouter();
|
||||
|
||||
async function onAddToApp(vendor: LprVendor) {
|
||||
const url = createDeflockProfileUrl(vendor.osmTags);
|
||||
const url = createDeflockProfileUrl(vendor.shortName, vendor.osmTags);
|
||||
const ua = typeof navigator !== 'undefined' && navigator.userAgent ? navigator.userAgent : '';
|
||||
const isMobile = /iphone|ipod|ipad|android|blackberry|bb|playbook|windows phone|iemobile|opera mini|mobile/i.test(ua);
|
||||
if (isMobile) {
|
||||
@@ -238,7 +238,8 @@ async function onAddToApp(vendor: LprVendor) {
|
||||
}
|
||||
} else {
|
||||
// on Desktop
|
||||
router.push('/app');
|
||||
console.log(`Deflock profile URL: ${url}`);
|
||||
// router.push('/app');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user