mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-18 18:51:16 +10:00
client now fetches user information from Drop server
This commit is contained in:
@ -4,7 +4,9 @@ use std::{
|
||||
};
|
||||
|
||||
use log::{info, warn};
|
||||
use openssl::x509::store::HashDir;
|
||||
use serde::Deserialize;
|
||||
use tauri::async_runtime::handle;
|
||||
use url::Url;
|
||||
|
||||
use crate::{AppState, AppStatus, DB};
|
||||
@ -59,3 +61,26 @@ pub async fn use_remote<'a>(
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn open_url(path: String) -> Result<(), String> {
|
||||
webbrowser::open(&path).unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn gen_drop_url(app: tauri::AppHandle, path: String) -> Result<String, String> {
|
||||
let base_url = {
|
||||
let handle = DB.borrow_data().unwrap();
|
||||
|
||||
if handle.base_url.is_empty() {
|
||||
return Ok("".to_string());
|
||||
};
|
||||
|
||||
Url::parse(&handle.base_url).unwrap()
|
||||
};
|
||||
|
||||
let url = base_url.join(&path).unwrap();
|
||||
|
||||
return Ok(url.to_string());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user