@@ -2,16 +2,17 @@ import "./index.css";
22import "@szhsin/react-menu/dist/index.css" ;
33import "@/assets/fonts/inter.css" ;
44
5- import { unixNowMs } from "@snort/shared" ;
5+ import { unixNow , unixNowMs } from "@snort/shared" ;
66import { EventBuilder } from "@snort/system" ;
77import { SnortContext } from "@snort/system-react" ;
88import { StrictMode } from "react" ;
99import * as ReactDOM from "react-dom/client" ;
1010import { createBrowserRouter , RouteObject , RouterProvider } from "react-router-dom" ;
1111
12- import { preload , UserCache } from "@/Cache" ;
12+ import { initRelayWorker , preload , Relay , UserCache } from "@/Cache" ;
1313import { ThreadRoute } from "@/Components/Event/Thread/ThreadRoute" ;
1414import { IntlProvider } from "@/Components/IntlProvider/IntlProvider" ;
15+ import { db } from "@/Db" ;
1516import { addCachedMetadataToFuzzySearch } from "@/Db/FuzzySearch" ;
1617import { AboutPage } from "@/Pages/About" ;
1718import { DebugPage } from "@/Pages/CacheDebug" ;
@@ -39,9 +40,11 @@ import { WalletSendPage } from "@/Pages/wallet/send";
3940import ZapPoolPage from "@/Pages/ZapPool/ZapPool" ;
4041import { System } from "@/system" ;
4142import { storeRefCode , unwrap } from "@/Utils" ;
43+ import { hasWasm , wasmInit , WasmPath } from "@/Utils/wasm" ;
4244import { Wallets } from "@/Wallet" ;
4345import { setupWebLNWalletConfig } from "@/Wallet" ;
4446
47+ import { Day } from "./Utils/Const" ;
4548import { LoginStore } from "./Utils/Login" ;
4649
4750async function initSite ( ) {
@@ -51,10 +54,14 @@ async function initSite() {
5154 "31990:84de35e2584d2b144aae823c9ed0b0f3deda09648530b93d1a2a146d1dea9864:app-profile" ,
5255 ] ;
5356 storeRefCode ( ) ;
57+ if ( hasWasm ) {
58+ await wasmInit ( WasmPath ) ;
59+ await initRelayWorker ( ) ;
60+ }
5461
5562 setupWebLNWalletConfig ( Wallets ) ;
5663
57- // db.ready = await db.isAvailable();
64+ db . ready = await db . isAvailable ( ) ;
5865
5966 const login = LoginStore . snapshot ( ) ;
6067 preload ( login . state . follows ) . then ( async ( ) => {
@@ -77,7 +84,7 @@ async function initSite() {
7784 } ) ;
7885
7986 // cleanup
80- // Relay.delete(["REQ", "cleanup", { kinds: [1, 7, 9735], until: unixNow() - Day * 30 }]);
87+ Relay . delete ( [ "REQ" , "cleanup" , { kinds : [ 1 , 7 , 9735 ] , until : unixNow ( ) - Day * 30 } ] ) ;
8188
8289 return null ;
8390}
0 commit comments