From f92965961f58a48104fed766d16b08725fff666b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=86=E6=9C=A8?= <43062104+yumusb@users.noreply.github.com> Date: Tue, 8 Aug 2023 21:12:09 +0800 Subject: [PATCH] Add windows 11 Add windows 11 --- lib/detect.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/detect.ts b/lib/detect.ts index 9c1e1fa49..0e925d185 100644 --- a/lib/detect.ts +++ b/lib/detect.ts @@ -110,7 +110,11 @@ export async function getClientInfo(req: NextApiRequestCollect, { screen }) { const subdivision2 = location?.subdivision2; const city = location?.city; const browser = browserName(userAgent); - const os = detectOS(userAgent); + // ref https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11 + let os = detectOS(userAgent); + if (os === "Windows 10" && parseInt(req.headers['sec-ch-ua-platform-version'].split('.')[0], 10) >= 13) { + os = "Windows 11"; + } const device = getDevice(screen, os); return { userAgent, browser, os, ip, country, subdivision1, subdivision2, city, device };