Wichige änderung an DB
This commit is contained in:
@@ -22,15 +22,17 @@ const qrContentSchema = z.object({
|
||||
url: z.string().url().optional(),
|
||||
phone: z.string().optional(),
|
||||
email: z.string().email().optional(),
|
||||
subject: z.string().optional(),
|
||||
message: z.string().optional(),
|
||||
text: z.string().optional(),
|
||||
ssid: z.string().optional(),
|
||||
password: z.string().optional(),
|
||||
security: z.enum(['WPA', 'WEP', 'nopass']).optional(),
|
||||
// VCARD fields
|
||||
firstName: z.string().optional(),
|
||||
lastName: z.string().optional(),
|
||||
organization: z.string().optional(),
|
||||
title: z.string().optional(),
|
||||
// GEO fields
|
||||
latitude: z.number().optional(),
|
||||
longitude: z.number().optional(),
|
||||
label: z.string().optional(),
|
||||
});
|
||||
|
||||
const qrStyleSchema = z.object({
|
||||
@@ -128,25 +130,26 @@ export function getQRContent(qr: any): string {
|
||||
return content.url || '';
|
||||
case 'PHONE':
|
||||
return `tel:${content.phone || ''}`;
|
||||
case 'EMAIL':
|
||||
const subject = content.subject ? `?subject=${encodeURIComponent(content.subject)}` : '';
|
||||
return `mailto:${content.email || ''}${subject}`;
|
||||
case 'SMS':
|
||||
const message = content.message ? `?body=${encodeURIComponent(content.message)}` : '';
|
||||
return `sms:${content.phone || ''}${message}`;
|
||||
case 'WHATSAPP':
|
||||
const whatsappMessage = content.message ? `?text=${encodeURIComponent(content.message)}` : '';
|
||||
return `https://wa.me/${content.phone || ''}${whatsappMessage}`;
|
||||
case 'WIFI':
|
||||
return `WIFI:T:${content.security || 'WPA'};S:${content.ssid || ''};P:${content.password || ''};;`;
|
||||
case 'VCARD':
|
||||
return `BEGIN:VCARD
|
||||
VERSION:3.0
|
||||
FN:${content.firstName || ''} ${content.lastName || ''}
|
||||
ORG:${content.organization || ''}
|
||||
TITLE:${content.title || ''}
|
||||
EMAIL:${content.email || ''}
|
||||
TEL:${content.phone || ''}
|
||||
END:VCARD`;
|
||||
case 'GEO':
|
||||
const lat = content.latitude || 0;
|
||||
const lon = content.longitude || 0;
|
||||
const label = content.label ? `?q=${encodeURIComponent(content.label)}` : '';
|
||||
return `geo:${lat},${lon}${label}`;
|
||||
case 'TEXT':
|
||||
return content.text || '';
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user