mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 22:44:26 +01:00
fix
This commit is contained in:
@@ -60,6 +60,9 @@ const extract = (parsed: ParsedTextNote) => {
|
||||
} else if (node.data.type === 'note') {
|
||||
eventReferences.push(node.data.data);
|
||||
}
|
||||
// TODO nevent can contain an event not only textnote (kind:1).
|
||||
// In my understanding, it is not allowed to include other kinds of events in `tags`.
|
||||
// It is needed to verify that the kind of the event is 1.
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component } from 'solid-js';
|
||||
import { Component, createEffect, onCleanup, onMount } from 'solid-js';
|
||||
|
||||
import Home from 'heroicons/24/outline/home.svg';
|
||||
import { uniq } from 'lodash';
|
||||
@@ -25,7 +25,7 @@ const FollowingColumn: Component<FollowingColumnDisplayProps> = (props) => {
|
||||
|
||||
const { followingPubkeys } = useFollowings(() => ({ pubkey: props.column.pubkey }));
|
||||
|
||||
const { events: followingsPosts } = useSubscription(() => {
|
||||
const { events } = useSubscription(() => {
|
||||
const authors = uniq([...followingPubkeys()]);
|
||||
if (authors.length === 0) return null;
|
||||
return {
|
||||
@@ -45,6 +45,13 @@ const FollowingColumn: Component<FollowingColumnDisplayProps> = (props) => {
|
||||
};
|
||||
});
|
||||
|
||||
createEffect(() => {
|
||||
console.log('home', events());
|
||||
});
|
||||
|
||||
onMount(() => console.log('home timeline mounted'));
|
||||
onCleanup(() => console.log('home timeline unmounted'));
|
||||
|
||||
return (
|
||||
<Column
|
||||
header={
|
||||
@@ -59,7 +66,7 @@ const FollowingColumn: Component<FollowingColumnDisplayProps> = (props) => {
|
||||
columnIndex={props.columnIndex}
|
||||
lastColumn={props.lastColumn}
|
||||
>
|
||||
<Timeline events={followingsPosts()} />
|
||||
<Timeline events={events()} />
|
||||
</Column>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import uniq from 'lodash/uniq';
|
||||
import { Kind, Event as NostrEvent } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
export type EventMarker = 'reply' | 'root' | 'mention';
|
||||
|
||||
@@ -22,13 +23,25 @@ export type ContentWarning = {
|
||||
reason?: string;
|
||||
};
|
||||
|
||||
const IdRegex = /^[0-9a-fA-f]{64}$/;
|
||||
const IdRegex = /^[0-9a-f]{64}$/;
|
||||
export const isValidId = (s: string): boolean => {
|
||||
const result = typeof s === 'string' && s.length === 64 && IdRegex.test(s);
|
||||
if (!result) console.warn('invalid id is ignored: ', s);
|
||||
return result;
|
||||
};
|
||||
|
||||
/*
|
||||
// TODO event validation and normalization
|
||||
const eventSchema = z.object({
|
||||
id: z.string().length(64).regex(IdRegex),
|
||||
pubkey: z.string().length(64).regex(IdRegex),
|
||||
created_at: z.number().int(),
|
||||
kind: z.number(),
|
||||
tags: z.array(z.array(z.string())),
|
||||
content: z.string(),
|
||||
});
|
||||
*/
|
||||
|
||||
const eventWrapper = (event: NostrEvent) => {
|
||||
let memoizedMarkedEventTags: MarkedEventTag[] | undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user