This commit is contained in:
2024-10-26 17:24:39 +07:00
parent 470dc1c759
commit 83d24351cd
13 changed files with 191 additions and 496 deletions

View File

@@ -336,14 +336,6 @@ async getReplies(id: string) : Promise<Result<RichEvent[], string>> {
else return { status: "error", error: e as any };
}
},
async subscribeTo(id: string) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("subscribe_to", { id }) };
} catch (e) {
if(e instanceof Error) throw e;
else return { status: "error", error: e as any };
}
},
async getAllEventsByAuthor(publicKey: string, limit: number) : Promise<Result<RichEvent[], string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("get_all_events_by_author", { publicKey, limit }) };
@@ -501,13 +493,6 @@ async openWindow(window: NewWindow) : Promise<Result<string, string>> {
/** user-defined events **/
export const events = __makeEvents__<{
negentropyEvent: NegentropyEvent,
subscription: Subscription
}>({
negentropyEvent: "negentropy-event",
subscription: "subscription"
})
/** user-defined constants **/
@@ -518,15 +503,12 @@ subscription: "subscription"
export type Column = { label: string; url: string; x: number; y: number; width: number; height: number }
export type Mention = { pubkey: string; avatar: string; display_name: string; name: string }
export type Meta = { content: string; images: string[]; events: string[]; mentions: string[]; hashtags: string[] }
export type NegentropyEvent = { kind: NegentropyKind; total_event: number }
export type NegentropyKind = "Profile" | "Metadata" | "Events" | "EventIds" | "Global" | "Notification" | "Others"
export type NewWindow = { label: string; title: string; url: string; width: number; height: number; maximizable: boolean; minimizable: boolean; hidden_title: boolean; closable: boolean }
export type Profile = { name: string; display_name: string; about: string | null; picture: string; banner: string | null; nip05: string | null; lud16: string | null; website: string | null }
export type Relays = { connected: string[]; read: string[] | null; write: string[] | null; both: string[] | null }
export type RichEvent = { raw: string; parsed: Meta | null }
export type Settings = { proxy: string | null; image_resize_service: string | null; use_relay_hint: boolean; content_warning: boolean; trusted_only: boolean; display_avatar: boolean; display_zap_button: boolean; display_repost_button: boolean; display_media: boolean; transparent: boolean }
export type Subscription = { label: string; kind: SubscriptionMethod; event_id: string | null; contacts: string[] | null }
export type SubscriptionMethod = "Subscribe" | "Unsubscribe"
export type TAURI_CHANNEL<TSend> = null
/** tauri-specta globals **/