mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
[client] Improved update checker
This commit is contained in:
parent
a4ccd41a30
commit
27a088a6a1
2 changed files with 39 additions and 13 deletions
|
@ -127,11 +127,24 @@ os.api("admin/abuse-user-reports", {
|
||||||
|
|
||||||
if (defaultStore.state.showAdminUpdates) {
|
if (defaultStore.state.showAdminUpdates) {
|
||||||
os.api("latest-version").then((res) => {
|
os.api("latest-version").then((res) => {
|
||||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ""));
|
if (!res?.tag_name) {
|
||||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
updateAvailable = false;
|
||||||
if (cleanRes > cleanVersion) {
|
return;
|
||||||
updateAvailable = true;
|
}
|
||||||
}
|
|
||||||
|
const tag = res.tag_name as string;
|
||||||
|
if (tag === `v${version}`) {
|
||||||
|
updateAvailable = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tagDate = tag.includes('-') ? tag.substring(0, tag.indexOf('-')) : tag;
|
||||||
|
const versionDate = version.includes('-') ? version.substring(0, version.indexOf('-')) : version;
|
||||||
|
if (tagDate < versionDate) {
|
||||||
|
updateAvailable = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
updateAvailable = true;
|
||||||
|
return;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,16 +193,29 @@ if ($i?.isAdmin) {
|
||||||
}).then((reports) => {
|
}).then((reports) => {
|
||||||
if (reports?.length > 0) thereIsUnresolvedAbuseReport = true;
|
if (reports?.length > 0) thereIsUnresolvedAbuseReport = true;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultStore.state.showAdminUpdates) {
|
if (defaultStore.state.showAdminUpdates) {
|
||||||
os.api("latest-version").then((res) => {
|
os.api("latest-version").then((res) => {
|
||||||
const cleanRes = parseInt(res?.tag_name.replace(/[^0-9]/g, ""));
|
if (!res?.tag_name) {
|
||||||
const cleanVersion = parseInt(version.replace(/[^0-9]/g, ""));
|
updateAvailable = false;
|
||||||
if (cleanRes > cleanVersion) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = res.tag_name as string;
|
||||||
|
if (tag === `v${version}`) {
|
||||||
|
updateAvailable = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tagDate = tag.includes('-') ? tag.substring(0, tag.indexOf('-')) : tag;
|
||||||
|
const versionDate = version.includes('-') ? version.substring(0, version.indexOf('-')) : version;
|
||||||
|
if (tagDate < versionDate) {
|
||||||
|
updateAvailable = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
updateAvailable = true;
|
updateAvailable = true;
|
||||||
}
|
return;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openAccountMenu(ev: MouseEvent) {
|
function openAccountMenu(ev: MouseEvent) {
|
||||||
|
|
Loading…
Reference in a new issue