feat: negentropy progress
This commit is contained in:
@@ -157,7 +157,7 @@ export class LumeEvent {
|
||||
}
|
||||
|
||||
static async build(event: NostrEvent) {
|
||||
const query = await commands.getEventMeta(event.content);
|
||||
const query = await commands.getMetaFromEvent(event.content);
|
||||
|
||||
if (query.status === "ok") {
|
||||
event.meta = query.data;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { commands } from "@/commands.gen";
|
||||
import type { NostrEvent } from "@/types";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { nip19 } from "nostr-tools";
|
||||
import { LumeEvent } from "./event";
|
||||
|
||||
export function useEvent(id: string, repost?: string) {
|
||||
@@ -10,7 +11,7 @@ export function useEvent(id: string, repost?: string) {
|
||||
try {
|
||||
if (repost?.length) {
|
||||
const nostrEvent: NostrEvent = JSON.parse(repost);
|
||||
const res = await commands.getEventMeta(nostrEvent.content);
|
||||
const res = await commands.getMetaFromEvent(nostrEvent.content);
|
||||
|
||||
if (res.status === "ok") {
|
||||
nostrEvent.meta = res.data;
|
||||
@@ -19,12 +20,17 @@ export function useEvent(id: string, repost?: string) {
|
||||
return new LumeEvent(nostrEvent);
|
||||
}
|
||||
|
||||
// Validate ID
|
||||
const normalizeId: string = id
|
||||
.replace("nostr:", "")
|
||||
.replace(/[^\w\s]/gi, "");
|
||||
let normalizedId = id.replace("nostr:", "").replace(/[^\w\s]/gi, "");
|
||||
|
||||
const res = await commands.getEvent(normalizeId);
|
||||
if (normalizedId.startsWith("nevent")) {
|
||||
const decoded = nip19.decode(normalizedId);
|
||||
|
||||
if (decoded.type === "nevent") {
|
||||
normalizedId = decoded.data.id;
|
||||
}
|
||||
}
|
||||
|
||||
const res = await commands.getEvent(normalizedId);
|
||||
|
||||
if (res.status === "ok") {
|
||||
const data = res.data;
|
||||
|
||||
@@ -16,17 +16,17 @@ export function useProfile(pubkey: string, embed?: string) {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
let normalizeId = pubkey.replace("nostr:", "").replace(/[^\w\s]/gi, "");
|
||||
let normalizedId = pubkey.replace("nostr:", "").replace(/[^\w\s]/gi, "");
|
||||
|
||||
if (normalizeId.startsWith("nprofile")) {
|
||||
const decoded = nip19.decode(normalizeId);
|
||||
if (normalizedId.startsWith("nprofile")) {
|
||||
const decoded = nip19.decode(normalizedId);
|
||||
|
||||
if (decoded.type === "nprofile") {
|
||||
normalizeId = decoded.data.pubkey;
|
||||
normalizedId = decoded.data.pubkey;
|
||||
}
|
||||
}
|
||||
|
||||
const query = await commands.getProfile(normalizeId);
|
||||
const query = await commands.getProfile(normalizedId);
|
||||
|
||||
if (query.status === "ok") {
|
||||
return JSON.parse(query.data) as Metadata;
|
||||
|
||||
@@ -11,13 +11,14 @@ export const LumeWindow = {
|
||||
column,
|
||||
});
|
||||
},
|
||||
openLaunchpad: async () => {
|
||||
openLaunchpad: async (account: string) => {
|
||||
await getCurrentWindow().emit("columns", {
|
||||
type: "add",
|
||||
column: {
|
||||
label: "launchpad",
|
||||
name: "Launchpad",
|
||||
url: "/columns/launchpad",
|
||||
url: `/columns/launchpad/${account}`,
|
||||
account,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user