Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: don't autoblock non-chrome browsers #2096

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions resources/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
localStorage.setItem("day8.re-frame-10x.show-panel","\"true\"")
localStorage.setItem("day8.re-frame-10x.using-trace?","\"true\"")
}
function isBrowserSupported() {
return userAgent.indexOf("chrome/") > -1;
function isBrowserUnsupported() {
return userAgent.indexOf("applewebkit/") > -1;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't right, the user agent for chrome under macos is 'mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/100.0.4896.75 safari/537.36'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brave is also the above.

Firefox is "mozilla/5.0 (macintosh; intel mac os x 10.15; rv:98.0) gecko/20100101 firefox/98.0".

Safari is "mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/605.1.15 (khtml, like gecko) version/15.4 safari/605.1.15"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this check and can verify it works as follows:

MacOS:

  • Safari shows the Safari based browsers based are not supported message
  • Chrome, Firefox and Brave don't

iOS:

  • All browsers show the Safari based browsers based are not supported message.

}
function showUnsupportedBrowserWarning() {
let warnDiv = window.document.createElement("div");
warnDiv.innerText = "Only browsers based on Chrome/Chromium are supported";
warnDiv.innerText = "Safari based browsers based are not supported";
window.document.body.appendChild(warnDiv);
}
</script>
<script>
if (!isBrowserSupported()) {
if (isBrowserUnsupported()) {
showUnsupportedBrowserWarning();
} else {
var electron = isElectron()
Expand Down
3 changes: 2 additions & 1 deletion src/cljs/athens/util.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@
[(case os
:windows "os-windows"
:mac "os-mac"
:linux "os-linux")
:linux "os-linux"
"os-linux")
(if electron? "is-electron" "is-web")
(if theme-dark? "is-theme-dark" "is-theme-light")
(when win-focused? "is-focused")
Expand Down