Working backend-frontend launcher
This commit is contained in:
@@ -27,6 +27,8 @@ fn download(version: &str) {
|
||||
let game_path = path!(&base_path, "minecraft");
|
||||
let jre_path = path!(&base_path, "jre");
|
||||
|
||||
println!("Downloading {version}");
|
||||
|
||||
match smallauncher_lib::download::download_minecraft_version(&game_path, &jre_path, &version) {
|
||||
Ok(_) => println!("Download completed!"),
|
||||
Err(e) => println!("Download failed: {:?}", e),
|
||||
|
||||
+13
-26
@@ -2,8 +2,8 @@ import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { LogOut, Play, Settings, User } from "lucide-react";
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { Play, Settings, User } from "lucide-react";
|
||||
import { authenticate, launchMinecraft } from "./lib/launcher";
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
@@ -16,46 +16,33 @@ export default function App() {
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-6">
|
||||
<Tabs defaultValue="play" className="w-full">
|
||||
<TabsList className="grid grid-cols-3">
|
||||
<TabsList className="grid grid-cols-3 w-max mx-auto">
|
||||
<TabsTrigger value="play">Play</TabsTrigger>
|
||||
<TabsTrigger value="account">Account</TabsTrigger>
|
||||
<TabsTrigger value="auth">Accounts</TabsTrigger>
|
||||
<TabsTrigger value="settings">Settings</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
{/* Play Tab */}
|
||||
<TabsContent value="play" className="space-y-4">
|
||||
<div className="flex flex-col items-center gap-4">
|
||||
<Button
|
||||
onClick={() => {
|
||||
invoke('authenticate')
|
||||
launchMinecraft('Amgxy', '1.21.4');
|
||||
}}
|
||||
className="w-full font-bold text-lg flex items-center gap-2"
|
||||
>Auth</Button>
|
||||
><Play /> Launch</Button>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
{/* Account Tab */}
|
||||
<TabsContent value="account" className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-zinc-200">Username</label>
|
||||
<Input placeholder="Enter your username" className="bg-zinc-800 border-zinc-700" />
|
||||
</div>
|
||||
<Button className="w-full flex items-center gap-2">
|
||||
<User className="w-5 h-5" /> Login
|
||||
</Button>
|
||||
<Button variant="destructive" className="w-full flex items-center gap-2">
|
||||
<LogOut className="w-5 h-5" /> Logout
|
||||
</Button>
|
||||
<TabsContent value="auth" className="space-y-4">
|
||||
<Button
|
||||
onClick={() => {
|
||||
authenticate();
|
||||
}}
|
||||
className="w-full font-bold text-lg flex items-center gap-2"
|
||||
><User /> Authenticate</Button>
|
||||
</TabsContent>
|
||||
|
||||
{/* Settings Tab */}
|
||||
<TabsContent value="settings" className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-zinc-200">
|
||||
Java Path
|
||||
</label>
|
||||
<Input placeholder="/usr/bin/java" className="bg-zinc-800 border-zinc-700" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium text-zinc-200">
|
||||
RAM Allocation (MB)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
export const authenticate = () => invoke('authenticate');
|
||||
export const download = (version: string) => invoke('download', { version });
|
||||
export const checkVersion = (version: string) => invoke('check_version', { version });
|
||||
export const launchMinecraft = (username: string, version: string) => invoke('launch_minecraft', { username, version });
|
||||
Reference in New Issue
Block a user