This commit is contained in:
/home/neo
2026-08-18 15:36:27 +03:00
committed by GitHub
parent 116fda9c27
commit 0e1c9250bf
7 changed files with 61 additions and 11 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

+1
View File
@@ -6,6 +6,7 @@ pub mod file_dialogs;
pub mod game; pub mod game;
pub mod java2lce; pub mod java2lce;
pub mod macos_setup; pub mod macos_setup;
pub mod platform;
pub mod plugins; pub mod plugins;
pub mod proxy_cmd; pub mod proxy_cmd;
pub mod runners; pub mod runners;
+30
View File
@@ -0,0 +1,30 @@
use serde::Serialize;
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PlatformInfo {
pub is_linux: bool,
pub is_mac: bool,
pub is_windows: bool,
pub is_android: bool,
}
#[tauri::command]
pub fn get_platform() -> PlatformInfo {
#[cfg(target_os = "linux")]
{
PlatformInfo { is_linux: true, is_mac: false, is_windows: false, is_android: false }
}
#[cfg(target_os = "macos")]
{
PlatformInfo { is_linux: false, is_mac: true, is_windows: false, is_android: false }
}
#[cfg(target_os = "windows")]
{
PlatformInfo { is_linux: false, is_mac: false, is_windows: true, is_android: false }
}
#[cfg(target_os = "android")]
{
PlatformInfo { is_linux: false, is_mac: false, is_windows: false, is_android: true }
}
}
+2
View File
@@ -22,6 +22,7 @@ use commands::download;
use commands::file_dialogs; use commands::file_dialogs;
use commands::game; use commands::game;
use commands::macos_setup; use commands::macos_setup;
use commands::platform as platform_cmd;
use commands::plugins; use commands::plugins;
use commands::proxy_cmd; use commands::proxy_cmd;
use commands::runners; use commands::runners;
@@ -75,6 +76,7 @@ pub fn run() {
local_port: Arc::new(Mutex::new(None)), local_port: Arc::new(Mutex::new(None)),
}) })
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![
platform_cmd::get_platform,
macos_setup::setup_macos_runtime, macos_setup::setup_macos_runtime,
dlc::list_git_directory, dlc::list_git_directory,
dlc::download_dlc_files, dlc::download_dlc_files,
+9 -1
View File
@@ -79,6 +79,10 @@ const CreditsView = memo(function CreditsView() {
"Tymszn21", "Tymszn21",
"DaPogLord", "DaPogLord",
"turniphead", "turniphead",
"ArthurDotPNG",
"CounterrAct",
"luckyduuckxd",
"PixelatedCheese1",
].sort(() => Math.random() - 0.5), ].sort(() => Math.random() - 0.5),
[], [],
); );
@@ -96,6 +100,8 @@ const CreditsView = memo(function CreditsView() {
role: "Founder & Maintainer", role: "Founder & Maintainer",
members: [ members: [
{ name: "KayJann", url: "https://github.com/KayJannOnGit" }, { name: "KayJann", url: "https://github.com/KayJannOnGit" },
{ name: "Architect", url: "#" },
{ name: "neoapps", url: "https://github.com/neoapps-dev" },
], ],
}, },
{ {
@@ -119,6 +125,7 @@ const CreditsView = memo(function CreditsView() {
}, },
{ name: "Leon", url: "https://github.com/hornyalcoholic" }, { name: "Leon", url: "https://github.com/hornyalcoholic" },
{ name: "Criador_Mods", url: "https://github.com/CriadorMods" }, { name: "Criador_Mods", url: "https://github.com/CriadorMods" },
{ name: "j-carv", url: "https://github.com/j-carv" },
], ],
}, },
], ],
@@ -277,6 +284,7 @@ const CreditsView = memo(function CreditsView() {
{ name: "alreadywarned", url: "#" }, { name: "alreadywarned", url: "#" },
{ name: "andrewjcf", url: "#" }, { name: "andrewjcf", url: "#" },
{ name: "dille", url: "#" }, { name: "dille", url: "#" },
{ name: "neoapps", url: "#" },
], ],
}, },
], ],
@@ -334,7 +342,7 @@ const CreditsView = memo(function CreditsView() {
<motion.div <motion.div
initial={{ y: "50%" }} initial={{ y: "50%" }}
animate={{ y: "-200%" }} animate={{ y: "-200%" }}
transition={{ duration: 45, ease: "linear" }} transition={{ duration: 60, ease: "linear" }}
className="flex flex-col items-center justify-center space-y-8 py-20" className="flex flex-col items-center justify-center space-y-8 py-20"
> >
<div className="mb-8"> <div className="mb-8">
+19 -10
View File
@@ -1,14 +1,23 @@
import { useMemo } from 'react'; import { useState, useEffect } from "react";
import { invoke } from "@tauri-apps/api/core";
//neo: "why the fuck are you doing it in rust instead of UserAgent", well, Linux was being detected as Android SOMEHOW I DONT FUCKING KNOW HOW OH MY GOD
const DEFAULT = {
isLinux: false,
isMac: false,
isWindows: false,
isAndroid: false,
};
export function usePlatform() { export function usePlatform() {
const platform = useMemo(() => { const [platform, setPlatform] = useState(DEFAULT);
if (typeof window === 'undefined') return { isLinux: false, isMac: false, isWindows: false, isAndroid: false }; useEffect(() => {
const ua = window.navigator.userAgent.toLowerCase(); invoke<{
const plat = window.navigator.platform.toLowerCase(); isLinux: boolean;
const isAndroid = ua.includes('android'); isMac: boolean;
const isLinux = !isAndroid && (plat.includes('linux') || ua.includes('linux')); isWindows: boolean;
const isMac = !isAndroid && (plat.includes('mac') || ua.includes('mac')); isAndroid: boolean;
const isWindows = !isAndroid && (plat.includes('win') || ua.includes('win')); }>("get_platform")
return { isLinux, isMac, isWindows, isAndroid }; .then(setPlatform)
.catch(() => setPlatform(DEFAULT));
}, []); }, []);
return platform; return platform;