This commit is contained in:
Michael Wain 2025-03-12 15:58:24 +03:00
parent 8d5288e82d
commit 72b345ac82
13 changed files with 571 additions and 85 deletions

3
.vscode/settings.json vendored Normal file

@ -0,0 +1,3 @@
{
"livePreview.defaultPreviewPath": "/src/www/log_screen.html"
}

45
Cargo.lock generated

@ -6,6 +6,7 @@ version = 4
name = "CraftX"
version = "0.1.0"
dependencies = [
"dirs",
"tokio",
"winit",
"wry",
@ -483,6 +484,27 @@ dependencies = [
"crypto-common",
]
[[package]]
name = "dirs"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.59.0",
]
[[package]]
name = "dispatch"
version = "0.2.0"
@ -555,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@ -1760,6 +1782,12 @@ version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad"
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "orbclient"
version = "0.3.48"
@ -2199,6 +2227,17 @@ dependencies = [
"bitflags 2.9.0",
]
[[package]]
name = "redox_users"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
dependencies = [
"getrandom 0.2.15",
"libredox",
"thiserror 2.0.12",
]
[[package]]
name = "rustc-demangle"
version = "0.1.24"
@ -2224,7 +2263,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]
@ -3157,7 +3196,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys 0.52.0",
"windows-sys 0.59.0",
]
[[package]]

@ -6,4 +6,5 @@ edition = "2024"
[dependencies]
winit = "0.30.9"
wry = "0.50.4"
tokio = { version = "1", features = ["full"] }
tokio = { version = "1", features = ["full"] }
dirs = "6.0.0"

30
src/config.rs Normal file

@ -0,0 +1,30 @@
use std::path::PathBuf;
#[derive(Default)]
pub struct LauncherConfig {
is_portable: bool
}
impl LauncherConfig {
pub fn set_portable(&mut self, is_portable: bool) {
self.is_portable = is_portable;
}
pub fn launcher_dir(&self) -> PathBuf {
match self.is_portable {
true => get_relative_launcher_dir(),
false => get_absolute_launcher_dir()
}
}
}
fn get_relative_launcher_dir() -> PathBuf {
std::env::current_dir().unwrap()
}
fn get_absolute_launcher_dir() -> PathBuf {
let mut p = dirs::data_dir().unwrap();
p.push("xcraft");
p
}

@ -1,41 +1,94 @@
use std::sync::{Arc, Mutex};
use config::LauncherConfig;
use tokio::runtime::Runtime;
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
use winit::application::ApplicationHandler;
use winit::event_loop::{ControlFlow, EventLoop};
use winit::event::{Event, WindowEvent};
use winit::platform::run_on_demand::EventLoopExtRunOnDemand;
use winit::window::{Window, WindowId};
use winit::event_loop::ActiveEventLoop;
use wry::WebViewBuilder;
use wry::dpi::LogicalSize;
use wry::http::Request;
use wry::{WebView, WebViewBuilder, WebViewBuilderExtWindows};
mod config;
static SENDER: Mutex<Option<UnboundedSender<Request<String>>>> = Mutex::new(None);
static SENDERGUI: Mutex<Option<UnboundedSender<UIAction>>> = Mutex::new(None);
enum UIAction {
DoSomething
}
#[derive(Default)]
struct App {
window: Option<Window>,
webview: Option<wry::WebView>,
}
impl ApplicationHandler for App {
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let window = event_loop.create_window(Window::default_attributes()).unwrap();
let window = event_loop.create_window(Window::default_attributes().with_inner_size(LogicalSize::new(900, 600)).with_min_inner_size(LogicalSize::new(900, 600)).with_title("XCraft")).unwrap();
let webview = WebViewBuilder::new()
.with_html(include_str!("www/sign_in.html"))
.with_html(include_str!("www/portable.html"))
.with_ipc_handler(|request| {
SENDER.lock().unwrap().as_ref().unwrap().send(request);
})
.build(&window)
.unwrap();
self.window = Some(window);
self.webview = Some(webview);
self.launcher_start(Arc::new(webview));
}
fn window_event(&mut self, event_loop: &ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {
match event {
WindowEvent::CloseRequested => {
event_loop.exit();
}
},
_ => {}
}
}
}
fn main() {
impl App {
fn launcher_start(&mut self, webview: Arc<WebView>) {
tokio::spawn(async move {
let (sender_gui, mut receiver_gui) = mpsc::unbounded_channel();
*SENDERGUI.lock().unwrap() = Some(sender_gui);
loop {
if let Some(action) = receiver_gui.recv().await {
println!("YUPPIE");
webview.evaluate_script("alert('done')");
}
}
});
}
}
#[tokio::main]
async fn main() {
let (snd, mut receiver) = mpsc::unbounded_channel();
*SENDER.lock().unwrap() = Some(snd);
let event_loop = EventLoop::new().unwrap();
let mut app = App::default();
let rt = Runtime::new().unwrap();
rt.spawn(async move {
loop {
if let Some(request) = receiver.recv().await {
println!("Request: {}", request.body());
SENDERGUI.lock().unwrap().as_ref().unwrap().send(UIAction::DoSomething);
}
}
});
event_loop.run_app(&mut app).unwrap();
}

@ -3,73 +3,34 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minecraft Launcher</title>
<title>Launcher Settings</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 flex justify-center items-center h-screen">
<div class="bg-white shadow-lg rounded-xl p-6 w-96 text-center">
<h1 class="text-2xl font-semibold text-gray-700">Minecraft Launcher</h1>
<h2 class="text-2xl font-semibold text-gray-700">Launcher Settings</h2>
<!-- Version Selection -->
<label class="block mt-4 text-gray-600">Select Version:</label>
<select id="mc-version" class="mt-2 w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-green-500">
<option value="latest">Latest Release</option>
<option value="1.20.1">1.20.1</option>
<option value="1.19.4">1.19.4</option>
<option value="1.18.2">1.18.2</option>
<option value="1.16.5">1.16.5</option>
<option value="1.12.2">1.12.2 (Modding)</option>
</select>
<!-- Download Button -->
<button onclick="downloadVersion()"
class="mt-4 w-full bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
⬇ Download Version
</button>
<!-- OR Divider -->
<div class="mt-4 text-gray-500 text-sm">or</div>
<!-- Add MultiMC Instance -->
<button onclick="addMultiMCInstance()"
class="mt-3 w-full bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded transition">
Add MultiMC Instance
</button>
<!-- Navigation Buttons -->
<div class="mt-6 flex gap-2">
<button onclick="goToSettings()"
class="w-1/2 bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded transition">
⚙ Settings
</button>
<button onclick="goToLogin()"
class="w-1/2 bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded transition">
🔑 Login
<!-- Inline Input + Button -->
<div class="mt-4 flex items-center border border-gray-300 rounded-lg overflow-hidden">
<input id="java-path" type="text" placeholder="Enter Java Path"
class="flex-1 px-4 py-2 focus:outline-none">
<button onclick="saveJavaPath()"
class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 font-bold transition">
✔ Save
</button>
</div>
<p class="mt-4 text-sm text-gray-500">Minecraft Launcher v1.0</p>
<!-- Message -->
<p id="message" class="text-sm text-gray-500 mt-2 hidden">Path saved!</p>
</div>
<script>
function downloadVersion() {
const version = document.getElementById("mc-version").value;
alert(Downloading Minecraft ${version}...);
// In Rust, this should trigger the actual download.
}
function addMultiMCInstance() {
alert("Select a MultiMC instance folder.");
// In Rust, this should open a file picker.
}
function goToSettings() {
window.location.href = "settings.html";
}
function goToLogin() {
window.location.href = "login.html";
function saveJavaPath() {
let input = document.getElementById("java-path").value;
if (input.trim() !== "") {
document.getElementById("message").classList.remove("hidden");
}
}
</script>

42
src/www/notification.html Normal file

@ -0,0 +1,42 @@
<div class="rounded-2xl border border-blue-100 bg-white p-4 shadow-lg sm:p-6 lg:p-8" role="alert">
<div class="flex items-center gap-4">
<span class="shrink-0 rounded-full bg-blue-400 p-2 text-white">
<svg
class="size-4"
fill="currentColor"
viewbox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M18 3a1 1 0 00-1.447-.894L8.763 6H5a3 3 0 000 6h.28l1.771 5.316A1 1 0 008 18h1a1 1 0 001-1v-4.382l6.553 3.276A1 1 0 0018 15V3z"
fill-rule="evenodd"
/>
</svg>
</span>
<p class="font-medium sm:text-lg">New message!</p>
</div>
<p class="mt-4 text-gray-500">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsam ea quo unde vel adipisci
blanditiis voluptates eum. Nam, cum minima?
</p>
<div class="mt-6 sm:flex sm:gap-4">
<a
class="inline-block w-full rounded-lg bg-blue-500 px-5 py-3 text-center text-sm font-semibold text-white sm:w-auto"
href="#"
>
Take a Look
</a>
<a
class="mt-2 inline-block w-full rounded-lg bg-gray-50 px-5 py-3 text-center text-sm font-semibold text-gray-500 sm:mt-0 sm:w-auto"
href="#"
>
Mark as Read
</a>
</div>
</div>

345
src/www/portable.html Normal file

@ -0,0 +1,345 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="flex bg-gray-100 h-screen">
<div class="flex h-screen bg-white w-16 flex-col justify-between border-e border-gray-100 hidden">
<div>
<div class="inline-flex size-16 items-center justify-center">
<a href="#" onclick="showSection(this, 'appearance')">
<span class="grid size-10 place-content-center rounded-lg bg-[url(https://www.mc-heads.net/avatar/notch)] text-xs text-gray-600">
N
</span>
</a>
</div>
<div class="border-t border-gray-100">
<div class="px-2">
<div class="py-4">
<a
href="#"
onclick="showSection(this, 'instances')"
class="menu-btn t group relative flex justify-center rounded-sm bg-green-50 px-2 py-1.5 text-green-700"
>
<i class="fa-solid fa-gamepad"></i>
<span
class="invisible absolute start-full top-1/2 ms-4 -translate-y-1/2 rounded-sm bg-gray-900 px-2 py-1.5 text-xs font-medium text-white group-hover:visible"
>
Play
</span>
</a>
</div>
<ul class="space-y-1 border-t border-gray-100 pt-4">
<li>
<a
href="#"
onclick="showSection(this, 'add')"
class="menu-btn group relative flex justify-center rounded-sm px-2 py-1.5 text-gray-500 hover:bg-gray-50 hover:text-gray-700"
>
<i class="fa-solid fa-download"></i>
<span
class="invisible absolute start-full top-1/2 ms-4 -translate-y-1/2 rounded-sm bg-gray-900 px-2 py-1.5 text-xs font-medium text-white group-hover:visible"
>
Download
</span>
</a>
</li>
<li>
<a
href="#"
onclick="showSection(this, 'servers')"
class="menu-btn group relative flex justify-center rounded-sm px-2 py-1.5 text-gray-500 hover:bg-gray-50 hover:text-gray-700"
>
<i class="fa-solid fa-network-wired"></i>
<span
class="invisible absolute start-full top-1/2 ms-4 -translate-y-1/2 rounded-sm bg-gray-900 px-2 py-1.5 text-xs font-medium text-white group-hover:visible"
>
Servers
</span>
</a>
</li>
<li>
<a
href="#"
onclick="showSection(this, 'accounts')"
class="menu-btn group relative flex justify-center rounded-sm px-2 py-1.5 text-gray-500 hover:bg-gray-50 hover:text-gray-700"
>
<i class="fa-solid fa-user-group"></i>
<span
class="invisible absolute start-full top-1/2 ms-4 -translate-y-1/2 rounded-sm bg-gray-900 px-2 py-1.5 text-xs font-medium text-white group-hover:visible"
>
Accounts
</span>
</a>
</li>
<li>
<a
href="#"
onclick="showSection(this, 'settings')"
class="menu-btn group relative flex justify-center rounded-sm px-2 py-1.5 text-gray-500 hover:bg-gray-50 hover:text-gray-700"
>
<i class="fa-solid fa-gear"></i>
<span
class="invisible absolute start-full top-1/2 ms-4 -translate-y-1/2 rounded-sm bg-gray-900 px-2 py-1.5 text-xs font-medium text-white group-hover:visible"
>
Settings
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="flex justify-center items-center w-screen h-screen">
<div id="installation-section" class="xsection bg-white shadow-lg rounded-xl p-6 w-96 text-center">
<h1 class="text-2xl font-semibold text-gray-700">Welcome to Minecraft Launcher</h1>
<p class="mt-2 text-gray-600">Choose how you want to set up Minecraft.</p>
<!-- Portable Mode -->
<button onclick="runPortable()"
class="mt-6 w-full bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded transition">
Run in Portable Mode
</button>
<p class="text-sm text-gray-500 mt-1">No installation required. Saves everything in a local folder.</p>
<!-- Installation Mode -->
<button onclick="installMinecraft()"
class="mt-4 w-full bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
Install Minecraft
</button>
<p class="text-sm text-gray-500 mt-1">Installs Minecraft on your system for long-term use.</p>
</div>
<div id="login-section" class="xsection bg-white shadow-lg rounded-xl p-6 w-96 text-center hidden">
<h2 class="text-2xl font-semibold text-gray-700">CraftX v1.0</h2>
<!-- Username -->
<input type="text" placeholder="Username" class="mt-4 w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-green-500">
<!-- Password -->
<input type="password" placeholder="Password" class="mt-3 w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-green-500">
<!-- Sign In Button -->
<button
class="mt-4 w-full bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
Sign In
</button>
<!-- Footer -->
<p class="mt-4 text-sm text-gray-500">alterdekim</p>
</div>
<div id="add-section" class="xsection bg-white shadow-lg rounded-xl p-6 w-96 text-center hidden">
<h1 class="text-2xl font-semibold text-gray-700">New instance</h1>
<!-- Version Selection -->
<label class="block mt-4 text-gray-600">Select Version:</label>
<select id="mc-version" class="mt-2 w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-green-500">
<option value="latest">Latest Release</option>
<option value="1.20.1">1.20.1</option>
<option value="1.19.4">1.19.4</option>
<option value="1.18.2">1.18.2</option>
<option value="1.16.5">1.16.5</option>
<option value="1.12.2">1.12.2 (Modding)</option>
</select>
<!-- Download Button -->
<button
class="mt-4 w-full bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
<i class="fa-solid fa-download"></i> Download Version
</button>
<!-- OR Divider -->
<div class="mt-4 text-gray-500 text-sm">or</div>
<!-- Add MultiMC Instance -->
<button
class="mt-3 w-full bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded transition">
<i class="fa-solid fa-file-zipper"></i> Add MultiMC Instance
</button>
<p class="mt-4 text-sm text-gray-500">alterdekim</p>
</div>
<div id="settings-section" class="xsection bg-white shadow-lg rounded-xl p-6 w-96 text-center hidden">
<h2 class="text-2xl font-semibold text-gray-700">Launcher Settings</h2>
<!-- Tabs -->
<div class="mt-4 flex justify-around text-gray-600">
<button class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-rocket"></i> Launcher</button>
<button class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-gamepad"></i> Minecraft</button>
<button class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-mug-hot"></i> Java</button>
<button class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-cube"></i> Versions</button>
</div>
<!-- Sections -->
<div id="launcher" class="settings-tab mt-4">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-rocket"></i> Launcher Settings</h3>
<label class="block mt-3 text-gray-600">Auto-update:</label>
<select class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
<option>Enabled</option>
<option>Disabled</option>
</select>
<label class="block mt-3 text-gray-600">UI Theme:</label>
<select class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
<option>Light</option>
<option>Dark</option>
</select>
</div>
<div id="minecraft" class="settings-tab mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-gamepad"></i> Minecraft Settings</h3>
<label class="block mt-3 text-gray-600">Game Directory:</label>
<input type="text" placeholder="/path/to/minecraft" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
<label class="block mt-3 text-gray-600">RAM Allocation:</label>
<input type="range" min="1024" max="16384" step="512" class="w-full">
<label class="block mt-3 text-gray-600">Enable Mods:</label>
<input type="checkbox" class="ml-2">
</div>
<div id="java" class="settings-tab mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-mug-hot"></i> Java Settings</h3>
<label class="block mt-3 text-gray-600">Java Path:</label>
<input type="text" placeholder="/path/to/java" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
<label class="block mt-3 text-gray-600">Custom JVM Arguments:</label>
<textarea class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500" rows="2">-Xmx4G -Xms2G</textarea>
</div>
<div id="versions" class="settings-tab mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-cube"></i> Version Settings</h3>
<label class="block mt-3 text-gray-600">Show Experimental Versions:</label>
<input type="checkbox" class="ml-2">
<label class="block mt-3 text-gray-600">Show Snapshots:</label>
<input type="checkbox" class="ml-2">
</div>
<button
class="w-full mt-6 bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
<i class="fa-solid fa-floppy-disk"></i> Save
</button>
<p class="mt-4 text-sm text-gray-500">Minecraft Launcher v1.0</p>
</div>
<div id="appearance-section" class="xsection bg-white shadow-lg rounded-xl p-6 w-96 text-center hidden">
<h2 class="text-2xl font-semibold text-gray-700">Account Settings</h2>
<div class="mt-6 text-left">
<label class="text-gray-600 font-medium">Offline username</label>
<input type="text" placeholder="Username" class="mt-4 w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-green-500">
</div>
<!-- Skin Upload -->
<div class="mt-6 text-left">
<label class="text-gray-600 font-medium">Minecraft Skin</label>
<div class="mt-2 flex items-center gap-4">
<img id="skin-preview" src="https://www.mc-heads.net/avatar/notch" class="w-16 h-16 rounded-md border" alt="Skin Preview">
<input id="skin-upload" type="file" accept=".png" class="hidden" onchange="previewSkin()">
<button onclick="document.getElementById('skin-upload').click()"
class="bg-green-500 hover:bg-green-700 text-white px-4 py-2 rounded">
Upload
</button>
</div>
</div>
<!-- Cape Upload -->
<div class="mt-6 text-left">
<label class="text-gray-600 font-medium">Minecraft Cape</label>
<div class="mt-2 flex items-center gap-4">
<img id="cape-preview" src="https://skinmc.net/capes/77863/download" class="w-16 h-16 rounded-md border" alt="Cape Preview">
<input id="cape-upload" type="file" accept=".png" class="hidden" onchange="previewCape()">
<button onclick="document.getElementById('cape-upload').click()"
class="bg-green-500 hover:bg-green-700 text-white px-4 py-2 rounded">
Upload
</button>
</div>
</div>
<!-- Save Button -->
<button
class="mt-6 w-full bg-green-500 hover:bg-green-700 text-white py-2 rounded font-bold transition">
Save Settings
</button>
</div>
<div id="accounts-section" class="xsection grid grid-cols-3 gap-4 p-6 w-fill hidden">
<div class="bg-white cursor-pointer hover:bg-green-500 hover:text-white shadow-lg rounded-xl w-48 h-24 flex justify-center items-center">
<img src="https://www.mc-heads.net/avatar/MHF_Steve" class="w-12 h-12 rounded-full">
<div class="h-fill ms-2">
<h2 class="text-lg font-semibold">DartJevder</h2>
<h2 class="text-sm font-semibold">Blatnoe Pivo</h2>
</div>
</div>
</div>
<div id="instances-section" class="xsection grid grid-cols-3 gap-4 p-6 w-fill hidden">
<div class="bg-white cursor-pointer hover:bg-green-500 hover:text-white shadow-lg rounded-xl w-48 h-24 flex justify-center items-center">
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fi.pinimg.com%2Foriginals%2Fc0%2F84%2Ff1%2Fc084f19e45602b0a56107ec87149c3a5.png&f=1&nofb=1&ipt=7a22d9bd0f8ec98f71cdee3b26ba45c8eeb4da5286e17337d5550291e1ad1dda&ipo=images" class="w-12 h-12 rounded-full">
<div class="h-fill ms-2">
<h2 class="text-lg font-semibold">Release</h2>
<h2 class="text-sm font-semibold">1.12.2</h2>
</div>
</div>
</div>
<div id="servers-section" class="xsection grid grid-cols-3 gap-4 p-6 w-fill hidden">
<div class="bg-white cursor-pointer hover:bg-green-500 hover:text-white shadow-lg rounded-xl w-48 h-24 flex justify-center items-center">
<img src="https://eu.mc-api.net/v3/server/favicon/mc.hypixel.net" class="w-12 h-12 rounded-full">
<div class="h-fill ms-2">
<h2 class="text-lg font-semibold">Hypixel</h2>
<h2 class="text-sm font-semibold">mc.hypixel.net</h2>
</div>
</div>
<div class="bg-white shadow-lg rounded-xl w-48 h-24 flex justify-center items-center text-3xl text-green-500 cursor-pointer hover:bg-green-500 hover:text-white"><i class="fa-solid fa-plus"></i></div>
</div>
</div>
</div>
<script type="text/javascript">
function runPortable() {
window.ipc.postMessage("run_portable");
}
function installMinecraft() {
window.ipc.postMessage("run_stadalone");
}
function showSection(obj, section) {
$(".menu-btn").each(function(i, d) {
$(d).removeClass('bg-green-50');
$(d).addClass('text-gray-500');
$(d).removeClass('text-green-700');
});
$(obj).addClass('bg-green-50');
$(obj).addClass('text-green-700');
$(obj).removeClass('text-gray-500');
$(".xsection").each(function(i, d) {
$(d).addClass('hidden');
});
$("#"+section+"-section").removeClass('hidden');
}
</script>
</body>
</html>

@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minecraft Launcher - Login</title>
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
@ -78,15 +79,15 @@
<!-- Tabs -->
<div class="mt-4 flex justify-around text-gray-600">
<button onclick="showSection('launcher')" class="py-2 px-4 focus:text-green-500">🚀 Launcher</button>
<button onclick="showSection('minecraft')" class="py-2 px-4 focus:text-green-500">🎮 Minecraft</button>
<button onclick="showSection('java')" class="py-2 px-4 focus:text-green-500"><i class="fa fa-fan"></i> Java</button>
<button onclick="showSection('versions')" class="py-2 px-4 focus:text-green-500">📦 Versions</button>
<button onclick="showSection('launcher')" class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-rocket"></i> Launcher</button>
<button onclick="showSection('minecraft')" class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-gamepad"></i> Minecraft</button>
<button onclick="showSection('java')" class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-mug-hot"></i> Java</button>
<button onclick="showSection('versions')" class="py-2 px-4 focus:text-green-500"><i class="fa-solid fa-cube"></i> Versions</button>
</div>
<!-- Sections -->
<div id="launcher" class="mt-4">
<h3 class="text-lg font-semibold text-gray-700">🚀 Launcher Settings</h3>
<div id="launcher" class="settings-tab mt-4">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-rocket"></i> Launcher Settings</h3>
<label class="block mt-3 text-gray-600">Auto-update:</label>
<select class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
<option>Enabled</option>
@ -100,8 +101,8 @@
</select>
</div>
<div id="minecraft" class="mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700">🎮 Minecraft Settings</h3>
<div id="minecraft" class="settings-tab mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-gamepad"></i> Minecraft Settings</h3>
<label class="block mt-3 text-gray-600">Game Directory:</label>
<input type="text" placeholder="/path/to/minecraft" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
@ -112,8 +113,8 @@
<input type="checkbox" class="ml-2">
</div>
<div id="java" class="mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"> Java Settings</h3>
<div id="java" class="settings-tab mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-mug-hot"></i> Java Settings</h3>
<label class="block mt-3 text-gray-600">Java Path:</label>
<input type="text" placeholder="/path/to/java" class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500">
@ -121,8 +122,8 @@
<textarea class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-green-500" rows="2">-Xmx4G -Xms2G</textarea>
</div>
<div id="versions" class="mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700">📦 Version Settings</h3>
<div id="versions" class="settings-tab mt-4 hidden">
<h3 class="text-lg font-semibold text-gray-700"><i class="fa-solid fa-cube"></i> Version Settings</h3>
<label class="block mt-3 text-gray-600">Show Experimental Versions:</label>
<input type="checkbox" class="ml-2">
@ -148,22 +149,33 @@
<script>
function goToSettings() {
document.getElementById('launcher-settings').classList.remove('hidden');
function showSection(section) {
$(".settings-tab").each(function(i, d) {
$(d).addClass('hidden');
});
$("#"+section).removeClass('hidden');
}
function showPlayScreen() {
function goBack() {
$("#launcher-settings").addClass('hidden');
}
function goToSettings() {
$("#launcher-settings").removeClass('hidden');
}
function downloadVersion() {
window.ipc.postMessage("show_play_screen");
}
function showAccountSettings() {
document.getElementById('login-screen').classList.add('hidden');
document.getElementById('main-screen').classList.remove('hidden');
$("#main-screen").removeClass('hidden');
$("#login-screen").addClass('hidden');
}
function showLoginScreen() {
document.getElementById('main-screen').classList.add('hidden');
document.getElementById('login-screen').classList.remove('hidden');
$("#main-screen").addClass('hidden');
$("#login-screen").removeClass('hidden');
}
</script>