chore: add platform check
This commit is contained in:
parent
6d2d5de6d2
commit
3dc62a060e
@ -634,3 +634,8 @@ pub fn open_url_in_browser(url: String) -> Result<(), String> {
|
||||
pub fn exit(app: AppHandle) {
|
||||
app.exit(0x0100);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_platform() -> String {
|
||||
std::env::consts::OS.to_string()
|
||||
}
|
@ -8,7 +8,7 @@ use crate::commands::{
|
||||
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
|
||||
get_osu_skin, get_osu_version, get_skins_count, is_osu_running, open_url_in_browser,
|
||||
replace_ui_files, run_osu, run_osu_updater, set_osu_config_values, set_osu_user_config_values,
|
||||
valid_osu_folder,
|
||||
valid_osu_folder, get_platform
|
||||
};
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
@ -45,7 +45,8 @@ pub fn run() {
|
||||
is_osu_running,
|
||||
open_url_in_browser,
|
||||
get_launcher_version,
|
||||
exit
|
||||
exit,
|
||||
get_platform
|
||||
])
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
|
@ -113,3 +113,4 @@ export const isOsuRunning = async () => {
|
||||
|
||||
export const getLauncherVersion = async () => await invoke<string>('get_launcher_version');
|
||||
export const exit = async () => await invoke('exit');
|
||||
export const getPlatform = async () => await invoke<string>('get_platform');
|
||||
|
@ -1,7 +1,9 @@
|
||||
<script lang="ts">
|
||||
import Logo from '$assets/logo.png';
|
||||
import '../app.css';
|
||||
|
||||
import Titlebar from '@/components/ui/titlebar/titlebar.svelte';
|
||||
import * as AlertDialog from '@/components/ui/alert-dialog';
|
||||
import { currentLoadingInfo, firstStartup, launcherVersion, setupValues } from '@/global';
|
||||
import { onMount } from 'svelte';
|
||||
import OsuCursor from '@/components/ui/osu-cursor/OsuCursor.svelte';
|
||||
@ -16,13 +18,16 @@
|
||||
import { Buffer } from 'buffer';
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import { userAuth } from '@/userAuthentication';
|
||||
import { getLauncherVersion } from '@/osuUtil';
|
||||
import { exit, getLauncherVersion, getPlatform } from '@/osuUtil';
|
||||
|
||||
import '@fontsource/sora';
|
||||
import '@fontsource/space-mono';
|
||||
import Button from '@/components/ui/button/button.svelte';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
let unsupported_platform = $state<boolean>(false);
|
||||
|
||||
function disableReload() {
|
||||
if (window.location.hostname !== 'tauri.localhost') {
|
||||
return;
|
||||
@ -77,6 +82,7 @@
|
||||
disableReload();
|
||||
setupValues();
|
||||
launcherVersion.set(await getLauncherVersion());
|
||||
if ((await getPlatform()) !== 'windows') unsupported_platform = true;
|
||||
const isFirstStartup = await $userSettings.init();
|
||||
$userAuth.init();
|
||||
|
||||
@ -110,6 +116,29 @@
|
||||
|
||||
<Titlebar />
|
||||
|
||||
<AlertDialog.Root open={unsupported_platform}>
|
||||
<AlertDialog.Content class="bg-theme-950 border-theme-800 p-0">
|
||||
<div
|
||||
class="flex flex-col items-center justify-center border-b border-theme-800 bg-black/40 rounded-t-lg p-3"
|
||||
>
|
||||
<img class="h-20 w-20" src={Logo} alt="logo" />
|
||||
<span class="font-semibold text-xl">Unsupported Platform!</span>
|
||||
</div>
|
||||
<div
|
||||
class="flex flex-col items-center text-sm text-center bg-theme-900 border border-theme-800 rounded-lg mx-3 p-3"
|
||||
>
|
||||
This Platform is not supported by EZPPLauncher.
|
||||
</div>
|
||||
<div class="flex items-center justify-center mb-3">
|
||||
<Button
|
||||
onclick={async () => {
|
||||
await exit();
|
||||
}}>Close</Button
|
||||
>
|
||||
</div>
|
||||
</AlertDialog.Content>
|
||||
</AlertDialog.Root>
|
||||
|
||||
<main>
|
||||
{@render children()}
|
||||
</main>
|
||||
|
Loading…
x
Reference in New Issue
Block a user