new hashtag filter option
All checks were successful
Android Build Final Fixed / build-android (push) Successful in 7m46s

This commit is contained in:
2026-01-31 13:06:47 +01:00
parent e355c1014b
commit 1e1614b96d
4 changed files with 186 additions and 31 deletions

Submodule src-tauri/easy-nostr updated: 7cebc490ca...1becf76264

View File

@@ -11,9 +11,9 @@ pub struct LocalPost {
}
#[tauri::command]
pub async fn fetch_nostr_posts() -> Result<Vec<LocalPost>, String> {
pub async fn fetch_nostr_posts(hashtags: Vec<String>) -> Result<Vec<LocalPost>, String> {
println!("Fetching Nostr posts for hashtags: {:?}", hashtags);
// 1. Temporären Einweg-Schlüssel generieren
// Das erzeugt ein Schlüsselpaar im RAM, das nach dem Funktionsaufruf verschwindet.
let random_keys = Keys::generate();
let temp_nsec = random_keys
.secret_key()
@@ -34,8 +34,14 @@ pub async fn fetch_nostr_posts() -> Result<Vec<LocalPost>, String> {
.await
.map_err(|e| e.to_string())?;
// 4. Posts von der Library holen
let raw_posts = easy.get_random_posts().await.map_err(|e| e.to_string())?;
// 4. Posts von der Library holen - Entweder per Hashtag oder Random
let raw_posts = if hashtags.is_empty() {
easy.get_random_posts().await.map_err(|e| e.to_string())?
} else {
easy.get_posts_by_hashtags(hashtags)
.await
.map_err(|e| e.to_string())?
};
// 5. Mappen: Library-Typ -> Unser serialisierbarer Typ
let mapped_posts = raw_posts