feat: upgrade to rust nostr 0.30.0 and migrate to nostrdb
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -35,3 +35,4 @@ dist/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
*.pem
|
*.pem
|
||||||
.vscode/
|
.vscode/
|
||||||
|
ndb/
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { LoaderIcon } from "@lume/icons";
|
|||||||
import { Event, Kind } from "@lume/types";
|
import { Event, Kind } from "@lume/types";
|
||||||
import { Await, createFileRoute } from "@tanstack/react-router";
|
import { Await, createFileRoute } from "@tanstack/react-router";
|
||||||
import { Virtualizer } from "virtua";
|
import { Virtualizer } from "virtua";
|
||||||
import { fetch } from "@tauri-apps/plugin-http";
|
|
||||||
import { defer } from "@tanstack/react-router";
|
import { defer } from "@tanstack/react-router";
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ export function Screen() {
|
|||||||
className="inline-flex items-center gap-2 text-sm font-medium"
|
className="inline-flex items-center gap-2 text-sm font-medium"
|
||||||
disabled
|
disabled
|
||||||
>
|
>
|
||||||
<LoaderIcon className="size-5" />
|
<LoaderIcon className="animate-spin size-5" />
|
||||||
Loading...
|
Loading...
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
548
src-tauri/Cargo.lock
generated
548
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ rust-version = "1.68"
|
|||||||
tauri-build = { version = "2.0.0-beta", features = [] }
|
tauri-build = { version = "2.0.0-beta", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nostr-sdk = { version = "0.29", features = ["sqlite"] }
|
nostr-sdk = { version = "0.30", features = ["ndb"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ fn main() {
|
|||||||
|
|
||||||
tauri::async_runtime::spawn(async move {
|
tauri::async_runtime::spawn(async move {
|
||||||
// Create nostr database connection
|
// Create nostr database connection
|
||||||
let sqlite = SQLiteDatabase::open(home_dir.join("Lume/lume.db")).await;
|
let ndb = NdbDatabase::open("./ndb");
|
||||||
|
|
||||||
// Create nostr connection
|
// Create nostr connection
|
||||||
let client = match sqlite {
|
let client = match ndb {
|
||||||
Ok(db) => ClientBuilder::default().database(db).build(),
|
Ok(db) => ClientBuilder::default().database(db).build(),
|
||||||
Err(_) => ClientBuilder::default().build(),
|
Err(_) => ClientBuilder::default().build(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ pub async fn publish(
|
|||||||
state: State<'_, Nostr>,
|
state: State<'_, Nostr>,
|
||||||
) -> Result<String, String> {
|
) -> Result<String, String> {
|
||||||
let client = &state.client;
|
let client = &state.client;
|
||||||
let final_tags = tags.into_iter().map(|val| Tag::parse(val).unwrap());
|
let final_tags = tags.into_iter().map(|val| Tag::parse(&val).unwrap());
|
||||||
|
|
||||||
if let Ok(event_id) = client.publish_text_note(content, final_tags).await {
|
if let Ok(event_id) = client.publish_text_note(content, final_tags).await {
|
||||||
Ok(event_id.to_bech32().unwrap())
|
Ok(event_id.to_bech32().unwrap())
|
||||||
|
|||||||
Reference in New Issue
Block a user