Should be ready for release now. Will do some testing before.

This commit is contained in:
Lncvrt committed 2026-04-03 10:51:23 -07:00
1 parent da27bcb32c
commit d91314112d
3 files changed
+53 -54

No files matched your search

+32 -13
View File
@@ -19,7 +19,6 @@ use tauri::window::{ProgressBarState, ProgressBarStatus};
use tauri::{AppHandle, Emitter, Manager};
use tauri_plugin_os::platform;
use tauri_plugin_prevent_default::Flags;
use tauri_plugin_updater::UpdaterExt;
use tokio::io::AsyncReadExt;
use tokio::{io::AsyncWriteExt, time::timeout};
use zip::ZipArchive;
@@ -31,6 +30,9 @@ use sysinfo::System;
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
#[cfg(not(debug_assertions))]
use tauri_plugin_updater::UpdaterExt;
static CANCEL_MAP: OnceLock<DashMap<String, bool>> = OnceLock::new();
fn cancel_map() -> &'static DashMap<String, bool> {
@@ -561,35 +563,52 @@ pub fn run() {
cancel_download
])
.setup(|app| {
let window = app.get_webview_window("main").unwrap();
#[cfg(target_os = "windows")]
{
use tauri_plugin_decorum::WebviewWindowExt;
if let Some(main_window) = app.get_webview_window("main") {
if let Err(e) = main_window.create_overlay_titlebar() {
eprintln!("Failed to create overlay titlebar: {:?}", e);
}
if let Err(e) = window.create_overlay_titlebar() {
eprintln!("Failed to create overlay titlebar: {:?}", e);
}
}
let handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
update(handle).await.unwrap();
});
#[cfg(not(debug_assertions))]
{
let handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
update(handle, window.clone()).await.unwrap();
});
}
#[cfg(debug_assertions)]
{
let mut new_url = window.url().unwrap();
new_url.set_path("/main");
window.navigate(new_url).unwrap();
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
async fn update(app: tauri::AppHandle) -> tauri_plugin_updater::Result<()> {
let window = app.get_webview_window("main").unwrap();
#[cfg(not(debug_assertions))]
async fn update(
app: tauri::AppHandle,
window: tauri::WebviewWindow,
) -> tauri_plugin_updater::Result<()> {
let target = {
#[cfg(target_os = "linux")]
{
if std::path::Path::new("/etc/debian_version").exists() {
"linux-debian"
} else {
} else if std::path::Path::new("/etc/redhat-release").exists() {
"linux-fedora"
} else {
let mut new_url = window.url().unwrap();
new_url.set_path("/update/outdated");
window.navigate(new_url).unwrap();
return Ok(());
}
}
#[cfg(not(target_os = "linux"))]
+1 -41
View File
@@ -5,7 +5,6 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import Sidebar from '@/components/Sidebar'
import { DownloadProgress } from '@/types/DownloadProgress'
import { app } from '@tauri-apps/api'
import { openUrl } from '@tauri-apps/plugin-opener'
import { GlobalProvider } from '@/providers/GlobalProvider'
import { Roboto } from 'next/font/google'
import { ServerVersionsResponse } from '@/types/ServerVersionsResponse'
@@ -51,7 +50,6 @@ export default function RootLayout ({
}) {
const [loading, setLoading] = useState(true)
const [loadingText, setLoadingText] = useState('Loading...')
const [outdated, setOutdated] = useState(false)
const [version, setVersion] = useState<string | null>(null)
const [platformName, setPlatformName] = useState<string | null>(null)
@@ -266,27 +264,6 @@ export default function RootLayout ({
setPlatformName(platform())
const client = await app.getVersion()
setVersion(client)
if (process.env.NODE_ENV === 'production') {
try {
const response = await fetch(
'https://games.lncvrt.xyz/api/launcher/latest'
)
const signature = response.headers.get('x-signature') ?? ''
const data = await response.text()
if (await verifySignature(data, signature)) {
if (data !== client) {
setOutdated(true)
return
}
} else {
setLoadingText('Failed to check latest version.')
return
}
} catch {
setLoadingText('Failed to check latest version.')
return
}
}
try {
const response = await fetch(
`https://games.lncvrt.xyz/api/launcher/versions?platform=${platform()}&arch=${arch()}`
@@ -712,24 +689,7 @@ export default function RootLayout ({
: 'h-screen'
} flex items-center justify-center`}
>
{outdated ? (
<div className='text-center'>
<p className='text-6xl mb-4'>Outdated Launcher!</p>
<p className='text-2xl mb-4'>
Please update to the latest version to continue.
</p>
<button
className='button btntheme1'
onClick={() =>
openUrl('https://games.lncvrt.xyz/download')
}
>
Download latest version!
</button>
</div>
) : (
<p className='text-7xl text-center'>{loadingText}</p>
)}
<p className='text-7xl text-center'>{loadingText}</p>
</div>
</>
) : (
+20
View File
@@ -0,0 +1,20 @@
'use client'
import { openUrl } from '@tauri-apps/plugin-opener'
export default function UpdateCheckingPage () {
return (
<div className='text-center'>
<p className='text-6xl mb-4'>Outdated Launcher!</p>
<p className='text-2xl mb-4'>
Please update to the latest version to continue.
</p>
<button
className='button btntheme1'
onClick={() => openUrl('https://games.lncvrt.xyz/download')}
>
Download latest version!
</button>
</div>
)
}