Use our exposed versions

This commit is contained in:
Amelia Frost 2026-04-04 15:43:57 -07:00
parent e56455fbaf
commit 22785a9860
No known key found for this signature in database
2 changed files with 48 additions and 53 deletions

View file

@ -1,39 +1,40 @@
(function () { (function () {
if (window.__AVIA_DESKTOP_PATCH__) return; if (window.__AVIA_DESKTOP_PATCH__) return;
window.__AVIA_DESKTOP_PATCH__ = true; window.__AVIA_DESKTOP_PATCH__ = true;
const AVIA_VERSION = "1.6.0"; function patchButton() {
document
.querySelectorAll("a.pos_relative.gap_16px.p_13px")
.forEach((el) => {
if (el.dataset.aviaPatched) return;
function patchButton() { const textContainer = el.querySelector(
document "div.d_flex.flex-g_1.flex-d_column",
.querySelectorAll("a.pos_relative.gap_16px.p_13px") );
.forEach(el => { if (!textContainer) return;
if (el.dataset.aviaPatched) return;
const textContainer = el.querySelector("div.d_flex.flex-g_1.flex-d_column"); const nameDiv = textContainer.querySelector("div");
if (!textContainer) return; const versionSpan = textContainer.querySelector("span.lh_1rem");
const nameDiv = textContainer.querySelector("div"); if (!nameDiv || !versionSpan) return;
const versionSpan = textContainer.querySelector("span.lh_1rem"); if (!nameDiv.textContent.includes("Stoat for Desktop")) return;
if (!nameDiv || !versionSpan) return; if (!versionSpan.textContent.includes("Version:")) return;
if (!nameDiv.textContent.includes("Stoat for Desktop")) return;
const match = versionSpan.textContent.match(/Version:\s*([0-9.]+)/); const aviaVersion = window.native.versions.aviaClient();
if (!match) return; const stoatVersion = window.native.versions.desktop();
const stoatVersion = match[1];
el.dataset.aviaPatched = "true"; el.dataset.aviaPatched = "true";
nameDiv.textContent = "Avia Client Desktop"; nameDiv.textContent = "Avia Client Desktop";
versionSpan.textContent = `Version ${AVIA_VERSION} (Based on Stoat ${stoatVersion})`; versionSpan.textContent = `Version ${aviaVersion} (Based on Stoat ${stoatVersion})`;
textContainer.style.whiteSpace = "normal"; textContainer.style.whiteSpace = "normal";
textContainer.style.overflow = "visible"; textContainer.style.overflow = "visible";
}); });
} }
const observer = new MutationObserver(patchButton); const observer = new MutationObserver(patchButton);
observer.observe(document.body, { childList: true, subtree: true }); observer.observe(document.body, { childList: true, subtree: true });
patchButton(); patchButton();
})(); })();

View file

@ -1,40 +1,34 @@
(function () { (function () {
if (window.__AVIA_VERSION_PATCH__) return;
window.__AVIA_VERSION_PATCH__ = true;
if (window.__AVIA_VERSION_PATCH__) return; function patchVersion() {
window.__AVIA_VERSION_PATCH__ = true; document
.querySelectorAll("span.lh_1rem.fs_0\\.75rem.ls_0\\.03125rem.fw_500")
.forEach((el) => {
if (el.dataset.aviaPatched) return;
function patchVersion() { if (!el.textContent.trim().startsWith("Stoat for Desktop")) return;
document const stoatVersion = window.native.versions.desktop();
.querySelectorAll("span.lh_1rem.fs_0\\.75rem.ls_0\\.03125rem.fw_500")
.forEach(el => {
if (el.dataset.aviaPatched) return; el.dataset.aviaPatched = "true";
const match = el.textContent.match(/Stoat for Desktop\s+([0-9.]+)/); el.innerHTML = `
if (!match) return;
const stoatVersion = match[1];
el.dataset.aviaPatched = "true";
el.innerHTML = `
Avia Client Desktop<br> Avia Client Desktop<br>
<span style="font-size:10px;opacity:0.7;"> <span style="font-size:10px;opacity:0.7;">
Based on Stoat ${stoatVersion} Based on Stoat ${stoatVersion}
</span> </span>
`; `;
}); });
} }
const observer = new MutationObserver(patchVersion); const observer = new MutationObserver(patchVersion);
observer.observe(document.body, { observer.observe(document.body, {
childList: true, childList: true,
subtree: true subtree: true,
}); });
patchVersion();
patchVersion();
})(); })();