Skip to content

Commit

Permalink
add input validation to workstore and fix up koaku's fuckups
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Dec 20, 2023
1 parent eb1bc9b commit b2e8409
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
5 changes: 0 additions & 5 deletions apps/workstore.app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ const repoScreen = document.getElementById('repoScreen');
const appListScreen = document.getElementById('appListScreen')
const appInstallerScreen = document.getElementById('appInstallerScreen');

parent.document.body.querySelector(".title").style["background-color"] = "#222";
parent.document.body.querySelector(".title").style["background-image"] = "radial-gradient(#666 1px, transparent 0)";
parent.document.body.querySelector(".title").style["background-size"] = "20px 20px";
parent.document.body.querySelector(".title").style["background-position"] = "-19px -19px";


// background-image: radial-gradient(#666 1px, transparent 0);
// background-size: 20px 20px;
Expand Down
29 changes: 28 additions & 1 deletion apps/workstore.app/repoManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ async function loadMainScreen() {
for (repo in repos) {
const repoItem = document.createElement('div')
repoItem.innerText = repo
repoItem.oncontextmenu = (e) => {
const newcontextmenu = new anura.ContextMenu();
newcontextmenu.addItem("Delete Repo", async function() {
delete repos[repoItem.innerText];
await anura.settings.set('workstore-repos', repos)
location.reload()
});
newcontextmenu.show(e.clientX, e.clientY)
document.onclick = (e) => {
document.onclick = null;
newcontextmenu.hide();
e.preventDefault();
}
e.preventDefault()
}
repoItem.onclick = function() {
loadappListScreen(repoItem.innerText) // Weird hack to work around the fact that repo doesn't work but the innertext of the repoitem does
}
Expand All @@ -23,10 +38,22 @@ async function loadMainScreen() {
newRepoButton.type = 'submit'
newRepoButton.value = 'add repo'
newRepoButton.onclick = function() {
if (!newRepoName.value.endsWith("/")) {
anura.notifications.add({
title: "Workstore",
description: "URL does not end with a \"/\" character",
timeout: 5000,
});
return;
}
const repoItem = document.createElement('div')
repoItem.innerText = newRepoName.value
if (repos[newRepoName.value]) {
// send anura notification that repo already exists
anura.notifications.add({
title: "Workstore",
description: "Repo is already added",
timeout: 5000,
});
return;
}
repos[newRepoName.value] = newRepoURL.value;
Expand Down

0 comments on commit b2e8409

Please sign in to comment.