Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Rust commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jul 22, 2022
1 parent cc04e55 commit 2a69794
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules
dist
dist-ssr
*.local
build.json

# Editor directories and files
.vscode/*
Expand Down
192 changes: 192 additions & 0 deletions core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ tauri-build = { version = "1.0.3", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.3", features = ["api-all"] }
tauri = { version = "1.0.3", features = ["api-all", "system-tray"] }
window-vibrancy = "0.1.3"
auto-launch = { git = "https://github.com/zzzgydi/auto-launch", branch = "main" }
sysinfo = "0.20.2"
argon2 = "0.4"
rand_core = { version = "0.6", features = ["std"] }

[features]
# by default Tauri runs in production mode
Expand All @@ -27,3 +31,9 @@ default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]

[profile.release]
panic = "abort" # Strip expensive panic clean-up logic
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
lto = true # Enables link to optimizations
opt-level = "s" # Optimize for binary size
21 changes: 21 additions & 0 deletions core/src/auto_launch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use auto_launch::*;
use std::env;

#[tauri::command]
pub fn auto_launch() {
let exe = env::current_exe().unwrap();
let exe_string = exe.to_str().unwrap();

let app_name = "Authme v4";
let app_path = exe_string;
let args = &["--minimized"];
let auto = AutoLaunch::new(app_name, app_path, args);

let enabled = auto.is_enabled().unwrap();

if enabled == false {
auto.enable().unwrap();
} else {
auto.disable().unwrap();
}
}
Loading

0 comments on commit 2a69794

Please sign in to comment.