Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ca20bbd298 | |||
| c6da06cd4d | |||
| 50bf6c04c1 |
25
src-tauri/Cargo.lock
generated
25
src-tauri/Cargo.lock
generated
@@ -12,6 +12,7 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
|
||||
name = "Lume"
|
||||
version = "24.11.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"border",
|
||||
"futures",
|
||||
"keyring",
|
||||
@@ -47,6 +48,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
"webbrowser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3091,7 +3093,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.48.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3490,7 +3492,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||
[[package]]
|
||||
name = "nostr"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"async-trait",
|
||||
@@ -3521,7 +3523,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostr-connect"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"async-utility",
|
||||
@@ -3530,13 +3532,12 @@ dependencies = [
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"webbrowser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nostr-database"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"flatbuffers",
|
||||
@@ -3550,7 +3551,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostr-lmdb"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"heed",
|
||||
"nostr",
|
||||
@@ -3563,7 +3564,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostr-relay-pool"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"async-utility",
|
||||
"async-wsocket",
|
||||
@@ -3581,7 +3582,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostr-sdk"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"async-utility",
|
||||
"atomic-destructor",
|
||||
@@ -3600,7 +3601,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nostr-zapper"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"nostr",
|
||||
@@ -3736,7 +3737,7 @@ version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.3.1",
|
||||
"proc-macro-crate 3.2.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.79",
|
||||
@@ -3745,7 +3746,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "nwc"
|
||||
version = "0.36.0"
|
||||
source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6"
|
||||
source = "git+https://github.com/rust-nostr/nostr#46d96391d94316d6bf1637e10f1b980f866f1879"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"async-utility",
|
||||
@@ -7267,7 +7268,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -49,10 +49,8 @@ regex = "1.10.4"
|
||||
keyring = { version = "3", features = ["apple-native", "windows-native"] }
|
||||
keyring-search = { git = "https://github.com/reyamir/keyring-search" }
|
||||
tracing-subscriber = { version = "0.3.18", features = ["fmt"] }
|
||||
|
||||
[patch.'https://github.com/rust-nostr/nostr']
|
||||
nostr-sdk = { git = "https://github.com/reyamir/nostr", branch = "feat/open-auth-url", features = ["lmdb", "webln", "all-nips"] }
|
||||
nostr-connect = { git = "https://github.com/reyamir/nostr", branch = "feat/open-auth-url" }
|
||||
async-trait = "0.1.83"
|
||||
webbrowser = "1.0.2"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
border = { git = "https://github.com/ahkohd/tauri-toolkit", branch = "v2" }
|
||||
|
||||
@@ -14,6 +14,17 @@ struct Account {
|
||||
nostr_connect: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct AuthHandler;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl AuthUrlHandler for AuthHandler {
|
||||
async fn on_auth_url(&self, auth_url: Url) -> Result<()> {
|
||||
webbrowser::open(auth_url.as_str())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn get_accounts() -> Vec<String> {
|
||||
@@ -94,19 +105,29 @@ pub async fn connect_account(uri: String, state: State<'_, Nostr>) -> Result<Str
|
||||
let remote_npub = remote_user.to_bech32().map_err(|err| err.to_string())?;
|
||||
|
||||
// Init nostr connect
|
||||
let nostr_connect = NostrConnect::new(bunker_uri, app_keys, Duration::from_secs(120), None)
|
||||
let mut nostr_connect = NostrConnect::new(bunker_uri, app_keys, Duration::from_secs(120), None)
|
||||
.map_err(|err| err.to_string())?;
|
||||
|
||||
let bunker_uri = nostr_connect
|
||||
// Handle auth url
|
||||
nostr_connect.auth_url_handler(AuthHandler);
|
||||
|
||||
let keyring = Entry::new("Lume Safe Storage", &remote_npub).map_err(|err| err.to_string())?;
|
||||
|
||||
let reuse_bunker = nostr_connect
|
||||
.bunker_uri()
|
||||
.await
|
||||
.map_err(|err| err.to_string())?;
|
||||
|
||||
let keyring = Entry::new("Lume Safe Storage", &remote_npub).map_err(|err| err.to_string())?;
|
||||
let mut reuse_uri = reuse_bunker.to_string();
|
||||
|
||||
if let Some(secret) = reuse_bunker.secret() {
|
||||
let replace = format!("&secret={}", secret);
|
||||
reuse_uri = reuse_uri.replace(replace.as_str(), "");
|
||||
}
|
||||
|
||||
let account = Account {
|
||||
secret_key: app_secret,
|
||||
nostr_connect: Some(bunker_uri.to_string()),
|
||||
nostr_connect: Some(reuse_uri),
|
||||
};
|
||||
|
||||
// Save secret key to keyring
|
||||
@@ -217,7 +238,9 @@ pub async fn set_signer(
|
||||
let app_keys = Keys::from_str(&account.secret_key).map_err(|e| e.to_string())?;
|
||||
|
||||
match NostrConnect::new(uri, app_keys, Duration::from_secs(120), None) {
|
||||
Ok(signer) => {
|
||||
Ok(mut signer) => {
|
||||
// Handle auth url
|
||||
signer.auth_url_handler(AuthHandler);
|
||||
// Update signer
|
||||
client.set_signer(signer).await;
|
||||
// Emit to front-end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "Lume",
|
||||
"version": "24.11.5",
|
||||
"version": "24.11.6",
|
||||
"identifier": "nu.lume.Lume",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
@@ -73,7 +73,7 @@ function Newsfeeds() {
|
||||
: item.tags.find((tag) => tag[0] === "title")?.[1] || "Unnamed";
|
||||
const label =
|
||||
item.kind === 3
|
||||
? `newsfeed-${id.slice(0, 5)}`
|
||||
? `newsfeed-${item.pubkey.slice(0, 5)}`
|
||||
: item.tags.find((tag) => tag[0] === "d")?.[1] || nanoid();
|
||||
|
||||
return (
|
||||
|
||||
@@ -120,19 +120,19 @@ function Screen() {
|
||||
>
|
||||
<Tabs.List className="h-11 shrink-0 flex items-center">
|
||||
<Tabs.Trigger
|
||||
className="flex-1 inline-flex h-11 items-center justify-center gap-2 px-3 text-sm font-medium border-b border-neutral-100 dark:border-neutral-900 data-[state=active]:border-neutral-200 dark:data-[state=active]:border-neutral-800 data-[state=inactive]:opacity-50"
|
||||
className="flex-1 inline-flex h-11 items-center justify-center gap-2 px-3 text-sm font-medium border-b border-neutral-100 dark:border-neutral-700 data-[state=active]:border-neutral-200 dark:data-[state=active]:border-neutral-600 data-[state=inactive]:opacity-50"
|
||||
value="replies"
|
||||
>
|
||||
Replies
|
||||
</Tabs.Trigger>
|
||||
<Tabs.Trigger
|
||||
className="flex-1 inline-flex h-11 items-center justify-center gap-2 px-3 text-sm font-medium border-b border-neutral-100 dark:border-neutral-900 data-[state=active]:border-neutral-200 dark:data-[state=active]:border-neutral-800 data-[state=inactive]:opacity-50"
|
||||
className="flex-1 inline-flex h-11 items-center justify-center gap-2 px-3 text-sm font-medium border-b border-neutral-100 dark:border-neutral-700 data-[state=active]:border-neutral-200 dark:data-[state=active]:border-neutral-600 data-[state=inactive]:opacity-50"
|
||||
value="reactions"
|
||||
>
|
||||
Reactions
|
||||
</Tabs.Trigger>
|
||||
<Tabs.Trigger
|
||||
className="flex-1 inline-flex h-11 items-center justify-center gap-2 px-3 text-sm font-medium border-b border-neutral-100 dark:border-neutral-900 data-[state=active]:border-neutral-200 dark:data-[state=active]:border-neutral-800 data-[state=inactive]:opacity-50"
|
||||
className="flex-1 inline-flex h-11 items-center justify-center gap-2 px-3 text-sm font-medium border-b border-neutral-100 dark:border-neutral-700 data-[state=active]:border-neutral-200 dark:data-[state=active]:border-neutral-600 data-[state=inactive]:opacity-50"
|
||||
value="zaps"
|
||||
>
|
||||
Zaps
|
||||
|
||||
Reference in New Issue
Block a user