Skip to content

Commit

Permalink
feat: Check for updates on Installed tab
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Oct 26, 2024
1 parent dfc4517 commit a97006e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
34 changes: 33 additions & 1 deletion packages/server/assets/homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1512,4 +1512,36 @@ document.addEventListener('keydown', (event) => {
closeModal(null);
return;
};
});
});


window.onload = async () => {
try {
const requst = await fetch('https://osuck.net/tosu/api.json');
const json = await requst.json();

const installed = document.querySelectorAll('.calu');
for (let i = 0; i < installed.length; i++) {
const counter = installed[i];

const find = json.find(r => r.name == counter.attributes.getNamedItem('n')?.value);
if (!find) continue;


const updatable = counter.attributes.getNamedItem('v')?.value != find.version;
if (!updatable) continue;

const button = document.createElement('button');
button.classList.add('button', 'update-button', 'flexer');

button.setAttribute('l', find.downloadLink);
button.setAttribute('n', find.name);
button.setAttribute('a', find.author);

button.innerHTML = `<span>Update</span>`;
counter.prepend(button);
};
} catch (error) {
console.log(error);
};
};
Loading

0 comments on commit a97006e

Please sign in to comment.