mirror of
https://github.com/Xevion/dynamic-preauth.git
synced 2025-12-07 16:07:04 -06:00
platform detection type + func
This commit is contained in:
@@ -9,3 +9,12 @@ export function cn(...inputs: ClassValue[]) {
|
||||
export function plural(text: string, count: number) {
|
||||
return `${text}${count === 1 ? "" : "s"}`;
|
||||
}
|
||||
|
||||
export type Platform = "windows" | "mac" | "linux";
|
||||
|
||||
export function os(): Platform | "other" {
|
||||
if (navigator.userAgent.includes("win")) return "windows";
|
||||
else if (navigator.userAgent.includes("mac")) return "mac";
|
||||
else if (navigator.userAgent.includes("linux")) return "linux";
|
||||
return "other";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user