28 lines
891 B
TypeScript
28 lines
891 B
TypeScript
// src/lib/init.ts
|
|
import { isBluetoothSupported, isSerialSupported, isInitializing } from './store';
|
|
import { refreshLocal } from './sync';
|
|
|
|
export function getBrowserName(): string {
|
|
const ua = navigator.userAgent;
|
|
if (ua.includes("Firefox")) return "Feuerfuchs";
|
|
if (ua.includes("Safari") && !ua.includes("Chrome")) return "Apfel-Rundreise";
|
|
if (ua.includes("Edg")) return "Winzigweich Kante";
|
|
if (ua.includes("Chrome")) return "Google Glanzeisen";
|
|
return "dein Browser";
|
|
}
|
|
|
|
export function performHardwareCheck() {
|
|
if (typeof navigator === 'undefined') return;
|
|
|
|
// Web Bluetooth Check
|
|
const hasBT = 'bluetooth' in navigator;
|
|
// Web Serial Check
|
|
const hasSerial = 'serial' in navigator;
|
|
|
|
isBluetoothSupported.set(hasBT);
|
|
isSerialSupported.set(hasSerial);
|
|
|
|
refreshLocal().then(() => {
|
|
isInitializing.set(false);
|
|
});
|
|
} |