39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
//! Helpers for the signed Tauri updater UI.
|
||
|
||
pub const DOWNLOAD_PAGE: &str = "https://ttmadethat.shop/ld-fdpi";
|
||
|
||
#[cfg(windows)]
|
||
pub fn open_download_page() -> Result<(), String> {
|
||
use std::ffi::OsStr;
|
||
use std::os::windows::ffi::OsStrExt;
|
||
use windows_sys::Win32::UI::Shell::ShellExecuteW;
|
||
use windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOWNORMAL;
|
||
|
||
let url: Vec<u16> = OsStr::new(DOWNLOAD_PAGE)
|
||
.encode_wide()
|
||
.chain(std::iter::once(0))
|
||
.collect();
|
||
let operation: Vec<u16> = OsStr::new("open")
|
||
.encode_wide()
|
||
.chain(std::iter::once(0))
|
||
.collect();
|
||
let result = unsafe {
|
||
ShellExecuteW(
|
||
std::ptr::null_mut(),
|
||
operation.as_ptr(),
|
||
url.as_ptr(),
|
||
std::ptr::null(),
|
||
std::ptr::null(),
|
||
SW_SHOWNORMAL,
|
||
)
|
||
};
|
||
if result as isize <= 32 {
|
||
return Err("İndirme sayfası açılamadı.".to_string());
|
||
}
|
||
Ok(())
|
||
}
|
||
|
||
#[cfg(not(windows))]
|
||
pub fn open_download_page() -> Result<(), String> {
|
||
Err("Bu platformda desteklenmiyor.".to_string())
|
||
}
|