Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: add TelegramPluginState struct for managing session and downloads

Tonho68d82912c661
diff --git a/src-tauri/omniget-plugin-telegram/src/state.rs b/src-tauri/omniget-plugin-telegram/src/state.rs
new file mode 100644
index 00000000..8306d527
--- /dev/null
+++ b/src-tauri/omniget-plugin-telegram/src/state.rs
@@ -0,0 +1,19 @@
+use std::collections::HashMap;
+use std::sync::Arc;
+use tokio_util::sync::CancellationToken;
+
+use crate::platforms::telegram::auth::{TelegramSessionHandle, TelegramState};
+
+pub struct TelegramPluginState {
+ pub telegram_session: TelegramSessionHandle,
+ pub active_generic_downloads: Arc<tokio::sync::Mutex<HashMap<u64, (String, CancellationToken)>>>,
+}
+
+impl Default for TelegramPluginState {
+ fn default() -> Self {
+ Self {
+ telegram_session: Arc::new(tokio::sync::Mutex::new(TelegramState::new())),
+ active_generic_downloads: Arc::new(tokio::sync::Mutex::new(HashMap::new())),
+ }
+ }
+}