Remove updater
This commit is contained in:
10 files changed
+7
-167
No files matched your search
@@ -44,7 +44,6 @@ sysinfo = "0.38.4"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-single-instance = "2.4.1"
|
||||
tauri-plugin-updater = "2.10.1"
|
||||
tauri-plugin-window-state = "2.4.1"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
{
|
||||
"identifier": "desktop-capability",
|
||||
"platforms": [
|
||||
"macOS",
|
||||
"windows",
|
||||
"linux"
|
||||
],
|
||||
"windows": [
|
||||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
"window-state:default",
|
||||
"updater:default"
|
||||
]
|
||||
}
|
||||
"platforms": ["macOS", "windows", "linux"],
|
||||
"windows": ["main"],
|
||||
"permissions": ["window-state:default"]
|
||||
}
|
||||
@@ -32,9 +32,6 @@ use sysinfo::System;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
#[cfg(not(debug_assertions))]
|
||||
use tauri_plugin_updater::UpdaterExt;
|
||||
|
||||
struct AppState {
|
||||
custom_data_dir: RwLock<Option<PathBuf>>,
|
||||
}
|
||||
@@ -685,7 +682,6 @@ fn open_new_window(
|
||||
pub fn run() {
|
||||
#[allow(unused_variables)]
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.plugin(tauri_plugin_http::init())
|
||||
.plugin(
|
||||
@@ -762,83 +758,9 @@ pub fn run() {
|
||||
eprintln!("Failed to create overlay titlebar: {:?}", e);
|
||||
}
|
||||
}
|
||||
#[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 = app.config().build.dev_url.clone().unwrap();
|
||||
new_url.set_path("/main");
|
||||
window.navigate(new_url).unwrap();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
#[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 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"))]
|
||||
{
|
||||
tauri_plugin_updater::target().unwrap_or("unknown".to_string())
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(update) = app
|
||||
.updater_builder()
|
||||
.target(target)
|
||||
.build()?
|
||||
.check()
|
||||
.await?
|
||||
{
|
||||
let mut new_url = window.url().unwrap();
|
||||
new_url.set_path("/update/updating");
|
||||
window.navigate(new_url).unwrap();
|
||||
|
||||
let mut downloaded = 0;
|
||||
|
||||
update
|
||||
.download_and_install(
|
||||
|chunk_length, content_length| {
|
||||
downloaded += chunk_length;
|
||||
println!("downloaded {downloaded} from {content_length:?}");
|
||||
},
|
||||
|| {
|
||||
println!("download finished");
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
println!("update installed");
|
||||
app.restart();
|
||||
}
|
||||
|
||||
let mut new_url = window.url().unwrap();
|
||||
new_url.set_path("/main");
|
||||
window.navigate(new_url).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lncvrt Games Launcher",
|
||||
"url": "/update/checking",
|
||||
"url": "/main",
|
||||
"width": 1000,
|
||||
"height": 600,
|
||||
"minWidth": 1000,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lncvrt Games Launcher",
|
||||
"url": "/update/checking",
|
||||
"url": "/main",
|
||||
"width": 1000,
|
||||
"height": 600,
|
||||
"minWidth": 1000,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"windows": [
|
||||
{
|
||||
"title": "Lncvrt Games Launcher",
|
||||
"url": "/update/checking",
|
||||
"url": "/main",
|
||||
"width": 1000,
|
||||
"height": 632,
|
||||
"minWidth": 1000,
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
'use client'
|
||||
|
||||
export default function UpdateCheckingPage () {
|
||||
return <p className='text-5xl text-center'>Checking for updates</p>
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import '@/styles/globals.css'
|
||||
import { platform } from '@tauri-apps/plugin-os'
|
||||
import { Roboto } from 'next/font/google'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
const roboto = Roboto({
|
||||
subsets: ['latin']
|
||||
})
|
||||
|
||||
export default function RootLayout ({
|
||||
children
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const [platformName, setPlatformName] = useState<string | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => setPlatformName(platform()), 0)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
<html lang='en' className={roboto.className}>
|
||||
<body className='dark-theme'>
|
||||
<div
|
||||
className='relative z-2 w-screen border-b border-b-(--col3) h-8.25 bg-(--col1)'
|
||||
hidden={platformName != 'windows'}
|
||||
/>
|
||||
<div
|
||||
className={`w-screen ${
|
||||
platformName == 'windows' ? 'h-[calc(100vh-64px)]' : 'h-screen'
|
||||
} flex items-center justify-center`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
'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>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
'use client'
|
||||
|
||||
export default function UpdateCheckingPage () {
|
||||
return <p className='text-5xl text-center'>Updating launcher</p>
|
||||
}
|
||||
Reference in new issue
Block a user