refactor: fix followgraph / add indexes

This commit is contained in:
2024-01-18 22:39:18 +00:00
parent 6eef8c7fef
commit ba3e901e9b
6 changed files with 33 additions and 27 deletions

View File

@ -2,13 +2,13 @@ import "./index.css";
import "@szhsin/react-menu/dist/index.css";
import "@/assets/fonts/inter.css";
import { encodeTLVEntries } from "@snort/system";
import { encodeTLVEntries, socialGraphInstance } from "@snort/system";
import { SnortContext } from "@snort/system-react";
import { StrictMode } from "react";
import * as ReactDOM from "react-dom/client";
import { createBrowserRouter, RouteObject, RouterProvider } from "react-router-dom";
import { initRelayWorker, preload } from "@/Cache";
import { initRelayWorker, preload, Relay } from "@/Cache";
import { ThreadRoute } from "@/Components/Event/Thread";
import { IntlProvider } from "@/Components/IntlProvider/IntlProvider";
import { db } from "@/Db";
@ -69,6 +69,11 @@ async function initSite() {
}
setupWebLNWalletConfig(Wallets);
Relay.sql("select json from events where kind = ?", [3]).then(res => {
for (const [json] of res) {
socialGraphInstance.handleEvent(JSON.parse(json as string));
}
});
return null;
}

View File

@ -153,9 +153,6 @@
"2ukA4d": {
"defaultMessage": "{n} hours"
},
"2zJXeA": {
"defaultMessage": "Profiles"
},
"39AHJm": {
"defaultMessage": "Sign Up"
},

View File

@ -1,5 +1,5 @@
import { removeUndefined, throwIfOffline } from "@snort/shared";
import { mapEventToProfile, NostrEvent, NostrSystem, ProfileLoaderService } from "@snort/system";
import { mapEventToProfile, NostrEvent, NostrSystem, ProfileLoaderService, socialGraphInstance } from "@snort/system";
import { EventsCache, Relay, RelayMetrics, SystemDb, UserCache, UserRelays } from "@/Cache";
import { LoginStore } from "@/Utils/Login";
@ -29,6 +29,7 @@ System.on("event", (_, ev) => {
Relay.event(ev);
EventsCache.discover(ev);
UserCache.discover(ev);
socialGraphInstance.handleEvent(ev);
});
/**

View File

@ -50,7 +50,6 @@
"2mcwT8": "New Note",
"2oCF7O": "Followed by friends of friends",
"2ukA4d": "{n} hours",
"2zJXeA": "Profiles",
"39AHJm": "Sign Up",
"3KNMbJ": "Articles",
"3QwfJR": "~{amount}",