Fix bug with adding extensions to indexedDB

This commit is contained in:
wearrrrr 2024-04-17 09:24:12 -05:00
parent 3040dfc66e
commit 0b87af884e
2 changed files with 41 additions and 36 deletions

View file

@ -160,6 +160,10 @@ const { title, optionalPreloads } = Astro.props;
font-weight: 400; font-weight: 400;
font-size: 40px; font-size: 40px;
} }
.title-desc {
color: var(--text-color);
text-align: center;
}
::-webkit-scrollbar { ::-webkit-scrollbar {
display: none; display: none;
} }

View file

@ -18,6 +18,7 @@ type MarketplaceItem = {
<Layout title="Marketplace | Alu"> <Layout title="Marketplace | Alu">
<div id="main-content"> <div id="main-content">
<h1 class="title-text">Marketplace</h1> <h1 class="title-text">Marketplace</h1>
<p class="title-desc">Install custom userscripts and themes for Alu.</p>
<div class="marketplace-ext-grid"> <div class="marketplace-ext-grid">
{ {
Object.keys(marketplace).map((mp_item) => { Object.keys(marketplace).map((mp_item) => {
@ -135,22 +136,22 @@ type MarketplaceItem = {
}; };
// Check if the key already exists in the IDB // Check if the key already exists in the IDB
let slugCheck = store.get(slug); let slugCheck = store.get(slug);
slugCheck.onsuccess = (event) => { slugCheck.onsuccess = () => {
if (slugCheck.result) { console.log(slugCheck.result)
if (slugCheck.result != undefined) {
resolve(EXT_RETURN.ALREADY_INSTALLED); resolve(EXT_RETURN.ALREADY_INSTALLED);
} else { } else {
if (store.get(slug)) resolve(EXT_RETURN.ALREADY_INSTALLED);
const addRequest = store.add(extensionObject); const addRequest = store.add(extensionObject);
addRequest.onerror = (event) => { addRequest.onerror = () => {
console.error(`Error installing ${slug}!`) console.error(`Error installing ${slug}!`)
reject(EXT_RETURN.INSTALL_FAILED); reject(EXT_RETURN.INSTALL_FAILED);
}; };
addRequest.onsuccess = (event) => { addRequest.onsuccess = () => {
resolve(EXT_RETURN.INSTALL_SUCCESS); resolve(EXT_RETURN.INSTALL_SUCCESS);
}; };
} }
}; };
slugCheck.onerror = (event) => { slugCheck.onerror = () => {
console.error("Error checking install status!"); console.error("Error checking install status!");
reject(EXT_RETURN.INSTALL_FAILED); reject(EXT_RETURN.INSTALL_FAILED);
}; };