Version checks, drop native drag plugin, cloud menus and delete, about links
This commit is contained in:
Generated
+15
-185
@@ -722,19 +722,6 @@ version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"core-foundation",
|
||||
"core-graphics-types",
|
||||
"foreign-types 0.5.0",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.25.0"
|
||||
@@ -1087,28 +1074,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "drag"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e90b4a25ace5ce0561534b073943594cbcd21af936e64d09aec444568411f8c"
|
||||
dependencies = [
|
||||
"core-graphics 0.24.0",
|
||||
"dunce",
|
||||
"gdk",
|
||||
"gdkx11",
|
||||
"gtk",
|
||||
"log",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
"raw-window-handle",
|
||||
"serde",
|
||||
"thiserror 2.0.18",
|
||||
"windows 0.52.0",
|
||||
"windows-core 0.58.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "1.0.11"
|
||||
@@ -3079,17 +3044,9 @@ checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"block2",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-cloud-kit",
|
||||
"objc2-core-data",
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-graphics",
|
||||
"objc2-core-image",
|
||||
"objc2-core-text",
|
||||
"objc2-core-video",
|
||||
"objc2-foundation",
|
||||
"objc2-quartz-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3109,7 +3066,6 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
@@ -3170,19 +3126,6 @@ dependencies = [
|
||||
"objc2-core-graphics",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-video"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-graphics",
|
||||
"objc2-io-surface",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-encode"
|
||||
version = "4.1.0"
|
||||
@@ -4840,7 +4783,7 @@ dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"block2",
|
||||
"core-foundation",
|
||||
"core-graphics 0.25.0",
|
||||
"core-graphics",
|
||||
"crossbeam-channel",
|
||||
"dbus",
|
||||
"dispatch2",
|
||||
@@ -4865,7 +4808,7 @@ dependencies = [
|
||||
"tao-macros",
|
||||
"unicode-segmentation",
|
||||
"url",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
"windows-core 0.61.2",
|
||||
"windows-version",
|
||||
"x11-dl",
|
||||
@@ -4947,7 +4890,7 @@ dependencies = [
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"window-vibrancy",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5046,21 +4989,6 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-drag"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "729ca0ce4b1169869d3405216d3c09a524f41ea5e2eec89f917cd6623f8a70ca"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"drag",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.5.1"
|
||||
@@ -5103,7 +5031,7 @@ dependencies = [
|
||||
"tauri-plugin",
|
||||
"thiserror 2.0.18",
|
||||
"url",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
@@ -5129,7 +5057,7 @@ dependencies = [
|
||||
"url",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5154,7 +5082,7 @@ dependencies = [
|
||||
"url",
|
||||
"webkit2gtk",
|
||||
"webview2-com",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
"wry",
|
||||
]
|
||||
|
||||
@@ -5688,7 +5616,6 @@ dependencies = [
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-dialog",
|
||||
"tauri-plugin-drag",
|
||||
"tauri-plugin-opener",
|
||||
"typst",
|
||||
"typst-assets",
|
||||
@@ -6606,10 +6533,10 @@ checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a"
|
||||
dependencies = [
|
||||
"webview2-com-macros",
|
||||
"webview2-com-sys",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
"windows-core 0.61.2",
|
||||
"windows-implement 0.60.2",
|
||||
"windows-interface 0.59.3",
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6630,7 +6557,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c"
|
||||
dependencies = [
|
||||
"thiserror 2.0.18",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
"windows-core 0.61.2",
|
||||
]
|
||||
|
||||
@@ -6686,18 +6613,6 @@ dependencies = [
|
||||
"windows-version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
||||
dependencies = [
|
||||
"windows-core 0.52.0",
|
||||
"windows-implement 0.52.0",
|
||||
"windows-interface 0.52.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.61.3"
|
||||
@@ -6720,36 +6635,14 @@ dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.58.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
|
||||
dependencies = [
|
||||
"windows-implement 0.58.0",
|
||||
"windows-interface 0.58.0",
|
||||
"windows-result 0.2.0",
|
||||
"windows-strings 0.1.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
|
||||
dependencies = [
|
||||
"windows-implement 0.60.2",
|
||||
"windows-interface 0.59.3",
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link 0.1.3",
|
||||
"windows-result 0.3.4",
|
||||
"windows-strings 0.4.2",
|
||||
@@ -6761,8 +6654,8 @@ version = "0.62.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
||||
dependencies = [
|
||||
"windows-implement 0.60.2",
|
||||
"windows-interface 0.59.3",
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link 0.2.1",
|
||||
"windows-result 0.4.1",
|
||||
"windows-strings 0.5.1",
|
||||
@@ -6779,28 +6672,6 @@ dependencies = [
|
||||
"windows-threading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.58.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.60.2"
|
||||
@@ -6812,28 +6683,6 @@ dependencies = [
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.58.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.3"
|
||||
@@ -6867,15 +6716,6 @@ dependencies = [
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.3.4"
|
||||
@@ -6894,16 +6734,6 @@ dependencies = [
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
||||
dependencies = [
|
||||
"windows-result 0.2.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.4.2"
|
||||
@@ -7274,7 +7104,7 @@ dependencies = [
|
||||
"webkit2gtk",
|
||||
"webkit2gtk-sys",
|
||||
"webview2-com",
|
||||
"windows 0.61.3",
|
||||
"windows",
|
||||
"windows-core 0.61.2",
|
||||
"windows-version",
|
||||
"x11-dl",
|
||||
|
||||
@@ -22,7 +22,6 @@ tauri-build = { version = "2", features = [] }
|
||||
tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
tauri-plugin-dialog = "2"
|
||||
tauri-plugin-drag = "2.1.1"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
rusqlite = { version = "0.32", features = ["bundled"] }
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
"opener:allow-reveal-item-in-dir",
|
||||
"dialog:default",
|
||||
"dialog:allow-open",
|
||||
"dialog:allow-save",
|
||||
"drag:default"
|
||||
"dialog:allow-save"
|
||||
]
|
||||
}
|
||||
|
||||
+46
-1
@@ -675,6 +675,12 @@ fn lsp_running(state: State<'_, LspState>) -> bool {
|
||||
state.is_running()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_check_compatibility(server_url: String) -> sync::CompatibilityStatus {
|
||||
let server_url = server_url.trim_end_matches('/').to_string();
|
||||
sync::check_compatibility(&server_url)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_login(
|
||||
app: AppHandle,
|
||||
@@ -781,6 +787,30 @@ fn cloud_download_file(
|
||||
Ok(file.name)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_delete_file(app: AppHandle, store: State<'_, Store>, file_id: String) -> Result<(), String> {
|
||||
let (server_url, token) = cloud_credentials(&app, &store)?;
|
||||
sync::delete_account_file(&server_url, &token, &file_id)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_delete_document(
|
||||
app: AppHandle,
|
||||
store: State<'_, Store>,
|
||||
document_id: String,
|
||||
) -> Result<(), String> {
|
||||
let (server_url, token) = cloud_credentials(&app, &store)?;
|
||||
sync::delete_document(&server_url, &token, &document_id)?;
|
||||
|
||||
if let Ok(links) = store.all_document_links() {
|
||||
if let Some((path, _, _)) = links.into_iter().find(|(_, id, _)| id == &document_id) {
|
||||
let _ = store.forget_document_link(&path);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_list_shared(
|
||||
app: AppHandle,
|
||||
@@ -970,6 +1000,18 @@ fn cloud_create_project(app: AppHandle, store: State<'_, Store>, name: String) -
|
||||
sync::create_cloud_project(&server_url, &token, name.trim())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_new_document(app: AppHandle, store: State<'_, Store>, title: String) -> Result<sync::DocumentContent, String> {
|
||||
let title = title.trim();
|
||||
if title.is_empty() {
|
||||
return Err("Document name cannot be empty".to_string());
|
||||
}
|
||||
|
||||
let (server_url, token) = cloud_credentials(&app, &store)?;
|
||||
let content = format!("= {}\n\nStart writing here.\n", title);
|
||||
sync::create_document(&server_url, &token, title, &content)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn cloud_delete_project(app: AppHandle, store: State<'_, Store>, cloud_project_id: String) -> Result<(), String> {
|
||||
let (server_url, token) = cloud_credentials(&app, &store)?;
|
||||
@@ -1101,7 +1143,6 @@ pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_drag::init())
|
||||
.setup(|app| {
|
||||
let store = Store::open(&app.handle())?;
|
||||
app.manage(store);
|
||||
@@ -1149,6 +1190,7 @@ pub fn run() {
|
||||
lsp_send,
|
||||
lsp_stop,
|
||||
lsp_running,
|
||||
cloud_check_compatibility,
|
||||
cloud_login,
|
||||
cloud_logout,
|
||||
cloud_account,
|
||||
@@ -1158,7 +1200,9 @@ pub fn run() {
|
||||
cloud_list_shared,
|
||||
cloud_list_files,
|
||||
cloud_download_file,
|
||||
cloud_delete_file,
|
||||
cloud_download_document,
|
||||
cloud_delete_document,
|
||||
cloud_sync_document,
|
||||
cloud_resolve_document,
|
||||
cloud_document_link,
|
||||
@@ -1167,6 +1211,7 @@ pub fn run() {
|
||||
cloud_unlink_document,
|
||||
cloud_create_document,
|
||||
cloud_create_project,
|
||||
cloud_new_document,
|
||||
cloud_delete_project,
|
||||
cloud_clone_project,
|
||||
cloud_link_project,
|
||||
|
||||
@@ -34,6 +34,88 @@ fn describe(error: ureq::Error) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
pub const MIN_SERVER_VERSION: &str = "1.5.0";
|
||||
|
||||
fn parse_version(version: &str) -> (u32, u32, u32) {
|
||||
let mut parts = version.trim().split('.').map(|part| part.parse::<u32>().unwrap_or(0));
|
||||
(
|
||||
parts.next().unwrap_or(0),
|
||||
parts.next().unwrap_or(0),
|
||||
parts.next().unwrap_or(0),
|
||||
)
|
||||
}
|
||||
|
||||
fn version_at_least(actual: &str, required: &str) -> bool {
|
||||
parse_version(actual) >= parse_version(required)
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ServerVersionInfo {
|
||||
server_version: String,
|
||||
min_desktop_version: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct CompatibilityStatus {
|
||||
pub compatible: bool,
|
||||
pub server_version: String,
|
||||
pub desktop_version: String,
|
||||
pub min_server_version: String,
|
||||
pub min_desktop_version: String,
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
pub fn check_compatibility(server_url: &str) -> CompatibilityStatus {
|
||||
let desktop_version = env!("CARGO_PKG_VERSION").to_string();
|
||||
|
||||
let info = agent()
|
||||
.get(&endpoint(server_url, "/version"))
|
||||
.call()
|
||||
.map_err(describe)
|
||||
.and_then(|response| response.into_json::<ServerVersionInfo>().map_err(|e| e.to_string()));
|
||||
|
||||
match info {
|
||||
Ok(info) => {
|
||||
let server_too_old = !version_at_least(&info.server_version, MIN_SERVER_VERSION);
|
||||
let desktop_too_old = !version_at_least(&desktop_version, &info.min_desktop_version);
|
||||
|
||||
let message = if server_too_old {
|
||||
Some(format!(
|
||||
"This app requires a TypstDrive server v{} or newer (server is running v{}). Ask the administrator to update it.",
|
||||
MIN_SERVER_VERSION, info.server_version
|
||||
))
|
||||
} else if desktop_too_old {
|
||||
Some(format!(
|
||||
"This TypstDrive server requires typst-desktop v{} or newer (you have v{}). Please update the app.",
|
||||
info.min_desktop_version, desktop_version
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
CompatibilityStatus {
|
||||
compatible: !server_too_old && !desktop_too_old,
|
||||
server_version: info.server_version,
|
||||
desktop_version,
|
||||
min_server_version: MIN_SERVER_VERSION.to_string(),
|
||||
min_desktop_version: info.min_desktop_version,
|
||||
message,
|
||||
}
|
||||
}
|
||||
Err(_) => CompatibilityStatus {
|
||||
compatible: false,
|
||||
server_version: "unknown".to_string(),
|
||||
desktop_version,
|
||||
min_server_version: MIN_SERVER_VERSION.to_string(),
|
||||
min_desktop_version: "unknown".to_string(),
|
||||
message: Some(format!(
|
||||
"Could not determine the server's version. It may be unreachable, or older than v{} which doesn't support version checks. Please update the server.",
|
||||
MIN_SERVER_VERSION
|
||||
)),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
pub struct Account {
|
||||
pub user_id: String,
|
||||
@@ -55,12 +137,20 @@ pub fn login(
|
||||
password: &str,
|
||||
device_name: &str,
|
||||
) -> Result<LoginResponse, String> {
|
||||
let status = check_compatibility(server_url);
|
||||
if !status.compatible {
|
||||
return Err(status
|
||||
.message
|
||||
.unwrap_or_else(|| "This server is not compatible with this app.".to_string()));
|
||||
}
|
||||
|
||||
agent()
|
||||
.post(&endpoint(server_url, "/auth/login"))
|
||||
.send_json(ureq::json!({
|
||||
"email": email,
|
||||
"password": password,
|
||||
"device_name": device_name,
|
||||
"client_version": env!("CARGO_PKG_VERSION"),
|
||||
}))
|
||||
.map_err(describe)?
|
||||
.into_json::<LoginResponse>()
|
||||
@@ -926,6 +1016,15 @@ pub fn push_document(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn delete_document(server_url: &str, token: &str, document_id: &str) -> Result<(), String> {
|
||||
agent()
|
||||
.delete(&endpoint(server_url, &format!("/documents/{}", document_id)))
|
||||
.set("Authorization", &format!("Bearer {}", token))
|
||||
.call()
|
||||
.map_err(describe)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
pub struct CloudFile {
|
||||
pub id: String,
|
||||
@@ -974,3 +1073,12 @@ pub fn pull_account_file(
|
||||
.into_json::<CloudFileContent>()
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
pub fn delete_account_file(server_url: &str, token: &str, file_id: &str) -> Result<(), String> {
|
||||
agent()
|
||||
.delete(&endpoint(server_url, &format!("/files/{}", file_id)))
|
||||
.set("Authorization", &format!("Bearer {}", token))
|
||||
.call()
|
||||
.map_err(describe)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"resources": ["icons/32x32.png"],
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": [
|
||||
|
||||
Reference in New Issue
Block a user