Refactored slightly

This commit is contained in:
2026-04-04 16:45:31 +02:00
parent 85ee25aa76
commit db0b229e52
9 changed files with 67 additions and 22 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ import {
User, User,
LogOut, LogOut,
} from "lucide-react"; } from "lucide-react";
import { getVersions } from "./services/SaturnApi"; import { getVersions } from "./lib/saturn";
import { clsx, type ClassValue } from "clsx"; import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge"; import { twMerge } from "tailwind-merge";
import Logo from "@/assets/logo.png"; import Logo from "@/assets/logo.png";
@@ -22,7 +22,7 @@ function cn(...inputs: ClassValue[]) {
import PlaySection from "./components/PlaySection"; import PlaySection from "./components/PlaySection";
import ModsSection from "./components/ModsSection"; import ModsSection from "./components/ModsSection";
import SettingsSection from "./components/SettingsSection"; import SettingsSection from "./components/SettingsSection";
import { GameVersion } from "./services/Types"; import { GameVersion } from "./lib/types";
type Section = "play" | "mods" | "settings"; type Section = "play" | "mods" | "settings";
+2 -2
View File
@@ -14,11 +14,11 @@ import {
getVersions, getVersions,
toggleMod, toggleMod,
installMod, installMod,
} from "../services/SaturnApi"; } from "../lib/saturn";
import { clsx, type ClassValue } from "clsx"; import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge"; import { twMerge } from "tailwind-merge";
import { motion, AnimatePresence } from "framer-motion"; import { motion, AnimatePresence } from "framer-motion";
import { GameVersion, Mod } from "@/services/Types"; import { GameVersion, Mod } from "@/lib/types";
function cn(...inputs: ClassValue[]) { function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs)); return twMerge(clsx(inputs));
+2 -2
View File
@@ -3,8 +3,8 @@ import { Play, Loader2 } from "lucide-react";
// import { launchGame } from "../services/SaturnApi"; // import { launchGame } from "../services/SaturnApi";
import Bg from "@/assets/bg.png"; import Bg from "@/assets/bg.png";
import { listen } from "@tauri-apps/api/event"; import { listen } from "@tauri-apps/api/event";
import { GameVersion } from "@/services/Types"; import { GameVersion } from "@/lib/types";
import { launch } from "@/services/LauncherApi"; import { launch } from "@/lib/launcher";
interface PlaySectionProps { interface PlaySectionProps {
version: GameVersion; version: GameVersion;
+2 -2
View File
@@ -7,9 +7,9 @@ import {
Info, Info,
AlertTriangle, AlertTriangle,
} from "lucide-react"; } from "lucide-react";
import { getSettings, updateSettings } from "../services/SaturnApi"; import { getSettings, updateSettings } from "../lib/saturn";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import { LauncherSettings } from "@/services/Types"; import { LauncherSettings } from "@/lib/types";
const SettingsSection: React.FC = () => { const SettingsSection: React.FC = () => {
const [settings, setSettings] = useState<LauncherSettings | null>(null); const [settings, setSettings] = useState<LauncherSettings | null>(null);
+50
View File
@@ -0,0 +1,50 @@
import { invoke } from "@tauri-apps/api/core";
/**
* Create Microsoft login URL
*/
export async function authCreateLink(): Promise<string> {
return await invoke("auth_create_link");
}
/**
* Exchange auth code for account
*/
export async function authLogin(code: string) {
return await invoke("auth_login", { code });
}
/**
* Refresh account by UUID
*/
export async function authRefresh(uuid: string) {
return await invoke("auth_refresh", { uuid });
}
/**
* Get all stored accounts
*/
export async function authList() {
return await invoke("auth_list");
}
/**
* Remove account by UUID
*/
export async function authRemove(uuid: string) {
return await invoke("auth_remove", { uuid });
}
/**
* Validate token (not expired)
*/
export async function authValidate(uuid: string): Promise<boolean> {
return await invoke("auth_validate", { uuid });
}
/**
* Get valid account (auto-refresh if needed)
*/
export async function authGetValid(uuid: string) {
return await invoke("auth_get_valid", { uuid });
}
+8
View File
@@ -0,0 +1,8 @@
import { invoke } from "@tauri-apps/api/core";
/**
* Launch the game with the selected account and version
*/
export async function launch() {
return await invoke("launch_game");
}
@@ -1,5 +1,5 @@
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
import { GameVersion, LauncherSettings, Mod } from "./Types"; import { GameVersion, LauncherSettings, Mod } from "./types";
// --- Versions --- // --- Versions ---
export async function getVersions(): Promise<GameVersion[]> { export async function getVersions(): Promise<GameVersion[]> {
-13
View File
@@ -1,13 +0,0 @@
import { invoke } from "@tauri-apps/api/core";
const clientId = "74909cec-49b6-4fee-aa60-1b2a57ef72e1";
export async function authenticate() {
return await invoke("plugin:lighty-launcher|authenticate", {
client_id: clientId,
});
}
export async function launch() {
return await invoke("launch_game");
}