diff --git a/src/agent/database.ts b/src/agent/database.ts index 93e73688..48dcc520 100644 --- a/src/agent/database.ts +++ b/src/agent/database.ts @@ -22,7 +22,10 @@ type Table = { // Plumbing -const worker = new Worker('/src/workers/database.js', {type: 'module'}) +const worker = new Worker( + new URL('../workers/database.js', import.meta.url), + {type: 'module'} +) worker.addEventListener('error', e => console.error(e)) diff --git a/src/app/alerts.js b/src/app/alerts.js index db903e21..2e6b9b0d 100644 --- a/src/app/alerts.js +++ b/src/app/alerts.js @@ -1,5 +1,6 @@ import {get} from 'svelte/store' import {groupBy, pluck, partition, propEq} from 'ramda' +import {createMap} from 'hurdak/lib/hurdak' import {synced, timedelta, batch, now} from 'src/util/misc' import {isAlert, findReplyId} from 'src/util/nostr' import {load as _load, listen as _listen, database} from 'src/agent' @@ -23,7 +24,7 @@ const onChunk = async (relays, pubkey, events) => { .filter(e => likesByParent[e.id]) .map(e => annotate({...e, likedBy: pluck('pubkey', likesByParent[e.id])}, context)) - await database.alerts.bulkPut(annotatedNotes.concat(likedNotes)) + await database.alerts.bulkPut(createMap('id', annotatedNotes.concat(likedNotes))) mostRecentAlert.update($t => events.reduce((t, e) => Math.max(t, e.created_at), $t)) } diff --git a/src/partials/RelayCard.svelte b/src/partials/RelayCard.svelte index defb6d3f..cef4409b 100644 --- a/src/partials/RelayCard.svelte +++ b/src/partials/RelayCard.svelte @@ -44,8 +44,8 @@ on:mouseout={() => {showStatus = false}} on:mouseover={() => {showStatus = true}} class="w-2 h-2 rounded-full bg-medium cursor-pointer" - class:bg-danger={status === 'error'} - class:bg-warning={['pending', 'slow'].includes(status)} + class:bg-danger={['pending', 'error'].includes(status)} + class:bg-warning={status === 'slow'} class:bg-success={status === 'ready'}>
{#if joined} -