Files
clash-proxy/src/utils/get-system.ts

15 lines
356 B
TypeScript
Raw Normal View History

2022-03-22 01:36:06 +08:00
// get the system os
// according to UA
export default function getSystem() {
const ua = navigator.userAgent;
2023-01-14 12:07:31 +08:00
const platform = OS_PLATFORM;
2022-03-22 01:36:06 +08:00
2023-01-14 12:07:31 +08:00
if (ua.includes("Mac OS X") || platform === "darwin") return "macos";
2022-03-22 01:36:06 +08:00
2023-01-14 12:07:31 +08:00
if (/win64|win32/i.test(ua) || platform === "win32") return "windows";
2022-03-22 01:36:06 +08:00
if (/linux/i.test(ua)) return "linux";
return "unknown";
}