Skip to content

Commit

Permalink
Start detecting if user uses Meowser or not
Browse files Browse the repository at this point in the history
  • Loading branch information
katniny committed Dec 2, 2024
1 parent b485115 commit eae779a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
52 changes: 30 additions & 22 deletions assets/js/ts_fas_acih.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let isOnDesktopApp = null;

// TransSocial Version
let transsocialVersion = "v2024.12.1";
let transsocialUpdate = "v2024121-1";
let transsocialUpdate = "v2024121-2";
let transsocialReleaseVersion = "pre-alpha";

const notices = document.getElementsByClassName("version-notice");
Expand Down Expand Up @@ -69,27 +69,35 @@ const userAgent = navigator.userAgent;
let browserName = "Unknown Browser";
let browserVersion = "Unknown version";

if (userAgent.indexOf("Firefox") > -1) {
browserName = "Mozilla Firefox";
browserVersion = userAgent.match(/Firefox\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("SamsungBrowser") > -1) {
browserName = "Samsung Browser";
browserVersion = userAgent.match(/SamsungBrowser\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("Opera") > -1 || userAgent.indexOf("OPR") > -1) {
browserName = "Opera";
browserVersion = userAgent.match(/(Opera|OPR)\/([0-9.]+)/)[2];
} else if (userAgent.indexOf("Trident") > -1) {
browserName = "Internet Explorer";
browserVersion = userAgent.match(/rv:([0-9.]+)/)[1];
} else if (userAgent.indexOf("Edge") > -1) {
browserName = "Microsoft Edge";
browserVersion = userAgent.match(/Edge\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("Chrome") > -1) {
browserName = "Google Chrome";
browserVersion = userAgent.match(/Chrome\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("Safari") > -1) {
browserName = "Apple Safari";
browserVersion = userAgent.match(/Version\/([0-9.]+)/)[1];
const meowserAgentSubstring = "meowser";
console.log(userAgent);
if (userAgent.indexOf(meowserAgentSubstring) > -1) {
browserName = "Meowser";
let versionMatch = userAgent.match(/meowser\/([\d.]+)/);
browserVersion = versionMatch ? versionMatch[1] : "unknown version";
} else {
if (userAgent.indexOf("Firefox") > -1) {
browserName = "Mozilla Firefox";
browserVersion = userAgent.match(/Firefox\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("SamsungBrowser") > -1) {
browserName = "Samsung Browser";
browserVersion = userAgent.match(/SamsungBrowser\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("OPR") > -1 || userAgent.indexOf("Opera") > -1) {
browserName = "Opera";
browserVersion = userAgent.match(/(Opera|OPR)\/([0-9.]+)/)[2];
} else if (userAgent.indexOf("Trident") > -1) {
browserName = "Internet Explorer";
browserVersion = userAgent.match(/rv:([0-9.]+)/)[1];
} else if (userAgent.indexOf("Edge") > -1) {
browserName = "Microsoft Edge";
browserVersion = userAgent.match(/Edge\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("Chrome") > -1) {
browserName = "Google Chrome";
browserVersion = userAgent.match(/Chrome\/([0-9.]+)/)[1];
} else if (userAgent.indexOf("Safari") > -1) {
browserName = "Apple Safari";
browserVersion = userAgent.match(/Version\/([0-9.]+)/)[1];
}
}

if (document.getElementById("userBrowser")) { // environment settings
Expand Down
1 change: 1 addition & 0 deletions updates.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ <h1 id="selectedFilter" style="text-decoration: underline; margin-bottom: 5px;">
<h2>v2024.12.1_pre-alpha</h2>
<h3 style="color: var(--text-semi-transparent);">Released: December 1, 2024</h3>
<li>Added Santa hat to header (it's December, I have to)</li>
<li>Detect if you're using <a href="https://github.com/katniny/meowser/releases/latest" target="_blank">Meowser</a> or not</li>
</div>

<br />
Expand Down

0 comments on commit eae779a

Please sign in to comment.