chore: refactor the global state and improve signer (#56)

* refactor

* update

* .

* rustfmt

* .

* .

* .

* .

* .

* add document

* .

* add logout

* handle error

* chore: update gpui

* adjust timeout
This commit is contained in:
reya
2025-06-07 14:52:21 +07:00
committed by GitHub
parent 50beaebd2c
commit e687204361
73 changed files with 1871 additions and 1504 deletions

View File

@@ -1,18 +1,15 @@
use std::{
env::{self, consts::OS},
ffi::OsString,
path::PathBuf,
};
use std::env::consts::OS;
use std::env::{self};
use std::ffi::OsString;
use std::path::PathBuf;
use anyhow::{anyhow, Context as _, Error};
use global::get_client;
use global::shared_state;
use gpui::{App, AppContext, Context, Entity, Global, SemanticVersion, Task};
use nostr_sdk::prelude::*;
use smol::{
fs::{self, File},
io::AsyncWriteExt,
process::Command,
};
use smol::fs::{self, File};
use smol::io::AsyncWriteExt;
use smol::process::Command;
use tempfile::TempDir;
struct GlobalAutoUpdate(Entity<AutoUpdater>);
@@ -129,10 +126,9 @@ impl AutoUpdater {
self.set_status(AutoUpdateStatus::Downloading, cx);
let task: Task<Result<(TempDir, PathBuf), Error>> = cx.background_spawn(async move {
let client = get_client();
let ids = event.tags.event_ids().copied();
let filter = Filter::new().ids(ids).kind(Kind::FileMetadata);
let events = client.database().query(filter).await?;
let events = shared_state().client.database().query(filter).await?;
if let Some(event) = events.into_iter().find(|event| event.content == OS) {
let tag = event.tags.find(TagKind::Url).context("url not found")?;