update library version and fix args
This commit is contained in:
parent
ebad72d440
commit
f332bca033
2
library
2
library
@ -1 +1 @@
|
|||||||
Subproject commit 979c717cc0ecc3f9a0c26ce868dafc2b20c3328c
|
Subproject commit 96cb053e659123afc394187229949e7f32c23372
|
@ -5,23 +5,26 @@
|
|||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use tauri::State;
|
use tauri::State;
|
||||||
|
use tokio::runtime::Runtime;
|
||||||
|
|
||||||
extern crate ip_lib;
|
extern crate ip_lib;
|
||||||
extern crate rand;
|
|
||||||
extern crate open;
|
extern crate open;
|
||||||
|
extern crate rand;
|
||||||
|
|
||||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn get_version() -> String {
|
fn get_version() -> String {
|
||||||
option_env!("CARGO_PKG_VERSION").unwrap_or("x.x.x").to_string()
|
option_env!("CARGO_PKG_VERSION")
|
||||||
|
.unwrap_or("x.x.x")
|
||||||
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn create_entry(name: String, username: String, pw: &str, mpw: String) -> bool {
|
fn create_entry(name: &str, username: String, pw: &str, mpw: &str) -> bool {
|
||||||
let return_value = ip_lib::create_entry(&name, username+";"+pw, mpw);
|
let username_and_pw = username + ";" + pw;
|
||||||
|
let return_value = ip_lib::create_entry(name, &username_and_pw, mpw);
|
||||||
if return_value {
|
if return_value {
|
||||||
isync_save();
|
isync_save();
|
||||||
}
|
}
|
||||||
@ -34,11 +37,14 @@ fn random_password() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn get_entry(name: String, mpw: String) -> Result<(String,String),String> {
|
fn get_entry(name: &str, mpw: &str) -> Result<(String, String), String> {
|
||||||
let binding = ip_lib::get_entry(&name, mpw);
|
let binding = ip_lib::get_entry(name, mpw);
|
||||||
if let Ok(data) = binding {
|
if let Ok(data) = binding {
|
||||||
let mut split = data.split(';');
|
let mut split = data.split(';');
|
||||||
Ok((split.next().unwrap().to_string(),split.next().unwrap().to_string()))
|
Ok((
|
||||||
|
split.next().unwrap().to_string(),
|
||||||
|
split.next().unwrap().to_string(),
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
Err(binding.expect_err("expected error"))
|
Err(binding.expect_err("expected error"))
|
||||||
}
|
}
|
||||||
@ -121,10 +127,18 @@ fn main() {
|
|||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
get_version,create_entry,random_password,
|
get_version,
|
||||||
get_entry,get_entries,remove_entry,
|
create_entry,
|
||||||
open_authorize,store_token,get_isync_status,
|
random_password,
|
||||||
sync_isync,remove_token])
|
get_entry,
|
||||||
|
get_entries,
|
||||||
|
remove_entry,
|
||||||
|
open_authorize,
|
||||||
|
store_token,
|
||||||
|
get_isync_status,
|
||||||
|
sync_isync,
|
||||||
|
remove_token
|
||||||
|
])
|
||||||
.manage(rt)
|
.manage(rt)
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user