- );
- }
+ if (!user.profile) {
+ return (
+
+ );
+ }
- return (
-
- {user.profile.display_name || user.profile.name || "Anon"}
-
- );
+ return (
+
+ {user.profile.display_name || user.profile.name || "Anon"}
+
+ );
}
diff --git a/packages/ui/src/user/nip05.tsx b/packages/ui/src/user/nip05.tsx
index b3ba6a9b..efe2b3bf 100644
--- a/packages/ui/src/user/nip05.tsx
+++ b/packages/ui/src/user/nip05.tsx
@@ -13,7 +13,6 @@ export function UserNip05({ className }: { className?: string }) {
queryFn: async () => {
if (!user.profile?.nip05) return false;
const verify = await ark.verify_nip05(user.pubkey, user.profile?.nip05);
- console.log(verify);
return verify;
},
enabled: !!user.profile,
@@ -23,7 +22,7 @@ export function UserNip05({ className }: { className?: string }) {
return (
diff --git a/packages/ui/src/user/time.tsx b/packages/ui/src/user/time.tsx
index 3da95cec..5d0f026d 100644
--- a/packages/ui/src/user/time.tsx
+++ b/packages/ui/src/user/time.tsx
@@ -2,10 +2,13 @@ import { cn, formatCreatedAt } from "@lume/utils";
import { useMemo } from "react";
export function UserTime({
- time,
- className,
-}: { time: number; className?: string }) {
- const createdAt = useMemo(() => formatCreatedAt(time), [time]);
+ time,
+ className,
+}: {
+ time: number;
+ className?: string;
+}) {
+ const createdAt = useMemo(() => formatCreatedAt(time), [time]);
- return
{createdAt}
;
+ return
{createdAt}
;
}
diff --git a/src-tauri/capabilities/main.json b/src-tauri/capabilities/main.json
index 660381f7..20a52d54 100644
--- a/src-tauri/capabilities/main.json
+++ b/src-tauri/capabilities/main.json
@@ -1,46 +1,49 @@
{
- "$schema": "../gen/schemas/desktop-schema.json",
- "identifier": "desktop-capability",
- "description": "Capability for the desktop",
- "platforms": ["linux", "macOS", "windows"],
- "windows": ["main", "settings", "event-*", "user-*", "column-*"],
- "permissions": [
- "path:default",
- "event:default",
- "window:default",
- "app:default",
- "resources:default",
- "menu:default",
- "tray:default",
- "theme:allow-set-theme",
- "theme:allow-get-theme",
- "notification:allow-is-permission-granted",
- "notification:allow-request-permission",
- "notification:default",
- "os:allow-locale",
- "os:allow-platform",
- "updater:allow-check",
- "updater:default",
- "window:allow-start-dragging",
- "store:allow-get",
- {
- "identifier": "http:default",
- "allow": [
- {
- "url": "http://**/"
- },
- {
- "url": "https://**/"
- }
- ]
- },
- {
- "identifier": "fs:allow-read-text-file",
- "allow": [
- {
- "path": "$RESOURCE/locales/*"
- }
- ]
- }
- ]
+ "$schema": "../gen/schemas/desktop-schema.json",
+ "identifier": "desktop-capability",
+ "description": "Capability for the desktop",
+ "platforms": ["linux", "macOS", "windows"],
+ "windows": ["main", "settings", "event-*", "user-*", "column-*"],
+ "permissions": [
+ "path:default",
+ "event:default",
+ "window:default",
+ "app:default",
+ "resources:default",
+ "menu:default",
+ "tray:default",
+ "theme:allow-set-theme",
+ "theme:allow-get-theme",
+ "notification:allow-is-permission-granted",
+ "notification:allow-request-permission",
+ "notification:default",
+ "os:allow-locale",
+ "os:allow-platform",
+ "updater:allow-check",
+ "updater:default",
+ "window:allow-start-dragging",
+ "store:allow-get",
+ "clipboard-manager:allow-write",
+ "clipboard-manager:allow-read",
+ "webview:allow-create-webview-window",
+ {
+ "identifier": "http:default",
+ "allow": [
+ {
+ "url": "http://**/"
+ },
+ {
+ "url": "https://**/"
+ }
+ ]
+ },
+ {
+ "identifier": "fs:allow-read-text-file",
+ "allow": [
+ {
+ "path": "$RESOURCE/locales/*"
+ }
+ ]
+ }
+ ]
}
diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json
index 8d1b3624..21e2604b 100644
--- a/src-tauri/gen/schemas/capabilities.json
+++ b/src-tauri/gen/schemas/capabilities.json
@@ -1 +1 @@
-{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","context":"local","windows":["main","settings","event-*","user-*","column-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","theme:allow-set-theme","theme:allow-get-theme","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","updater:allow-check","updater:default","window:allow-start-dragging","store:allow-get",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"}]}],"platforms":["linux","macOS","windows"]}}
\ No newline at end of file
+{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","context":"local","windows":["main","settings","event-*","user-*","column-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","theme:allow-set-theme","theme:allow-get-theme","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","updater:allow-check","updater:default","window:allow-start-dragging","store:allow-get","clipboard-manager:allow-write","clipboard-manager:allow-read","webview:allow-create-webview-window",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"}]}],"platforms":["linux","macOS","windows"]}}
\ No newline at end of file
diff --git a/src-tauri/src/nostr/event.rs b/src-tauri/src/nostr/event.rs
index 69e559d7..82cbf63f 100644
--- a/src-tauri/src/nostr/event.rs
+++ b/src-tauri/src/nostr/event.rs
@@ -6,15 +6,14 @@ use tauri::State;
#[tauri::command(async)]
pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result
{
let client = &nostr.client;
- let event_id;
-
- if id.starts_with("note") {
- event_id = EventId::from_bech32(id).unwrap();
- } else if id.starts_with("nevent") {
- event_id = Nip19Event::from_bech32(id).unwrap().event_id;
- } else {
- event_id = EventId::from_hex(id).unwrap();
- }
+ let event_id: EventId = match Nip19::from_bech32(id) {
+ Ok(val) => match val {
+ Nip19::EventId(id) => id,
+ Nip19::Event(event) => event.event_id,
+ _ => panic!("not nip19"),
+ },
+ Err(_) => EventId::from_hex(id).unwrap(),
+ };
let filter = Filter::new().id(event_id);
let events = client
diff --git a/src-tauri/src/nostr/metadata.rs b/src-tauri/src/nostr/metadata.rs
index de6a077b..169fad75 100644
--- a/src-tauri/src/nostr/metadata.rs
+++ b/src-tauri/src/nostr/metadata.rs
@@ -6,15 +6,14 @@ use tauri::State;
#[tauri::command(async)]
pub async fn get_profile(id: &str, nostr: State<'_, Nostr>) -> Result {
let client = &nostr.client;
- let public_key;
-
- if id.starts_with("nprofile1") {
- public_key = XOnlyPublicKey::from_bech32(id).unwrap();
- } else if id.starts_with("npub1") {
- public_key = XOnlyPublicKey::from_bech32(id).unwrap();
- } else {
- public_key = XOnlyPublicKey::from_str(id).unwrap();
- }
+ let public_key: XOnlyPublicKey = match Nip19::from_bech32(id) {
+ Ok(val) => match val {
+ Nip19::Pubkey(pubkey) => pubkey,
+ Nip19::Profile(profile) => profile.public_key,
+ _ => panic!("not nip19"),
+ },
+ Err(_) => XOnlyPublicKey::from_str(id).unwrap(),
+ };
let filter = Filter::new()
.author(public_key)