mirror of
https://github.com/tonytins/amtkstat.git
synced 2025-07-20 04:44:49 -04:00
Imported code and assets from old Gallery web app
This commit is contained in:
parent
ebfe2d644c
commit
33dc7cf4a2
49 changed files with 22362 additions and 102 deletions
|
@ -1,15 +1,34 @@
|
|||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
use std::process::Command;
|
||||
use webbrowser;
|
||||
|
||||
#[tauri::command]
|
||||
fn ping_address(address: &str) -> bool {
|
||||
let ping = Command::new("ping")
|
||||
.arg("-i")
|
||||
.arg("1")
|
||||
.arg(address)
|
||||
.output()
|
||||
.expect("");
|
||||
|
||||
if ping.status.success() {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn open_browser(address: &str) {
|
||||
webbrowser::open(address).expect("Failed to open defualt browser.");
|
||||
if ping_address(address) {
|
||||
webbrowser::open(address).expect("Failed to open defualt browser.");
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![open_browser])
|
||||
.invoke_handler(tauri::generate_handler![open_browser, ping_address])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue