diff --git a/apps/desktop2/src/routes/index.tsx b/apps/desktop2/src/routes/index.tsx
index 3baee84f..b9520020 100644
--- a/apps/desktop2/src/routes/index.tsx
+++ b/apps/desktop2/src/routes/index.tsx
@@ -1,19 +1,72 @@
-import { createFileRoute, redirect } from "@tanstack/react-router";
+import { useArk } from "@lume/ark";
+import { User } from "@lume/ui";
+import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
export const Route = createFileRoute("/")({
beforeLoad: async ({ location, context }) => {
const ark = context.ark;
- const signer = await ark.verify_signer();
- if (!signer) {
- throw redirect({
- to: "/landing",
- search: {
- redirect: location.href,
- },
+ const accounts = await ark.get_all_accounts();
+
+ switch (accounts.length) {
+ // Empty account
+ case 0:
+ throw redirect({
+ to: "/landing",
+ search: {
+ redirect: location.href,
+ },
+ });
+ // Only 1 account, skip account selection screen
+ case 1:
+ const loadAccount = await ark.load_selected_account(accounts[0].npub);
+ if (loadAccount) {
+ throw redirect({
+ to: "/app/home",
+ search: {
+ redirect: location.href,
+ },
+ });
+ }
+ // Account selection
+ default:
+ return;
+ }
+ },
+ component: Screen,
+});
+
+function Screen() {
+ const ark = useArk();
+ const navigate = useNavigate();
+
+ const select = async (npub: string) => {
+ const loadAccount = await ark.load_selected_account(npub);
+ if (loadAccount) {
+ navigate({
+ to: "/app/home",
+ replace: true,
});
}
- throw redirect({
- to: "/app/space",
- });
- },
-});
+ };
+
+ return (
+
+
+ {ark.accounts.map((account) => (
+
+ ))}
+
+
+ );
+}
diff --git a/apps/desktop2/src/routes/select.tsx b/apps/desktop2/src/routes/select.tsx
new file mode 100644
index 00000000..8e785a4b
--- /dev/null
+++ b/apps/desktop2/src/routes/select.tsx
@@ -0,0 +1,5 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/select')({
+ component: () => Hello /select!
+})
\ No newline at end of file
diff --git a/packages/ark/src/ark.ts b/packages/ark/src/ark.ts
index 70b40fc3..ba5d79e4 100644
--- a/packages/ark/src/ark.ts
+++ b/packages/ark/src/ark.ts
@@ -1,5 +1,5 @@
import type {
- CurrentAccount,
+ Account,
Event,
EventWithReplies,
Keys,
@@ -9,25 +9,46 @@ import { invoke } from "@tauri-apps/api/core";
import { WebviewWindow } from "@tauri-apps/api/webview";
export class Ark {
- public account: CurrentAccount;
+ public account: Account;
+ public accounts: Array;
constructor() {
this.account = { npub: "" };
}
- public async verify_signer() {
+ public async get_all_accounts() {
try {
- const signer: boolean = await invoke("verify_signer");
- if (signer) {
- const account: string = await invoke("load_account");
- this.account.npub = account;
+ const accounts: Account[] = [];
+ const cmd: string[] = await invoke("get_all_nsecs");
- return true;
- } else {
- return false;
+ for (const item of cmd) {
+ accounts.push({ npub: item.replace(".nsec", "") });
}
+
+ this.accounts = accounts;
+ return accounts;
} catch (e) {
- console.error(String(e));
+ console.error(e);
+ return [];
+ }
+ }
+
+ public async load_selected_account(npub: string) {
+ try {
+ const fullNpub = `${npub}.nsec`;
+ const cmd: boolean = await invoke("load_selected_account", {
+ npub: fullNpub,
+ });
+
+ if (cmd) {
+ const contacts: string[] = await invoke("get_contact_list");
+ this.account.npub = npub;
+ this.account.contacts = contacts;
+ }
+
+ return cmd;
+ } catch (e) {
+ console.error(e);
return false;
}
}
diff --git a/packages/ark/src/hooks/useEvent.ts b/packages/ark/src/hooks/useEvent.ts
index 4e4e203e..8bb307af 100644
--- a/packages/ark/src/hooks/useEvent.ts
+++ b/packages/ark/src/hooks/useEvent.ts
@@ -6,12 +6,12 @@ export function useEvent(id: string) {
const { isLoading, isError, data } = useQuery({
queryKey: ["event", id],
queryFn: async () => {
- const event = await ark.get_event(id);
- if (!event)
- throw new Error(
- `Cannot get event with ${id}, will be retry after 10 seconds`,
- );
- return event;
+ try {
+ const event = await ark.get_event(id);
+ return event;
+ } catch (e) {
+ throw new Error(e);
+ }
},
refetchOnWindowFocus: false,
refetchOnMount: false,
diff --git a/packages/ark/src/hooks/useProfile.ts b/packages/ark/src/hooks/useProfile.ts
index 73784c91..f7bc9d4c 100644
--- a/packages/ark/src/hooks/useProfile.ts
+++ b/packages/ark/src/hooks/useProfile.ts
@@ -10,12 +10,12 @@ export function useProfile(pubkey: string) {
} = useQuery({
queryKey: ["user", pubkey],
queryFn: async () => {
- const profile = await ark.get_profile(pubkey);
- if (!profile)
- throw new Error(
- `Cannot get metadata for ${pubkey}, will be retry after 10 seconds`,
- );
- return profile;
+ try {
+ const profile = await ark.get_profile(pubkey);
+ return profile;
+ } catch (e) {
+ throw new Error(e);
+ }
},
refetchOnMount: false,
refetchOnWindowFocus: false,
diff --git a/packages/types/index.d.ts b/packages/types/index.d.ts
index d9b84e71..4d546806 100644
--- a/packages/types/index.d.ts
+++ b/packages/types/index.d.ts
@@ -54,7 +54,7 @@ export interface Metadata {
lud16?: string;
}
-export interface CurrentAccount {
+export interface Account {
npub: string;
contacts?: string[];
interests?: Interests;
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 54a68ffd..a702e2d6 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -41,9 +41,9 @@ dependencies = [
[[package]]
name = "aes"
-version = "0.8.3"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2"
+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
"cipher 0.4.4",
@@ -95,9 +95,9 @@ dependencies = [
[[package]]
name = "ahash"
-version = "0.8.7"
+version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
+checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff"
dependencies = [
"cfg-if",
"once_cell",
@@ -152,9 +152,9 @@ dependencies = [
[[package]]
name = "anstream"
-version = "0.6.11"
+version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5"
+checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540"
dependencies = [
"anstyle",
"anstyle-parse",
@@ -166,9 +166,9 @@ dependencies = [
[[package]]
name = "anstyle"
-version = "1.0.5"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220"
+checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc"
[[package]]
name = "anstyle-parse"
@@ -206,12 +206,12 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "arboard"
-version = "3.3.0"
+version = "3.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aafb29b107435aa276664c1db8954ac27a6e105cdad3c88287a199eb0e313c08"
+checksum = "1faa3c733d9a3dd6fbaf85da5d162a2e03b2e0033a90dceb0e2a90fdd1e5380a"
dependencies = [
"clipboard-win",
- "core-graphics 0.22.3",
+ "core-graphics",
"image",
"log",
"objc",
@@ -219,8 +219,8 @@ dependencies = [
"objc_id",
"parking_lot",
"thiserror",
- "winapi 0.3.9",
- "x11rb 0.12.0",
+ "windows-sys 0.48.0",
+ "x11rb",
]
[[package]]
@@ -247,13 +247,13 @@ dependencies = [
[[package]]
name = "async-channel"
-version = "2.1.1"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c"
+checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3"
dependencies = [
"concurrent-queue",
- "event-listener 4.0.3",
- "event-listener-strategy",
+ "event-listener 5.1.0",
+ "event-listener-strategy 0.5.0",
"futures-core",
"pin-project-lite",
]
@@ -316,7 +316,7 @@ dependencies = [
"futures-io",
"futures-lite 2.2.0",
"parking",
- "polling 3.3.2",
+ "polling 3.5.0",
"rustix 0.38.31",
"slab",
"tracing",
@@ -339,7 +339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b"
dependencies = [
"event-listener 4.0.3",
- "event-listener-strategy",
+ "event-listener-strategy 0.4.0",
"pin-project-lite",
]
@@ -368,7 +368,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -403,7 +403,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -676,15 +676,15 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.14.0"
+version = "3.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
+checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f"
[[package]]
name = "bytemuck"
-version = "1.14.1"
+version = "1.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9"
+checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f"
dependencies = [
"bytemuck_derive",
]
@@ -697,7 +697,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -772,9 +772,9 @@ dependencies = [
[[package]]
name = "cargo-platform"
-version = "0.1.6"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d"
+checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f"
dependencies = [
"serde",
]
@@ -841,9 +841,9 @@ dependencies = [
[[package]]
name = "cfg-expr"
-version = "0.15.6"
+version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6100bc57b6209840798d95cb2775684849d332f7bd788db2a8c8caf7ef82a41a"
+checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d"
dependencies = [
"smallvec",
"target-lexicon",
@@ -893,9 +893,9 @@ dependencies = [
[[package]]
name = "chrono"
-version = "0.4.33"
+version = "0.4.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb"
+checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
dependencies = [
"android-tzdata",
"iana-time-zone",
@@ -926,40 +926,38 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.4.18"
+version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
+checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
-version = "4.4.18"
+version = "4.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
+checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
- "strsim",
+ "strsim 0.11.0",
]
[[package]]
name = "clap_lex"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
+checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
[[package]]
name = "clipboard-win"
-version = "4.5.0"
+version = "5.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362"
+checksum = "3ec832972fefb8cf9313b45a0d1945e29c9c251f1d4c6eafc5fe2124c02d2e81"
dependencies = [
"error-code",
- "str-buf",
- "winapi 0.3.9",
]
[[package]]
@@ -972,7 +970,7 @@ dependencies = [
"block",
"cocoa-foundation",
"core-foundation",
- "core-graphics 0.23.1",
+ "core-graphics",
"foreign-types 0.5.0",
"libc",
"objc",
@@ -1057,19 +1055,6 @@ version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
-[[package]]
-name = "core-graphics"
-version = "0.22.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "core-graphics-types",
- "foreign-types 0.3.2",
- "libc",
-]
-
[[package]]
name = "core-graphics"
version = "0.23.1"
@@ -1105,9 +1090,9 @@ dependencies = [
[[package]]
name = "crc32fast"
-version = "1.3.2"
+version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
+checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa"
dependencies = [
"cfg-if",
]
@@ -1162,7 +1147,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
dependencies = [
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -1172,29 +1157,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e"
dependencies = [
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
name = "curl"
-version = "0.4.44"
+version = "0.4.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22"
+checksum = "1e2161dd6eba090ff1594084e95fd67aeccf04382ffea77999ea94ed42ec67b6"
dependencies = [
"curl-sys",
"libc",
"openssl-probe",
"openssl-sys",
"schannel",
- "socket2 0.4.10",
- "winapi 0.3.9",
+ "socket2 0.5.5",
+ "windows-sys 0.52.0",
]
[[package]]
name = "curl-sys"
-version = "0.4.71+curl-8.6.0"
+version = "0.4.72+curl-8.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7b12a7ab780395666cb576203dc3ed6e01513754939a600b85196ccf5356bc5"
+checksum = "29cbdc8314c447d11e8fd156dcdd031d9e02a7a976163e396b548c03153bc9ea"
dependencies = [
"cc",
"libc",
@@ -1202,7 +1187,7 @@ dependencies = [
"openssl-sys",
"pkg-config",
"vcpkg",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -1229,14 +1214,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
name = "darling"
-version = "0.20.5"
+version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8"
+checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955"
dependencies = [
"darling_core",
"darling_macro",
@@ -1244,27 +1229,27 @@ dependencies = [
[[package]]
name = "darling_core"
-version = "0.20.5"
+version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3"
+checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
- "strsim",
- "syn 2.0.48",
+ "strsim 0.10.0",
+ "syn 2.0.49",
]
[[package]]
name = "darling_macro"
-version = "0.20.5"
+version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77"
+checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be"
dependencies = [
"darling_core",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -1433,7 +1418,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -1519,9 +1504,9 @@ checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d"
[[package]]
name = "either"
-version = "1.9.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "embed-resource"
@@ -1554,9 +1539,9 @@ dependencies = [
[[package]]
name = "enumflags2"
-version = "0.7.8"
+version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939"
+checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d"
dependencies = [
"enumflags2_derive",
"serde",
@@ -1564,13 +1549,13 @@ dependencies = [
[[package]]
name = "enumflags2_derive"
-version = "0.7.8"
+version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246"
+checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -1591,13 +1576,9 @@ dependencies = [
[[package]]
name = "error-code"
-version = "2.3.1"
+version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
-dependencies = [
- "libc",
- "str-buf",
-]
+checksum = "281e452d3bad4005426416cdba5ccfd4f5c1280e10099e21db27f7c1c28347fc"
[[package]]
name = "event-listener"
@@ -1627,6 +1608,17 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "event-listener"
+version = "5.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27"
+dependencies = [
+ "concurrent-queue",
+ "parking",
+ "pin-project-lite",
+]
+
[[package]]
name = "event-listener-strategy"
version = "0.4.0"
@@ -1637,6 +1629,16 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "event-listener-strategy"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291"
+dependencies = [
+ "event-listener 5.1.0",
+ "pin-project-lite",
+]
+
[[package]]
name = "fallible-iterator"
version = "0.3.0"
@@ -1807,7 +1809,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -1925,7 +1927,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -2089,16 +2091,6 @@ dependencies = [
"version_check",
]
-[[package]]
-name = "gethostname"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177"
-dependencies = [
- "libc",
- "winapi 0.3.9",
-]
-
[[package]]
name = "gethostname"
version = "0.4.3"
@@ -2255,7 +2247,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -2367,7 +2359,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -2382,7 +2374,7 @@ dependencies = [
"futures-sink",
"futures-util",
"http 0.2.11",
- "indexmap 2.2.2",
+ "indexmap 2.2.3",
"slab",
"tokio",
"tokio-util",
@@ -2422,9 +2414,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
-version = "0.3.4"
+version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
+checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd"
[[package]]
name = "hex"
@@ -2623,8 +2615,8 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
- "strsim",
- "syn 2.0.48",
+ "strsim 0.10.0",
+ "syn 2.0.49",
"unic-langid",
]
@@ -2638,7 +2630,7 @@ dependencies = [
"i18n-config",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -2717,9 +2709,9 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "2.2.2"
+version = "2.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520"
+checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
@@ -2877,9 +2869,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
[[package]]
name = "jobserver"
-version = "0.1.27"
+version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
+checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
dependencies = [
"libc",
]
@@ -2892,9 +2884,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
[[package]]
name = "js-sys"
-version = "0.3.67"
+version = "0.3.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1"
+checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
dependencies = [
"wasm-bindgen",
]
@@ -3420,7 +3412,7 @@ version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327dd8102462fd463f00e81e408db1961975fd4f794bb8e1b16dc98a7d35f6f7"
dependencies = [
- "aes 0.8.3",
+ "aes 0.8.4",
"base64",
"bip39",
"bitcoin",
@@ -3446,9 +3438,9 @@ dependencies = [
[[package]]
name = "nostr-database"
-version = "0.28.0"
+version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b03cb406ff8efa194161b1cc1f6a81e46ad7ca4029acdf69d233775cc144bb2"
+checksum = "174b81445708157ecaa41f0439a2a0ce6df70f45ddc7a333c4a310347c09a990"
dependencies = [
"async-trait",
"flatbuffers",
@@ -3461,9 +3453,9 @@ dependencies = [
[[package]]
name = "nostr-relay-pool"
-version = "0.28.0"
+version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3c5f1df666ffd52c274dbf1061a51e9cf363b525202d63ac08822a309b746cd"
+checksum = "5265f07fef60fd1ff1d3a98d424dd0c29ececbe2a7865f2fc4ec013523e83030"
dependencies = [
"async-utility",
"async-wsocket",
@@ -3584,9 +3576,9 @@ dependencies = [
[[package]]
name = "num-complex"
-version = "0.4.4"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
+checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6"
dependencies = [
"num-traits",
]
@@ -3599,19 +3591,18 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-integer"
-version = "0.1.45"
+version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
- "autocfg",
"num-traits",
]
[[package]]
name = "num-iter"
-version = "0.1.43"
+version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
+checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9"
dependencies = [
"autocfg",
"num-integer",
@@ -3632,9 +3623,9 @@ dependencies = [
[[package]]
name = "num-traits"
-version = "0.2.17"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
@@ -3778,7 +3769,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -3789,9 +3780,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
-version = "300.2.2+3.2.1"
+version = "300.2.3+3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8bbfad0063610ac26ee79f7484739e2b07555a75c42453b89263830b5c8103bc"
+checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843"
dependencies = [
"cc",
]
@@ -4070,7 +4061,7 @@ dependencies = [
"phf_shared 0.11.2",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -4117,7 +4108,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -4145,9 +4136,9 @@ dependencies = [
[[package]]
name = "pkg-config"
-version = "0.3.29"
+version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb"
+checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "platforms"
@@ -4162,7 +4153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef"
dependencies = [
"base64",
- "indexmap 2.2.2",
+ "indexmap 2.2.3",
"line-wrap",
"quick-xml 0.31.0",
"serde",
@@ -4171,9 +4162,9 @@ dependencies = [
[[package]]
name = "png"
-version = "0.17.11"
+version = "0.17.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f6c3c3e617595665b8ea2ff95a86066be38fb121ff920a9c0eb282abcd1da5a"
+checksum = "78c2378060fb13acff3ba0325b83442c1d2c44fbb76df481160ddc1687cce160"
dependencies = [
"bitflags 1.3.2",
"crc32fast",
@@ -4200,9 +4191,9 @@ dependencies = [
[[package]]
name = "polling"
-version = "3.3.2"
+version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41"
+checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9"
dependencies = [
"cfg-if",
"concurrent-queue",
@@ -4567,16 +4558,17 @@ dependencies = [
[[package]]
name = "ring"
-version = "0.17.7"
+version = "0.17.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74"
+checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
+ "cfg-if",
"getrandom 0.2.12",
"libc",
"spin",
"untrusted",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -4613,7 +4605,7 @@ dependencies = [
"proc-macro2",
"quote",
"rust-embed-utils",
- "syn 2.0.48",
+ "syn 2.0.49",
"walkdir 2.4.0",
]
@@ -4991,7 +4983,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -5011,7 +5003,7 @@ version = "1.0.113"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79"
dependencies = [
- "indexmap 2.2.2",
+ "indexmap 2.2.3",
"itoa 1.0.10",
"ryu",
"serde",
@@ -5025,7 +5017,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -5051,16 +5043,17 @@ dependencies = [
[[package]]
name = "serde_with"
-version = "3.6.0"
+version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981"
+checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270"
dependencies = [
"base64",
"chrono",
"hex",
"indexmap 1.9.3",
- "indexmap 2.2.2",
+ "indexmap 2.2.3",
"serde",
+ "serde_derive",
"serde_json",
"serde_with_macros",
"time",
@@ -5068,14 +5061,14 @@ dependencies = [
[[package]]
name = "serde_with_macros"
-version = "3.6.0"
+version = "3.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15"
+checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d"
dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -5217,7 +5210,7 @@ dependencies = [
"bytemuck",
"cfg_aliases 0.2.0",
"cocoa",
- "core-graphics 0.23.1",
+ "core-graphics",
"drm",
"fastrand 2.0.1",
"foreign-types 0.5.0",
@@ -5235,7 +5228,7 @@ dependencies = [
"wayland-sys",
"web-sys",
"windows-sys 0.52.0",
- "x11rb 0.13.0",
+ "x11rb",
]
[[package]]
@@ -5291,12 +5284,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-[[package]]
-name = "str-buf"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
-
[[package]]
name = "string_cache"
version = "0.8.7"
@@ -5329,6 +5316,12 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+[[package]]
+name = "strsim"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01"
+
[[package]]
name = "subtle"
version = "2.5.0"
@@ -5359,9 +5352,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.48"
+version = "2.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
+checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496"
dependencies = [
"proc-macro2",
"quote",
@@ -5427,7 +5420,7 @@ dependencies = [
"cc",
"cocoa",
"core-foundation",
- "core-graphics 0.23.1",
+ "core-graphics",
"crossbeam-channel",
"dispatch",
"gdkwayland-sys",
@@ -5594,7 +5587,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
"tauri-codegen",
"tauri-utils",
]
@@ -5743,7 +5736,7 @@ version = "2.0.0-beta.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afef676918e519499ff7ec52aa93ba002bf3bf37ee81d36d3767121c12b85f62"
dependencies = [
- "gethostname 0.4.3",
+ "gethostname",
"log",
"os_info",
"serde",
@@ -5975,13 +5968,12 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.9.0"
+version = "3.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
+checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67"
dependencies = [
"cfg-if",
"fastrand 2.0.1",
- "redox_syscall",
"rustix 0.38.31",
"windows-sys 0.52.0",
]
@@ -6005,22 +5997,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
[[package]]
name = "thiserror"
-version = "1.0.56"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
+checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.56"
+version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
+checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -6148,7 +6140,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -6272,7 +6264,7 @@ version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
- "indexmap 2.2.2",
+ "indexmap 2.2.3",
"serde",
"serde_spanned",
"toml_datetime",
@@ -6285,7 +6277,7 @@ version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
- "indexmap 2.2.2",
+ "indexmap 2.2.3",
"serde",
"serde_spanned",
"toml_datetime",
@@ -6317,7 +6309,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -6361,12 +6353,12 @@ dependencies = [
[[package]]
name = "tray-icon"
-version = "0.11.2"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd26786733426b0bf632ebab410c162859a911f26c7c9e208b9e329a8ca94481"
+checksum = "7a4d9ddd4a7c0f3b6862af1c4911b529a49db4ee89310d3a258859c2f5053fdd"
dependencies = [
"cocoa",
- "core-graphics 0.23.1",
+ "core-graphics",
"crossbeam-channel",
"dirs-next",
"libappindicator",
@@ -6483,9 +6475,9 @@ dependencies = [
[[package]]
name = "unicode-segmentation"
-version = "1.10.1"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
+checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
[[package]]
name = "universal-hash"
@@ -6630,9 +6622,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.90"
+version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406"
+checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
@@ -6640,24 +6632,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.90"
+version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd"
+checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.40"
+version = "0.4.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461"
+checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
dependencies = [
"cfg-if",
"js-sys",
@@ -6667,9 +6659,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.90"
+version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999"
+checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -6677,22 +6669,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.90"
+version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7"
+checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.90"
+version = "0.2.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
+checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
[[package]]
name = "wasm-streams"
@@ -6775,9 +6767,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.67"
+version = "0.3.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed"
+checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -6878,7 +6870,7 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -6935,15 +6927,6 @@ dependencies = [
"winapi 0.3.9",
]
-[[package]]
-name = "winapi-wsapoll"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
-dependencies = [
- "winapi 0.3.9",
-]
-
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@@ -7020,7 +7003,7 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -7031,7 +7014,7 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -7243,9 +7226,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
[[package]]
name = "winnow"
-version = "0.5.37"
+version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]
@@ -7289,7 +7272,7 @@ dependencies = [
"block",
"cfg_aliases 0.1.1",
"cocoa",
- "core-graphics 0.23.1",
+ "core-graphics",
"crossbeam-channel",
"dunce",
"gdkx11",
@@ -7345,19 +7328,6 @@ dependencies = [
"pkg-config",
]
-[[package]]
-name = "x11rb"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a"
-dependencies = [
- "gethostname 0.3.0",
- "nix",
- "winapi 0.3.9",
- "winapi-wsapoll",
- "x11rb-protocol 0.12.0",
-]
-
[[package]]
name = "x11rb"
version = "0.13.0"
@@ -7365,21 +7335,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a"
dependencies = [
"as-raw-xcb-connection",
- "gethostname 0.4.3",
+ "gethostname",
"libc",
"libloading 0.8.1",
"once_cell",
"rustix 0.38.31",
- "x11rb-protocol 0.13.0",
-]
-
-[[package]]
-name = "x11rb-protocol"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc"
-dependencies = [
- "nix",
+ "x11rb-protocol",
]
[[package]]
@@ -7515,7 +7476,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -7535,7 +7496,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.49",
]
[[package]]
@@ -7544,7 +7505,7 @@ version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
- "aes 0.8.3",
+ "aes 0.8.4",
"byteorder",
"bzip2",
"constant_time_eq",
diff --git a/src-tauri/src/commands/folder.rs b/src-tauri/src/commands/folder.rs
index 2bea7d0b..4b41b6fa 100644
--- a/src-tauri/src/commands/folder.rs
+++ b/src-tauri/src/commands/folder.rs
@@ -1,4 +1,5 @@
use std::process::Command;
+use tauri::Manager;
#[tauri::command]
pub async fn show_in_folder(path: String) {
@@ -46,3 +47,26 @@ pub async fn show_in_folder(path: String) {
Command::new("open").args(["-R", &path]).spawn().unwrap();
}
}
+
+#[tauri::command]
+pub fn get_all_nsecs(app_handle: tauri::AppHandle) -> Result, ()> {
+ let dir = app_handle.path().app_config_dir().unwrap();
+
+ if let Ok(paths) = std::fs::read_dir(dir) {
+ let files = paths
+ .filter_map(|res| res.ok())
+ .map(|dir_entry| dir_entry.path())
+ .filter_map(|path| {
+ if path.extension().map_or(false, |ext| ext == "nsec") {
+ Some(path.file_name().unwrap().to_str().unwrap().to_string())
+ } else {
+ None
+ }
+ })
+ .collect::>();
+
+ Ok(files)
+ } else {
+ Err(())
+ }
+}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 35eb7da7..e057eee8 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -9,23 +9,11 @@ pub mod nostr;
use age::secrecy::ExposeSecret;
use keyring::Entry;
use nostr_sdk::prelude::*;
-use std::error::Error;
-use std::fs::File;
-use std::io::{BufReader, Read};
-use std::iter;
-use std::path::Path;
-use std::path::PathBuf;
-use std::str::FromStr;
-use std::sync::Arc;
-use std::time::Duration;
use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher;
+use tokio::sync::Mutex;
-pub struct Nostr {
- pub client: Arc,
- pub client_user: Option,
- pub contact_list: Option>,
-}
+pub struct NostrClient(Mutex);
fn main() {
let mut ctx = tauri::generate_context!();
@@ -33,35 +21,10 @@ fn main() {
.setup(|app| {
let handle = app.handle().clone();
let config_dir = handle.path().app_config_dir().unwrap();
-
let keyring_entry = Entry::new("Lume Secret Storage", "AppKey").unwrap();
- let mut stored_nsec_key = None;
- if let Ok(key) = keyring_entry.get_password() {
- let app_key = age::x25519::Identity::from_str(&key.to_string()).unwrap();
- if let Ok(nsec_paths) = get_nsec_paths(config_dir.as_path()) {
- let last_nsec_path = nsec_paths.last();
- if let Some(nsec_path) = last_nsec_path {
- let file = File::open(nsec_path).expect("Open nsec file failed");
- let file_buf = BufReader::new(file);
- let decryptor = match age::Decryptor::new_buffered(file_buf).expect("Decryptor failed")
- {
- age::Decryptor::Recipients(d) => d,
- _ => unreachable!(),
- };
-
- let mut decrypted = vec![];
- let mut reader = decryptor
- .decrypt(iter::once(&app_key as &dyn age::Identity))
- .expect("Decrypt nsec file failed");
- reader
- .read_to_end(&mut decrypted)
- .expect("Read secret key failed");
-
- stored_nsec_key = Some(String::from_utf8(decrypted).expect("Not valid"))
- }
- }
- } else {
+ // Create new master key if not exist
+ if let Err(_) = keyring_entry.get_password() {
let app_key = age::x25519::Identity::generate().to_string();
let app_secret = app_key.expose_secret();
let _ = keyring_entry.set_password(app_secret);
@@ -86,42 +49,16 @@ fn main() {
.add_relay("wss://bostr.yonle.lecturify.net")
.await
.expect("Failed to add bootstrap relay.");
+ client
+ .add_relay("wss://purplepag.es")
+ .await
+ .expect("Failed to add bootstrap relay.");
// Connect
client.connect().await;
- // Prepare contact list
- let mut user = None;
- let mut contact_list = None;
-
- // Run somethings if account existed
- if let Some(key) = stored_nsec_key {
- let secret_key = SecretKey::from_bech32(key).expect("Get secret key failed");
- let keys = Keys::new(secret_key);
- let public_key = keys.public_key();
- let signer = NostrSigner::Keys(keys);
-
- // Update client's signer
- client.set_signer(Some(signer)).await;
-
- // Update user
- user = Some(public_key);
-
- // Get contact list
- contact_list = Some(
- client
- .get_contact_list(Some(Duration::from_secs(10)))
- .await
- .unwrap(),
- );
- };
-
- // Init global state
- handle.manage(Nostr {
- client: client.into(),
- client_user: user.into(),
- contact_list: contact_list.into(),
- })
+ // Update global state
+ handle.manage(NostrClient(Mutex::new(client)))
});
Ok(())
@@ -138,7 +75,6 @@ fn main() {
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_upload::init())
.plugin(tauri_plugin_updater::Builder::new().build())
- .plugin(tauri_plugin_window_state::Builder::default().build())
.plugin(tauri_plugin_autostart::init(
MacosLauncher::LaunchAgent,
Some(vec![]),
@@ -149,11 +85,12 @@ fn main() {
nostr::keys::get_public_key,
nostr::keys::update_signer,
nostr::keys::verify_signer,
- nostr::keys::load_account,
+ nostr::keys::load_selected_account,
nostr::keys::event_to_bech32,
nostr::keys::user_to_bech32,
nostr::keys::verify_nip05,
nostr::metadata::get_profile,
+ nostr::metadata::get_contact_list,
nostr::metadata::create_profile,
nostr::event::get_event,
nostr::event::get_text_events,
@@ -164,6 +101,7 @@ fn main() {
nostr::event::upvote,
nostr::event::downvote,
commands::folder::show_in_folder,
+ commands::folder::get_all_nsecs,
commands::opg::fetch_opg,
])
.build(ctx)
@@ -175,19 +113,3 @@ fn main() {
_ => {}
});
}
-
-fn get_nsec_paths(dir: &Path) -> Result, Box> {
- let paths = std::fs::read_dir(dir)?
- .filter_map(|res| res.ok())
- .map(|dir_entry| dir_entry.path())
- .filter_map(|path| {
- if path.extension().map_or(false, |ext| ext == "nsec") {
- Some(path)
- } else {
- None
- }
- })
- .collect::>();
-
- Ok(paths)
-}
diff --git a/src-tauri/src/nostr/event.rs b/src-tauri/src/nostr/event.rs
index 835e6677..f2cd675f 100644
--- a/src-tauri/src/nostr/event.rs
+++ b/src-tauri/src/nostr/event.rs
@@ -1,68 +1,85 @@
-use crate::Nostr;
+use crate::NostrClient;
use nostr_sdk::prelude::*;
use std::{str::FromStr, time::Duration};
use tauri::State;
#[tauri::command]
-pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result {
- let client = &nostr.client;
- let event_id: EventId = match Nip19::from_bech32(id) {
+pub async fn get_event(id: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
+ let event_id: Option = match Nip19::from_bech32(id) {
Ok(val) => match val {
- Nip19::EventId(id) => id,
- Nip19::Event(event) => event.event_id,
- _ => panic!("not nip19"),
+ Nip19::EventId(id) => Some(id),
+ Nip19::Event(event) => Some(event.event_id),
+ _ => None,
+ },
+ Err(_) => match EventId::from_hex(id) {
+ Ok(val) => Some(val),
+ Err(_) => None,
},
- Err(_) => EventId::from_hex(id).unwrap(),
};
- let filter = Filter::new().id(event_id);
- let events = client
- .get_events_of(vec![filter], Some(Duration::from_secs(10)))
- .await
- .expect("Get event failed");
+ if let Some(id) = event_id {
+ let filter = Filter::new().id(id);
- if let Some(event) = events.first() {
- Ok(event.as_json())
+ if let Ok(events) = &client
+ .get_events_of(vec![filter], Some(Duration::from_secs(10)))
+ .await
+ {
+ if let Some(event) = events.first() {
+ Ok(event.as_json())
+ } else {
+ Err("Event not found with current relay list".into())
+ }
+ } else {
+ Err("Event not found with current relay list".into())
+ }
} else {
- Err("Event not found".into())
+ Err("EventId is not valid".into())
}
}
#[tauri::command]
pub async fn get_text_events(
limit: usize,
- until: Option,
- nostr: State<'_, Nostr>,
+ until: Option<&str>,
+ contact_list: Option>,
+ state: State<'_, NostrClient>,
) -> Result, ()> {
- let client = &nostr.client;
- let contact_list = &nostr.contact_list.clone().unwrap();
+ let client = state.0.lock().await;
- let authors: Vec = contact_list.into_iter().map(|x| x.public_key).collect();
- let mut final_until = Timestamp::now();
+ if let Some(list) = contact_list {
+ let authors: Vec = list
+ .into_iter()
+ .map(|x| PublicKey::from_str(x).unwrap())
+ .collect();
+ let mut final_until = Timestamp::now();
- if let Some(t) = until {
- final_until = Timestamp::from_str(&t).unwrap();
- }
+ if let Some(t) = until {
+ final_until = Timestamp::from_str(&t).unwrap();
+ }
- let filter = Filter::new()
- .kinds(vec![Kind::TextNote, Kind::Repost])
- .authors(authors)
- .limit(limit)
- .until(final_until);
+ let filter = Filter::new()
+ .kinds(vec![Kind::TextNote, Kind::Repost])
+ .authors(authors)
+ .limit(limit)
+ .until(final_until);
- if let Ok(events) = client
- .get_events_of(vec![filter], Some(Duration::from_secs(10)))
- .await
- {
- Ok(events)
+ if let Ok(events) = client
+ .get_events_of(vec![filter], Some(Duration::from_secs(10)))
+ .await
+ {
+ Ok(events)
+ } else {
+ Err(())
+ }
} else {
Err(())
}
}
#[tauri::command]
-pub async fn get_event_thread(id: &str, nostr: State<'_, Nostr>) -> Result, ()> {
- let client = &nostr.client;
+pub async fn get_event_thread(id: &str, state: State<'_, NostrClient>) -> Result, ()> {
+ let client = state.0.lock().await;
let event_id = EventId::from_hex(id).unwrap();
let filter = Filter::new().kinds(vec![Kind::TextNote]).event(event_id);
@@ -77,9 +94,8 @@ pub async fn get_event_thread(id: &str, nostr: State<'_, Nostr>) -> Result) -> Result {
- let client = &nostr.client;
-
+pub async fn publish(content: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
let event = client
.publish_text_note(content, [])
.await
@@ -92,10 +108,9 @@ pub async fn publish(content: &str, nostr: State<'_, Nostr>) -> Result,
- nostr: State<'_, Nostr>,
+ state: State<'_, NostrClient>,
) -> Result {
- let client = &nostr.client;
-
+ let client = state.0.lock().await;
if let Ok(event_tags) = Tag::parse(tags) {
let event = client
.publish_text_note(content, vec![event_tags])
@@ -109,8 +124,8 @@ pub async fn reply_to(
}
#[tauri::command]
-pub async fn repost(id: &str, pubkey: &str, nostr: State<'_, Nostr>) -> Result {
- let client = &nostr.client;
+pub async fn repost(id: &str, pubkey: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
let public_key = PublicKey::from_str(pubkey).unwrap();
let event_id = EventId::from_hex(id).unwrap();
@@ -123,8 +138,8 @@ pub async fn repost(id: &str, pubkey: &str, nostr: State<'_, Nostr>) -> Result) -> Result {
- let client = &nostr.client;
+pub async fn upvote(id: &str, pubkey: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
let public_key = PublicKey::from_str(pubkey).unwrap();
let event_id = EventId::from_hex(id).unwrap();
@@ -137,8 +152,12 @@ pub async fn upvote(id: &str, pubkey: &str, nostr: State<'_, Nostr>) -> Result) -> Result {
- let client = &nostr.client;
+pub async fn downvote(
+ id: &str,
+ pubkey: &str,
+ state: State<'_, NostrClient>,
+) -> Result {
+ let client = state.0.lock().await;
let public_key = PublicKey::from_str(pubkey).unwrap();
let event_id = EventId::from_hex(id).unwrap();
diff --git a/src-tauri/src/nostr/keys.rs b/src-tauri/src/nostr/keys.rs
index ef912ce6..7b96e856 100644
--- a/src-tauri/src/nostr/keys.rs
+++ b/src-tauri/src/nostr/keys.rs
@@ -1,6 +1,9 @@
-use crate::Nostr;
+use crate::NostrClient;
use keyring::Entry;
use nostr_sdk::prelude::*;
+use std::io::{BufReader, Read};
+use std::iter;
+use std::time::Duration;
use std::{fs::File, io::Write, str::FromStr};
use tauri::{Manager, State};
@@ -28,7 +31,7 @@ pub fn create_keys() -> Result {
pub async fn save_key(
nsec: &str,
app_handle: tauri::AppHandle,
- nostr: State<'_, Nostr>,
+ state: State<'_, NostrClient>,
) -> Result {
if let Ok(nostr_secret_key) = SecretKey::from_bech32(nsec) {
let nostr_keys = Keys::new(nostr_secret_key);
@@ -36,7 +39,7 @@ pub async fn save_key(
let signer = NostrSigner::Keys(nostr_keys);
// Update client's signer
- let client = &nostr.client;
+ let client = state.0.lock().await;
client.set_signer(Some(signer)).await;
let keyring_entry = Entry::new("Lume Secret Storage", "AppKey").unwrap();
@@ -78,8 +81,8 @@ pub fn get_public_key(nsec: &str) -> Result {
}
#[tauri::command]
-pub async fn update_signer(nsec: &str, nostr: State<'_, Nostr>) -> Result<(), ()> {
- let client = &nostr.client;
+pub async fn update_signer(nsec: &str, state: State<'_, NostrClient>) -> Result<(), ()> {
+ let client = state.0.lock().await;
let secret_key = SecretKey::from_bech32(nsec).unwrap();
let keys = Keys::new(secret_key);
let signer = NostrSigner::Keys(keys);
@@ -90,8 +93,8 @@ pub async fn update_signer(nsec: &str, nostr: State<'_, Nostr>) -> Result<(), ()
}
#[tauri::command]
-pub async fn verify_signer(nostr: State<'_, Nostr>) -> Result {
- let client = &nostr.client;
+pub async fn verify_signer(state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
if let Ok(_) = client.signer().await {
Ok(true)
@@ -101,13 +104,61 @@ pub async fn verify_signer(nostr: State<'_, Nostr>) -> Result {
}
#[tauri::command]
-pub fn load_account(nostr: State<'_, Nostr>) -> Result {
- let user = &nostr.client_user;
+pub async fn load_selected_account(
+ npub: &str,
+ app_handle: tauri::AppHandle,
+ state: State<'_, NostrClient>,
+) -> Result {
+ let client = state.0.lock().await;
+ let config_dir = app_handle.path().app_config_dir().unwrap();
+ let keyring_entry = Entry::new("Lume Secret Storage", "AppKey").unwrap();
- if let Some(key) = user {
- Ok(key.to_hex())
+ // Get master password
+ if let Ok(key) = keyring_entry.get_password() {
+ // Build master key
+ let app_key = age::x25519::Identity::from_str(&key.to_string()).unwrap();
+
+ // Open nsec file
+ if let Ok(file) = File::open(config_dir.join(npub)) {
+ let file_buf = BufReader::new(file);
+ let decryptor = match age::Decryptor::new_buffered(file_buf).expect("Decryptor failed") {
+ age::Decryptor::Recipients(d) => d,
+ _ => unreachable!(),
+ };
+
+ let mut decrypted = vec![];
+ let mut reader = decryptor
+ .decrypt(iter::once(&app_key as &dyn age::Identity))
+ .expect("Decrypt nsec file failed");
+ reader
+ .read_to_end(&mut decrypted)
+ .expect("Read secret key failed");
+
+ // Get decrypted nsec key
+ let nsec_key = String::from_utf8(decrypted).unwrap();
+
+ // Build nostr signer
+ let secret_key = SecretKey::from_bech32(nsec_key).expect("Get secret key failed");
+ let keys = Keys::new(secret_key);
+ let signer = NostrSigner::Keys(keys);
+
+ // Update signer
+ client.set_signer(Some(signer)).await;
+
+ // Update contact list
+ let _contact_list = Some(
+ client
+ .get_contact_list(Some(Duration::from_secs(10)))
+ .await
+ .unwrap(),
+ );
+
+ Ok(true)
+ } else {
+ Ok(false)
+ }
} else {
- Err(())
+ Err("App Key not found".into())
}
}
diff --git a/src-tauri/src/nostr/metadata.rs b/src-tauri/src/nostr/metadata.rs
index add9e149..ec032cc7 100644
--- a/src-tauri/src/nostr/metadata.rs
+++ b/src-tauri/src/nostr/metadata.rs
@@ -1,35 +1,52 @@
-use crate::Nostr;
+use crate::NostrClient;
use nostr_sdk::prelude::*;
use std::{str::FromStr, time::Duration};
use tauri::State;
#[tauri::command]
-pub async fn get_profile(id: &str, nostr: State<'_, Nostr>) -> Result {
- let client = &nostr.client;
- let public_key: PublicKey = match Nip19::from_bech32(id) {
+pub async fn get_profile(id: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
+ let public_key: Option = match Nip19::from_bech32(id) {
Ok(val) => match val {
- Nip19::Pubkey(pubkey) => pubkey,
- Nip19::Profile(profile) => profile.public_key,
- _ => panic!("not nip19"),
+ Nip19::Pubkey(pubkey) => Some(pubkey),
+ Nip19::Profile(profile) => Some(profile.public_key),
+ _ => None,
+ },
+ Err(_) => match PublicKey::from_str(id) {
+ Ok(val) => Some(val),
+ Err(_) => None,
},
- Err(_) => PublicKey::from_str(id).unwrap(),
};
- let filter = Filter::new()
- .author(public_key)
- .kind(Kind::Metadata)
- .limit(1);
+ if let Some(author) = public_key {
+ let filter = Filter::new().author(author).kind(Kind::Metadata).limit(1);
+ let events = client
+ .get_events_of(vec![filter], Some(Duration::from_secs(10)))
+ .await
+ .expect("Get metadata failed");
- let events = client
- .get_events_of(vec![filter], Some(Duration::from_secs(10)))
- .await
- .expect("Get metadata failed");
-
- if let Some(event) = events.first() {
- let metadata: Metadata = Metadata::from_json(&event.content).unwrap();
- Ok(metadata)
+ if let Some(event) = events.first() {
+ let metadata: Metadata = Metadata::from_json(&event.content).unwrap();
+ Ok(metadata)
+ } else {
+ let rand_metadata = Metadata::new();
+ Ok(rand_metadata)
+ }
} else {
- Err(())
+ Err("Public Key is not valid".into())
+ }
+}
+
+#[tauri::command]
+pub async fn get_contact_list(state: State<'_, NostrClient>) -> Result, String> {
+ let client = state.0.lock().await;
+ let contact_list = client.get_contact_list(Some(Duration::from_secs(10))).await;
+
+ if let Ok(list) = contact_list {
+ let v = list.into_iter().map(|f| f.public_key.to_hex()).collect();
+ Ok(v)
+ } else {
+ Err("Contact list not found".into())
}
}
@@ -43,10 +60,9 @@ pub async fn create_profile(
nip05: &str,
lud16: &str,
website: &str,
- nostr: State<'_, Nostr>,
+ state: State<'_, NostrClient>,
) -> Result {
- let client = &nostr.client;
-
+ let client = state.0.lock().await;
let metadata = Metadata::new()
.name(name)
.display_name(display_name)
diff --git a/src-tauri/src/nostr/relay.rs b/src-tauri/src/nostr/relay.rs
index d48621e7..2f035570 100644
--- a/src-tauri/src/nostr/relay.rs
+++ b/src-tauri/src/nostr/relay.rs
@@ -1,10 +1,10 @@
-use crate::Nostr;
+use crate::NostrClient;
use nostr_sdk::prelude::*;
use tauri::State;
#[tauri::command]
-pub async fn list_connected_relays(nostr: State<'_, Nostr>) -> Result, ()> {
- let client = &nostr.client;
+pub async fn list_connected_relays(state: State<'_, NostrClient>) -> Result, ()> {
+ let client = state.0.lock().await;
let relays = client.relays().await;
let list: Vec = relays.into_keys().collect();
@@ -12,8 +12,8 @@ pub async fn list_connected_relays(nostr: State<'_, Nostr>) -> Result,
}
#[tauri::command]
-pub async fn connect_relay(relay: &str, nostr: State<'_, Nostr>) -> Result {
- let client = &nostr.client;
+pub async fn connect_relay(relay: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
if let Ok(_) = client.add_relay(relay).await {
Ok(true)
} else {
@@ -22,8 +22,8 @@ pub async fn connect_relay(relay: &str, nostr: State<'_, Nostr>) -> Result) -> Result {
- let client = &nostr.client;
+pub async fn remove_relay(relay: &str, state: State<'_, NostrClient>) -> Result {
+ let client = state.0.lock().await;
if let Ok(_) = client.remove_relay(relay).await {
Ok(true)
} else {