Skip to content

Build your personal knowledge base with Trilium Notes

refactor(views/login): simplify userAgent matching

Panagiotis Papadopoulos15faf161b53b
diff --git a/src/views/login.ejs b/src/views/login.ejs
index 8142b1c1c2..af4152df57 100644
--- a/src/views/login.ejs
+++ b/src/views/login.ejs
@@ -66,9 +66,8 @@
if (mQ?.media === '(pointer:coarse)') return !!mQ.matches;
if ('orientation' in window) return true;
-
- return /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(navigator.userAgent) ||
- /\b(Android|Windows Phone|iPad|iPod)\b/i.test(navigator.userAgent);
+ const userAgentsRegEx = /\b(Android|iPhone|iPad|iPod|Windows Phone|BlackBerry|webOS|IEMobile)\b/i
+ return userAgentsRegEx.test(navigator.userAgent)
}
</script>