limit kind 1 querying to 24 hours (#413)

This commit is contained in:
BlowaterNostr 2024-03-16 19:22:46 +08:00 committed by GitHub
parent 18f561a620
commit 72307e372e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 8 deletions

View File

@ -352,7 +352,7 @@ export class AppComponent extends Component<AppProps> {
}
let socialNode: VNode | undefined;
if (model.navigationModel.activeNav == "Social" && model.currentRelay) {
if (model.navigationModel.activeNav == "Public" && model.currentRelay) {
socialNode = (
<ChannelContainer
ctx={myAccountCtx}
@ -511,6 +511,7 @@ async function sync_profile_events(
const sync_kind_1 = async (pool: ConnectionPool, database: Database_View) => {
const stream = await pool.newSub("sync_kind_1", {
kinds: [NostrKind.TEXT_NOTE],
since: Math.floor(Date.now() / 1000) - 24 * 60 * 60, // 24 hours
});
if (stream instanceof Error) {
return stream;

View File

@ -40,7 +40,7 @@ export function initialModel(): Model {
value: "",
},
navigationModel: {
activeNav: "Social",
activeNav: "Public",
},
myProfile: undefined,
};

View File

@ -364,15 +364,25 @@ export async function* UI_Interaction_Update(args: {
title: "Relays",
fields: Array.from(app.database.getRelayRecord(nostrEvent.id)),
},
{
];
if (nostrEvent.kind == NostrKind.DIRECT_MESSAGE) {
items.push({
title: "Content",
fields: [
content,
event.message.content,
originalEventRaw,
],
},
];
});
} else {
items.push({
title: "Content",
fields: [
event.message.content,
originalEventRaw,
],
});
}
app.popOverInputChan.put({
children: (
<EventDetail
@ -558,7 +568,7 @@ export async function handle_SendMessage(
}
}
events = events_send;
} else if (args.navigationModel.activeNav == "Social") {
} else if (args.navigationModel.activeNav == "Public") {
const nostr_event = await prepareNormalNostrEvent(ctx, {
content: event.text,
kind: NostrKind.TEXT_NOTE,

View File

@ -57,7 +57,7 @@ type State = {
installPrompt: InstallPrompt;
};
type NavTabID = "Social" | "DM" | "Search" | "Profile" | "About" | "Setting";
type NavTabID = "Public" | "DM" | "Search" | "Profile" | "About" | "Setting";
type NavTab = {
icon: (active: boolean) => ComponentChild;
id: NavTabID;
@ -89,7 +89,7 @@ export class NavBar extends Component<Props, State> {
tabs: NavTab[] = [
{
icon: (active: boolean) => <SocialIcon class={this.styles.icons(active)} />,
id: "Social",
id: "Public",
},
{
icon: (active: boolean) => <ChatIcon class={this.styles.icons(active)} />,