modified: Cargo.toml modified: src/config.rs modified: src/launcher.rs modified: src/main.rs modified: src/www/portable.html modified: .gitignore
381 lines
18 KiB
HTML
381 lines
18 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script src=" https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js "></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 id="sidebar" 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, 'screenshots')"
|
|
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-image"></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"
|
|
>
|
|
Screenshots
|
|
</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 id="sign_up_username" 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"> <!-- bg-red-50 border border-red-500 text-red-900 placeholder-red-700 focus:ring-2 focus:ring-red-500 -->
|
|
<p class="mt-2 text-sm text-red-600 dark:text-red-500 text-left hidden">Username has invalid characters or too short</p>
|
|
<!-- Sign In Button -->
|
|
<button
|
|
onclick="signUp()"
|
|
class="mt-4 w-full bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
|
|
Sign Up
|
|
</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 processParams(r) {
|
|
let params = JSON.parse(r).params;
|
|
for( let i = 0; i < params.length; i++ ) {
|
|
if( params[i].startsWith("show_") ) {
|
|
showSection(undefined, params[i].substring(5));
|
|
} else if( params[i] == "sidebar_on" ) {
|
|
$("#sidebar").removeClass('hidden');
|
|
} else if( params[i] == "sidebar_off") {
|
|
$("#sidebar").addClass('hidden');
|
|
}
|
|
}
|
|
}
|
|
|
|
function signUp() {
|
|
$.post({url: "sign_up", data: JSON.stringify({ params: [$("#sign_up_username").val()] }) }, processParams)
|
|
}
|
|
|
|
function runPortable() {
|
|
console.log($.get("portable", processParams));
|
|
}
|
|
|
|
function installMinecraft() {
|
|
console.log($.get("installation", processParams));
|
|
}
|
|
|
|
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');
|
|
}
|
|
|
|
$( document ).ready(async function() {
|
|
$.get("check_installation", processParams)
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |