clash-verge-rev/src/utils/get-system.ts
2023-01-14 12:07:31 +08:00

15 lines
356 B
TypeScript

// get the system os
// according to UA
export default function getSystem() {
const ua = navigator.userAgent;
const platform = OS_PLATFORM;
if (ua.includes("Mac OS X") || platform === "darwin") return "macos";
if (/win64|win32/i.test(ua) || platform === "win32") return "windows";
if (/linux/i.test(ua)) return "linux";
return "unknown";
}