mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 10:57:04 +00:00
Tweak boot, stop saving alert events
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {preventDefault} from "@lib/html"
|
import {preventDefault} from "@lib/html"
|
||||||
import {randomInt} from "@welshman/lib"
|
import {randomInt, TIMEZONE} from "@welshman/lib"
|
||||||
import {displayRelayUrl, THREAD, MESSAGE, EVENT_TIME, COMMENT} from "@welshman/util"
|
import {displayRelayUrl, THREAD, MESSAGE, EVENT_TIME, COMMENT} from "@welshman/util"
|
||||||
import type {Filter} from "@welshman/util"
|
import type {Filter} from "@welshman/util"
|
||||||
import type {Nip46ResponseWithResult} from "@welshman/signer"
|
import type {Nip46ResponseWithResult} from "@welshman/signer"
|
||||||
@@ -18,11 +18,8 @@
|
|||||||
import {publishAlert} from "@app/commands"
|
import {publishAlert} from "@app/commands"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
import {pushModal} from "@app/modal"
|
import {pushModal} from "@app/modal"
|
||||||
const timezone = new Date()
|
|
||||||
.toString()
|
const timezoneOffset = parseInt(TIMEZONE.slice(3)) / 100
|
||||||
.match(/GMT[^\s]+/)![0]
|
|
||||||
.slice(3)
|
|
||||||
const timezoneOffset = parseInt(timezone) / 100
|
|
||||||
const minute = randomInt(0, 59)
|
const minute = randomInt(0, 59)
|
||||||
const hour = (17 - timezoneOffset) % 24
|
const hour = (17 - timezoneOffset) % 24
|
||||||
const WEEKLY = `0 ${minute} ${hour} * * 1`
|
const WEEKLY = `0 ${minute} ${hour} * * 1`
|
||||||
|
|||||||
@@ -45,15 +45,17 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex items-start justify-between gap-4">
|
<div class="flex items-start justify-between gap-4">
|
||||||
<Button class="py-1" onclick={startDelete}>
|
<div class="flex items-start gap-4">
|
||||||
<Icon icon="trash-bin-2" />
|
<Button class="py-1" onclick={startDelete}>
|
||||||
</Button>
|
<Icon icon="trash-bin-2" />
|
||||||
<div class="flex-inline gap-1">
|
</Button>
|
||||||
{cron?.endsWith("1") ? "Weekly" : "Daily"} alert for
|
<div class="flex-inline gap-1">
|
||||||
{displayList(types)} on
|
{cron?.endsWith("1") ? "Weekly" : "Daily"} alert for
|
||||||
<Link class="link" href={makeSpacePath(relay)}>
|
{displayList(types)} on
|
||||||
{displayRelayUrl(relay)}
|
<Link class="link" href={makeSpacePath(relay)}>
|
||||||
</Link>, sent via {channel}.
|
{displayRelayUrl(relay)}
|
||||||
|
</Link>, sent via {channel}.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if status}
|
{#if status}
|
||||||
{@const statusText = getTagValue("status", status.tags) || "error"}
|
{@const statusText = getTagValue("status", status.tags) || "error"}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
int,
|
int,
|
||||||
YEAR,
|
YEAR,
|
||||||
DAY,
|
DAY,
|
||||||
insert,
|
insertAt,
|
||||||
sortBy,
|
sortBy,
|
||||||
assoc,
|
assoc,
|
||||||
now,
|
now,
|
||||||
@@ -113,7 +113,7 @@ export const makeFeed = ({
|
|||||||
buffer.update($buffer => {
|
buffer.update($buffer => {
|
||||||
for (let i = 0; i < $buffer.length; i++) {
|
for (let i = 0; i < $buffer.length; i++) {
|
||||||
if ($buffer[i].id === event.id) return $buffer
|
if ($buffer[i].id === event.id) return $buffer
|
||||||
if ($buffer[i].created_at < event.created_at) return insert(i, event, $buffer)
|
if ($buffer[i].created_at < event.created_at) return insertAt(i, event, $buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
return [...$buffer, event]
|
return [...$buffer, event]
|
||||||
@@ -225,7 +225,7 @@ export const makeCalendarFeed = ({
|
|||||||
events.update($events => {
|
events.update($events => {
|
||||||
for (let i = 0; i < $events.length; i++) {
|
for (let i = 0; i < $events.length; i++) {
|
||||||
if ($events[i].id === event.id) return $events
|
if ($events[i].id === event.id) return $events
|
||||||
if (getStart($events[i]) > start) return insert(i, event, $events)
|
if (getStart($events[i]) > start) return insertAt(i, event, $events)
|
||||||
}
|
}
|
||||||
|
|
||||||
return [...$events.filter(e => getAddress(e) !== address), event]
|
return [...$events.filter(e => getAddress(e) !== address), event]
|
||||||
|
|||||||
@@ -50,14 +50,7 @@
|
|||||||
import {setupAnalytics} from "@app/analytics"
|
import {setupAnalytics} from "@app/analytics"
|
||||||
import {nsecDecode} from "@lib/util"
|
import {nsecDecode} from "@lib/util"
|
||||||
import {theme} from "@app/theme"
|
import {theme} from "@app/theme"
|
||||||
import {
|
import {INDEXER_RELAYS, userMembership, ensureUnwrapped, canDecrypt} from "@app/state"
|
||||||
INDEXER_RELAYS,
|
|
||||||
ALERT,
|
|
||||||
ALERT_STATUS,
|
|
||||||
userMembership,
|
|
||||||
ensureUnwrapped,
|
|
||||||
canDecrypt,
|
|
||||||
} from "@app/state"
|
|
||||||
import {loadUserData, listenForNotifications} from "@app/requests"
|
import {loadUserData, listenForNotifications} from "@app/requests"
|
||||||
import * as commands from "@app/commands"
|
import * as commands from "@app/commands"
|
||||||
import * as requests from "@app/requests"
|
import * as requests from "@app/requests"
|
||||||
@@ -137,7 +130,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
initStorage("flotilla", 8, {
|
await initStorage("flotilla", 8, {
|
||||||
...defaultStorageAdapters,
|
...defaultStorageAdapters,
|
||||||
events: new EventsStorageAdapter({
|
events: new EventsStorageAdapter({
|
||||||
name: "events",
|
name: "events",
|
||||||
@@ -145,17 +138,15 @@
|
|||||||
repository,
|
repository,
|
||||||
rankEvent: (e: TrustedEvent) => {
|
rankEvent: (e: TrustedEvent) => {
|
||||||
if ([PROFILE, FOLLOWS, MUTES, RELAYS, INBOX_RELAYS].includes(e.kind)) return 1
|
if ([PROFILE, FOLLOWS, MUTES, RELAYS, INBOX_RELAYS].includes(e.kind)) return 1
|
||||||
if ([EVENT_TIME, THREAD, MESSAGE, WRAP, ALERT, ALERT_STATUS].includes(e.kind))
|
if ([EVENT_TIME, THREAD, MESSAGE, WRAP].includes(e.kind)) return 0.9
|
||||||
return 0.9
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}).then(async () => {
|
|
||||||
await sleep(300)
|
|
||||||
ready.resolve()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
sleep(300).then(() => ready.resolve())
|
||||||
|
|
||||||
defaultSocketPolicies.push(
|
defaultSocketPolicies.push(
|
||||||
makeSocketPolicyAuth({
|
makeSocketPolicyAuth({
|
||||||
sign: (event: StampedEvent) => signer.get()?.sign(event),
|
sign: (event: StampedEvent) => signer.get()?.sign(event),
|
||||||
|
|||||||
Reference in New Issue
Block a user