This commit is contained in:
parent
f684658183
commit
9bfb6ede0a
@ -11,8 +11,8 @@ class DMCache extends FeedCache<RawEvent> {
|
|||||||
return of.id;
|
return of.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
override async preload(follows?: Array<string>): Promise<void> {
|
override async preload(): Promise<void> {
|
||||||
await super.preload(follows);
|
await super.preload();
|
||||||
// load all dms to memory
|
// load all dms to memory
|
||||||
await this.buffer([...this.onTable]);
|
await this.buffer([...this.onTable]);
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ class EventInteractionCache extends FeedCache<EventInteraction> {
|
|||||||
return sha256(of.event + of.by);
|
return sha256(of.event + of.by);
|
||||||
}
|
}
|
||||||
|
|
||||||
override async preload(follows?: Array<string>): Promise<void> {
|
override async preload(): Promise<void> {
|
||||||
await super.preload(follows);
|
await super.preload();
|
||||||
|
|
||||||
const data = window.localStorage.getItem("zap-cache");
|
const data = window.localStorage.getItem("zap-cache");
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -35,7 +35,7 @@ export default abstract class FeedCache<TCached> {
|
|||||||
}, 30_000);
|
}, 30_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async preload(follows?: Array<string>) {
|
async preload() {
|
||||||
if (db.ready) {
|
if (db.ready) {
|
||||||
const keys = await this.table.toCollection().primaryKeys();
|
const keys = await this.table.toCollection().primaryKeys();
|
||||||
this.onTable = new Set<string>(keys.map(a => a as string));
|
this.onTable = new Set<string>(keys.map(a => a as string));
|
||||||
|
@ -19,7 +19,7 @@ class UserProfileCache extends FeedCache<MetadataCache> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override async preload(follows?: Array<string>): Promise<void> {
|
override async preload(follows?: Array<string>): Promise<void> {
|
||||||
await super.preload(follows);
|
await super.preload();
|
||||||
// load follows profiles
|
// load follows profiles
|
||||||
if (follows) {
|
if (follows) {
|
||||||
await this.buffer(follows);
|
await this.buffer(follows);
|
||||||
|
@ -11,7 +11,7 @@ class UsersRelaysCache extends FeedCache<UsersRelays> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override async preload(follows?: Array<string>): Promise<void> {
|
override async preload(follows?: Array<string>): Promise<void> {
|
||||||
await super.preload(follows);
|
await super.preload();
|
||||||
if (follows) {
|
if (follows) {
|
||||||
await this.buffer(follows);
|
await this.buffer(follows);
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,8 @@ export function mapEventToProfile(ev: RawEvent) {
|
|||||||
export async function preload(follows?: Array<string>) {
|
export async function preload(follows?: Array<string>) {
|
||||||
const preloads = [
|
const preloads = [
|
||||||
UserCache.preload(follows),
|
UserCache.preload(follows),
|
||||||
DmCache.preload(follows),
|
DmCache.preload(),
|
||||||
InteractionCache.preload(follows),
|
InteractionCache.preload(),
|
||||||
UserRelays.preload(follows),
|
UserRelays.preload(follows),
|
||||||
];
|
];
|
||||||
await Promise.all(preloads);
|
await Promise.all(preloads);
|
||||||
|
@ -35,7 +35,6 @@ export default function Relay(props: RelayProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const latency = Math.floor(state?.avgLatency ?? 0);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={`relay w-max`}>
|
<div className={`relay w-max`}>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { InvoiceRequest, LNWallet, Sats, WalletError, WalletErrorCode, WalletInfo, WalletInvoice } from "Wallet";
|
import { LNWallet, Sats, WalletError, WalletErrorCode, WalletInfo, WalletInvoice } from "Wallet";
|
||||||
|
|
||||||
import { CashuMint, CashuWallet as TheCashuWallet, Proof } from "@cashu/cashu-ts";
|
import { CashuMint, CashuWallet as TheCashuWallet, Proof } from "@cashu/cashu-ts";
|
||||||
|
|
||||||
export class CashuWallet implements LNWallet {
|
export class CashuWallet implements LNWallet {
|
||||||
|
@ -21,13 +21,12 @@ export interface ZapPoolRecipient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
|
class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
|
||||||
#store: Map<string, ZapPoolRecipient>;
|
#store = new Map<string, ZapPoolRecipient>();
|
||||||
#isPayoutInProgress = false;
|
#isPayoutInProgress = false;
|
||||||
#lastPayout: number = 0;
|
#lastPayout = 0;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.#store = new Map();
|
|
||||||
this.#load();
|
this.#load();
|
||||||
setTimeout(() => this.#autoPayout().catch(console.error), 5_000);
|
setTimeout(() => this.#autoPayout().catch(console.error), 5_000);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import { db } from "Db";
|
|||||||
import { preload } from "Cache";
|
import { preload } from "Cache";
|
||||||
import { LoginStore } from "Login";
|
import { LoginStore } from "Login";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-expect-error Setting webpack nonce
|
||||||
window.__webpack_nonce__ = "ZmlhdGphZiBzYWlkIHNub3J0LnNvY2lhbCBpcyBwcmV0dHkgZ29vZCwgd2UgbWFkZSBpdCE=";
|
window.__webpack_nonce__ = "ZmlhdGphZiBzYWlkIHNub3J0LnNvY2lhbCBpcyBwcmV0dHkgZ29vZCwgd2UgbWFkZSBpdCE=";
|
||||||
|
|
||||||
serviceWorkerRegistration.register();
|
serviceWorkerRegistration.register();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/// <reference lib="webworker" />
|
/// <reference lib="webworker" />
|
||||||
import {} from ".";
|
import {} from ".";
|
||||||
declare var self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
import { clientsClaim } from "workbox-core";
|
import { clientsClaim } from "workbox-core";
|
||||||
import { ExpirationPlugin } from "workbox-expiration";
|
import { ExpirationPlugin } from "workbox-expiration";
|
||||||
|
Loading…
Reference in New Issue
Block a user