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

Commit

Permalink
Backend changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Aug 23, 2022
1 parent 7f4710b commit adc9498
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions core/src/encrypt_password.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use argon2::{
Argon2,
};

static mut storedPassword: String = String::new();
static mut STORED_PASSWORD: String = String::new();

#[tauri::command]
pub fn encrypt_password(password: String) -> String {
Expand Down Expand Up @@ -38,7 +38,7 @@ pub fn verify_password(password: String, hash: String) -> bool {

if result {
unsafe {
storedPassword = password;
STORED_PASSWORD = password;
}
}

Expand All @@ -48,6 +48,6 @@ pub fn verify_password(password: String, hash: String) -> bool {
#[tauri::command]
pub fn request_password() -> String {
unsafe {
storedPassword.as_str().into()
STORED_PASSWORD.as_str().into()
}
}
10 changes: 2 additions & 8 deletions core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
#![allow(dead_code, unused_imports, unused_variables)]

use tauri::*;
use window_vibrancy::{apply_mica, apply_vibrancy, NSVisualEffectMaterial};
Expand All @@ -10,7 +11,6 @@ mod auto_launch;
mod encrypt_password;
mod system_info;

// the payload type must implement `Serialize` and `Clone`.
#[derive(Clone, serde::Serialize)]
struct Payload {
message: String,
Expand Down Expand Up @@ -72,7 +72,7 @@ fn main() {

tauri::Builder::default()
.invoke_handler(tauri::generate_handler![
// auto_launch::auto_launch,
auto_launch::auto_launch,
system_info::system_info,
encrypt_password::encrypt_password,
encrypt_password::verify_password,
Expand Down Expand Up @@ -100,12 +100,6 @@ fn main() {
Ok(())
})
.on_window_event(|event| match event.event() {
tauri::WindowEvent::CloseRequested { api, .. } => {
api.prevent_close();

event.window().hide().unwrap();
}

tauri::WindowEvent::Focused(focused) => {
let app = event.window().app_handle();

Expand Down
14 changes: 13 additions & 1 deletion interface/layout/app.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import App from "./app.svelte"
import "../styles/index.css"
import { fs, path, os, event } from "@tauri-apps/api"
import { fs, path, os, event, window } from "@tauri-apps/api"
import { getSettings } from "../stores/settings"
import { navigate } from "../libraries/navigate"

const settings = getSettings()

const getSettingsPath = async () => {
const folderPath = await path.join(await path.configDir(), "Levminer", "Authme 4")
fs.createDir(folderPath, { recursive: true })
Expand Down Expand Up @@ -45,6 +48,15 @@ event.listen("focusSearch", () => {
}
})

// Listen for close request
window.appWindow.onCloseRequested((event) => {
if (settings.settings.minimizeToTray === true) {
event.preventDefault()

window.appWindow.hide()
}
})

// Create svelte app
const app = new App({
target: document.body,
Expand Down

0 comments on commit adc9498

Please sign in to comment.