CH-J Toolsġestjoni tas-server fuq SSH
Menu
Sors ippubblikat

CH-J Tools

direttorji browse u fajls għal rilaxx applikazzjoni speċifika.

Sors ta' tniżżil ZIP
CH-J / Server Manager 1704 fajls
0.1.2-beta Miżjud: · Buillt:
modules.rs Miżjud: Data mhux irreġistrata 4.4 KB · 102 linji
Kodiċi Fajl tat-tniżżil
1//! Module manager commands for the main window (formerly `plugins:*`).
3use super::{logged, main_core, text, CommandResult};
4use crate::core::app::CoreSlot;
5use serde_json::Value;
6use tauri::{State, Webview};
8#[tauri::command]
9pub async fn core_modules_list(webview: Webview, slot: State<'_, CoreSlot>) -> CommandResult {
10 let core = main_core(&webview, &slot)?;
11 logged(&core, "plugins:list", core.services.modules.registry.list_installed().map(Value::Array))
14#[tauri::command]
15pub async fn core_modules_get_state(webview: Webview, slot: State<'_, CoreSlot>) -> CommandResult {
16 let core = main_core(&webview, &slot)?;
17 logged(&core, "plugins:getState", core.services.modules.get_state())
20#[tauri::command]
21pub async fn core_modules_check_catalog(webview: Webview, slot: State<'_, CoreSlot>) -> CommandResult {
22 let core = main_core(&webview, &slot)?;
23 let result = core.services.modules.check_catalog(&core).await;
24 logged(&core, "plugins:checkCatalog", result)
27#[tauri::command]
28pub async fn core_modules_install(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
29 let core = main_core(&webview, &slot)?;
30 let payload = super::payload(payload);
31 let result = async {
32 core.services.biometrics.require_sensitive_action().await?;
33 core.services.modules.install(&core, text(&payload, "releaseId")).await
34 }
35 .await;
36 logged(&core, "plugins:install", result)
39#[tauri::command]
40pub async fn core_modules_uninstall(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
41 let core = main_core(&webview, &slot)?;
42 let payload = super::payload(payload);
43 let result = async {
44 core.services.biometrics.require_sensitive_action().await?;
45 core.services.modules.uninstall(&core, text(&payload, "pluginId")).await
46 }
47 .await;
48 logged(&core, "plugins:uninstall", result)
51#[tauri::command]
52pub async fn core_modules_open(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
53 let core = main_core(&webview, &slot)?;
54 let payload = super::payload(payload);
55 logged(&core, "plugins:open", core.services.modules.open(&core, text(&payload, "pluginId")))
58/// The main page reports where the module area is; `null` hides embedded modules while another view is open.
59#[tauri::command]
60pub async fn core_modules_set_area(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
61 let core = main_core(&webview, &slot)?;
62 let payload = super::payload(payload);
63 let number = |key: &str| payload.get(key).and_then(Value::as_f64).filter(|value| value.is_finite());
64 let area = match (number("x"), number("y"), number("width"), number("height")) {
65 (Some(x), Some(y), Some(width), Some(height)) if width >= 1.0 && height >= 1.0 => {
66 let top = crate::windows::page_top(&core.app, number("pageHeight").unwrap_or(0.0));
67 Some(crate::core::modules::service::Area { x, y: y + top, width, height })
68 }
69 _ => None,
70 };
71 core.services.modules.set_area(&core, area);
72 Ok(Value::Null)
75/// The module bar of the main window: moves the shown module to its own window.
76#[tauri::command]
77pub async fn core_modules_detach(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
78 let core = main_core(&webview, &slot)?;
79 let payload = super::payload(payload);
80 let result = core.services.modules.label_of(text(&payload, "pluginId")).and_then(|label| core.services.modules.detach(&core, &label));
81 logged(&core, "plugins:detach", result)
84#[tauri::command]
85pub async fn core_modules_collapse(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
86 let core = main_core(&webview, &slot)?;
87 let payload = super::payload(payload);
88 let result = core.services.modules.label_of(text(&payload, "pluginId")).map(|label| {
89 core.services.modules.minimize_label(&core, &label, false);
90 Value::Null
91 });
92 logged(&core, "plugins:collapse", result)
95/// Closing asks about unsaved changes first, like closing a module window.
96#[tauri::command]
97pub async fn core_modules_close(webview: Webview, slot: State<'_, CoreSlot>, payload: Option<Value>) -> CommandResult {
98 let core = main_core(&webview, &slot)?;
99 let payload = super::payload(payload);
100 core.services.modules.close(&core, text(&payload, "pluginId"));
101 Ok(Value::Null)
SHA-256ae4357f6dc2fca9b150e414d200fa2d8f7c55cb8292baba3700f80be071afe9d

CH-J Proprietary Software License 1.14 · Sors huwa pprovdut taħt iż-CH-J Proprietary Software License 1.14. Id-disponibbiltà tagħha ma tibdilx it-termini tal-liċenzja jew tagħti drittijiet addizzjonali.

Archive SHA-256ac8fe790f4ba60fc098f8c985fc2656cfcc6cdc21fb34b30e308a2b54e62258f
Fajls