clash-verge/src/utils/get-system.ts
2022-03-22 01:36:06 +08:00

14 lines
275 B
TypeScript

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