port update checker to gitea compatible version

This commit is contained in:
2024-11-03 10:08:26 +13:00
parent bd4cb96c0f
commit a3bc16f7d2
5 changed files with 16 additions and 21 deletions

View File

@ -1,18 +1,15 @@
async function checkInstanceUpdateStatus() {
try {
const response = await fetch('/commits.atom');
const response = await fetch('/commits.json');
const text = await response.text();
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(text, "application/xml");
const entries = xmlDoc.getElementsByTagName('entry');
const entries = JSON.parse(text);
const localCommit = document.getElementById('git_commit').dataset.value;
let statusMessage = '';
if (entries.length > 0) {
const commitHashes = Array.from(entries).map(entry => {
const id = entry.getElementsByTagName('id')[0].textContent;
return id.split('/').pop();
return entry.sha
});
const commitIndex = commitHashes.indexOf(localCommit);

View File

@ -1965,6 +1965,13 @@ th {
color: var(--accent);
}
#issue_warning {
color: var(--popup-toreddit-text);
background: var(--popup-background);
border-radius: 5px;
padding: 10px;
}
/* Messages */
#duplicates_msg h3 {