mirror of
https://github.com/CrazyJasonwell/clash-verge-rev.git
synced 2026-10-19 19:55:41 +08:00
fix: add os platform value
This commit is contained in:
1 parent
4642b79b5b
commit
ab161a42ee
4 files changed
+23
-6
No files matched your search
@@ -24,10 +24,6 @@ import useCustomTheme from "@/components/layout/use-custom-theme";
|
||||
import getSystem from "@/utils/get-system";
|
||||
import "dayjs/locale/zh-cn";
|
||||
|
||||
declare global {
|
||||
const WIN_PORTABLE: boolean;
|
||||
}
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const OS = getSystem();
|
||||
|
||||
Vendored
+19
@@ -1,3 +1,22 @@
|
||||
type Platform =
|
||||
| "aix"
|
||||
| "android"
|
||||
| "darwin"
|
||||
| "freebsd"
|
||||
| "haiku"
|
||||
| "linux"
|
||||
| "openbsd"
|
||||
| "sunos"
|
||||
| "win32"
|
||||
| "cygwin"
|
||||
| "netbsd";
|
||||
|
||||
/**
|
||||
* defines in `vite.config.ts`
|
||||
*/
|
||||
declare const WIN_PORTABLE: boolean;
|
||||
declare const OS_PLATFORM: Platform;
|
||||
|
||||
/**
|
||||
* Some interface for clash api
|
||||
*/
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
// according to UA
|
||||
export default function getSystem() {
|
||||
const ua = navigator.userAgent;
|
||||
const platform = OS_PLATFORM;
|
||||
|
||||
if (ua.includes("Mac OS X")) return "macos";
|
||||
if (ua.includes("Mac OS X") || platform === "darwin") return "macos";
|
||||
|
||||
if (/win64|win32/i.test(ua)) return "windows";
|
||||
if (/win64|win32/i.test(ua) || platform === "win32") return "windows";
|
||||
|
||||
if (/linux/i.test(ua)) return "linux";
|
||||
|
||||
|
||||
Reference in new issue
Block a user