From a91488aff4bc94fabb4f11728d3149b6fbcd0bb8 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 9 Jul 2020 17:06:01 +0000 Subject: [PATCH] still fixing WSL --- _webi/ua-detect.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/_webi/ua-detect.js b/_webi/ua-detect.js index b174fd4..89c18c8 100644 --- a/_webi/ua-detect.js +++ b/_webi/ua-detect.js @@ -10,14 +10,17 @@ function getOs(ua) { return 'android'; } else if (/iOS|iPhone|Macintosh|Darwin|OS\s*X|macOS|mac/i.test(ua)) { return 'macos'; - } else if (/^ms$|Microsoft|Windows|win32|win|PowerShell/i.test(ua)) { + } else if (/Linux/i.test(ua) && !/cygwin|msysgit/i.test(ua)) { // It's the year of the Linux Desktop! - // (TODO: what about cygwin / msysgit?) // See also http://www.mslinux.org/ // 'linux' must be tested before 'Microsoft' because WSL + // (TODO: does this affect cygwin / msysgit?) + return 'linux'; + } else if (/^ms$|Microsoft|Windows|win32|win|PowerShell/i.test(ua)) { // 'win' must be tested after 'darwin' return 'windows'; } else if (/Linux|curl|wget/i.test(ua)) { + // test 'linux' again, after 'win' return 'linux'; } else { return 'error'; -- 2.25.1