modified: Cargo.lock
modified: Cargo.toml modified: src/config.rs new file: src/launcher.rs modified: src/main.rs new file: src/util.rs new file: src/www/font-awesome.min.css modified: src/www/portable.html
This commit is contained in:
parent
12a85b7b2c
commit
46e19a87f8
81
Cargo.lock
generated
81
Cargo.lock
generated
@ -7,6 +7,9 @@ name = "CraftX"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dirs",
|
"dirs",
|
||||||
|
"rand 0.9.0",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"winit",
|
"winit",
|
||||||
"wry",
|
"wry",
|
||||||
@ -841,6 +844,18 @@ dependencies = [
|
|||||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi 0.13.3+wasi-0.2.2",
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gimli"
|
name = "gimli"
|
||||||
version = "0.31.1"
|
version = "0.31.1"
|
||||||
@ -2147,6 +2162,17 @@ dependencies = [
|
|||||||
"rand_core 0.6.4",
|
"rand_core 0.6.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
|
||||||
|
dependencies = [
|
||||||
|
"rand_chacha 0.9.0",
|
||||||
|
"rand_core 0.9.3",
|
||||||
|
"zerocopy 0.8.23",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_chacha"
|
name = "rand_chacha"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@ -2167,6 +2193,16 @@ dependencies = [
|
|||||||
"rand_core 0.6.4",
|
"rand_core 0.6.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core 0.9.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
@ -2185,6 +2221,15 @@ dependencies = [
|
|||||||
"getrandom 0.2.15",
|
"getrandom 0.2.15",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.9.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.3.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_hc"
|
name = "rand_hc"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@ -2272,6 +2317,12 @@ version = "1.0.20"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
|
checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "same-file"
|
name = "same-file"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
@ -2352,6 +2403,18 @@ dependencies = [
|
|||||||
"syn 2.0.100",
|
"syn 2.0.100",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.140"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
|
||||||
|
dependencies = [
|
||||||
|
"itoa 1.0.15",
|
||||||
|
"memchr",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.8"
|
version = "0.6.8"
|
||||||
@ -2894,6 +2957,15 @@ version = "0.11.0+wasi-snapshot-preview1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.13.3+wasi-0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
|
||||||
|
dependencies = [
|
||||||
|
"wit-bindgen-rt",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.100"
|
version = "0.2.100"
|
||||||
@ -3581,6 +3653,15 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wit-bindgen-rt"
|
||||||
|
version = "0.33.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.9.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "write16"
|
name = "write16"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -8,3 +8,6 @@ winit = "0.30.9"
|
|||||||
wry = "0.50.4"
|
wry = "0.50.4"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
dirs = "6.0.0"
|
dirs = "6.0.0"
|
||||||
|
rand = "0.9.0"
|
||||||
|
serde = { version = "1.0.219", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
@ -6,7 +6,6 @@ pub struct LauncherConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl LauncherConfig {
|
impl LauncherConfig {
|
||||||
|
|
||||||
pub fn set_portable(&mut self, is_portable: bool) {
|
pub fn set_portable(&mut self, is_portable: bool) {
|
||||||
self.is_portable = is_portable;
|
self.is_portable = is_portable;
|
||||||
}
|
}
|
||||||
@ -17,10 +16,18 @@ impl LauncherConfig {
|
|||||||
false => get_absolute_launcher_dir()
|
false => get_absolute_launcher_dir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn config_path(&self) -> PathBuf {
|
||||||
|
let mut p = self.launcher_dir();
|
||||||
|
p.push("config.toml");
|
||||||
|
p
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_relative_launcher_dir() -> PathBuf {
|
pub fn get_relative_launcher_dir() -> PathBuf {
|
||||||
std::env::current_dir().unwrap()
|
let mut p = std::env::current_dir().unwrap();
|
||||||
|
p.push("xcraft");
|
||||||
|
p
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_absolute_launcher_dir() -> PathBuf {
|
fn get_absolute_launcher_dir() -> PathBuf {
|
||||||
|
44
src/launcher.rs
Normal file
44
src/launcher.rs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
use crate::config::LauncherConfig;
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct Launcher {
|
||||||
|
pub config: LauncherConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Launcher {
|
||||||
|
|
||||||
|
pub fn is_portable(&self) -> bool {
|
||||||
|
crate::config::get_relative_launcher_dir().exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_config_exist(&self) -> bool {
|
||||||
|
self.config.config_path().exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init_dirs(&self) {
|
||||||
|
let root = self.config.launcher_dir();
|
||||||
|
std::fs::create_dir_all(&root);
|
||||||
|
// instances assets libraries config.toml servers credentials
|
||||||
|
let mut instances = root.clone();
|
||||||
|
instances.push("instances");
|
||||||
|
|
||||||
|
let mut assets = root.clone();
|
||||||
|
assets.push("assets");
|
||||||
|
|
||||||
|
let mut libraries = root.clone();
|
||||||
|
libraries.push("libraries");
|
||||||
|
|
||||||
|
let mut servers = root.clone();
|
||||||
|
servers.push("servers");
|
||||||
|
|
||||||
|
let mut credentials = root.clone();
|
||||||
|
credentials.push("credentials");
|
||||||
|
|
||||||
|
std::fs::create_dir_all(&instances);
|
||||||
|
std::fs::create_dir_all(&assets);
|
||||||
|
std::fs::create_dir_all(&libraries);
|
||||||
|
std::fs::create_dir_all(&servers);
|
||||||
|
std::fs::create_dir_all(&credentials);
|
||||||
|
}
|
||||||
|
}
|
73
src/main.rs
73
src/main.rs
@ -1,6 +1,8 @@
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use config::LauncherConfig;
|
use config::LauncherConfig;
|
||||||
|
use launcher::Launcher;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
|
use tokio::sync::mpsc::{self, UnboundedReceiver, UnboundedSender};
|
||||||
use winit::application::ApplicationHandler;
|
use winit::application::ApplicationHandler;
|
||||||
@ -11,15 +13,17 @@ use winit::window::{Window, WindowId};
|
|||||||
use winit::event_loop::ActiveEventLoop;
|
use winit::event_loop::ActiveEventLoop;
|
||||||
use wry::dpi::LogicalSize;
|
use wry::dpi::LogicalSize;
|
||||||
use wry::http::{Request, Response};
|
use wry::http::{Request, Response};
|
||||||
use wry::{WebView, WebViewBuilder, WebViewBuilderExtWindows};
|
use wry::{RequestAsyncResponder, WebView, WebViewBuilder, WebViewBuilderExtWindows};
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
|
mod launcher;
|
||||||
|
mod util;
|
||||||
|
|
||||||
static SENDER: Mutex<Option<UnboundedSender<Request<String>>>> = Mutex::new(None);
|
static SENDER: Mutex<Option<UnboundedSender<(String, Option<UIMessage>, RequestAsyncResponder)>>> = Mutex::new(None);
|
||||||
static SENDERGUI: Mutex<Option<UnboundedSender<UIAction>>> = Mutex::new(None);
|
|
||||||
|
|
||||||
enum UIAction {
|
#[derive(Serialize, Deserialize)]
|
||||||
DoSomething
|
struct UIMessage {
|
||||||
|
params: Vec<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
@ -32,15 +36,16 @@ impl ApplicationHandler for App {
|
|||||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||||
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 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()
|
let webview = WebViewBuilder::new()
|
||||||
.with_html(include_str!("www/portable.html"))
|
|
||||||
.with_asynchronous_custom_protocol("xcraft".into(), move |wid, request, responder| {
|
.with_asynchronous_custom_protocol("xcraft".into(), move |wid, request, responder| {
|
||||||
let uri = request.uri().to_string();
|
let uri = request.uri().to_string();
|
||||||
println!("GOTCHA");
|
println!("Body: {}", String::from_utf8(request.body().to_vec()).unwrap());
|
||||||
let response = "yeeah!".as_bytes();
|
if let Ok(msg) = serde_json::from_slice(request.body()) {
|
||||||
tokio::spawn(async move {
|
let _ = SENDER.lock().unwrap().as_ref().unwrap().send((uri, Some(msg), responder));
|
||||||
responder.respond(Response::new(response));
|
return;
|
||||||
});
|
}
|
||||||
})
|
let _ = SENDER.lock().unwrap().as_ref().unwrap().send((uri, None, responder));
|
||||||
|
})
|
||||||
|
.with_url("xcraft://custom/ui")
|
||||||
.build(&window)
|
.build(&window)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -62,21 +67,49 @@ impl ApplicationHandler for App {
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let (snd, mut receiver) = mpsc::unbounded_channel();
|
|
||||||
|
|
||||||
*SENDER.lock().unwrap() = Some(snd);
|
|
||||||
|
|
||||||
let event_loop = EventLoop::new().unwrap();
|
let event_loop = EventLoop::new().unwrap();
|
||||||
let mut app = App::default();
|
let mut app = App::default();
|
||||||
|
|
||||||
let rt = Runtime::new().unwrap();
|
let rt = Runtime::new().unwrap();
|
||||||
|
|
||||||
rt.spawn(async move {
|
rt.spawn(async move {
|
||||||
|
let (snd, mut receiver) = mpsc::unbounded_channel();
|
||||||
|
*SENDER.lock().unwrap() = Some(snd);
|
||||||
|
|
||||||
|
let mut launcher = Launcher::default();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if let Some(request) = receiver.recv().await {
|
if let Some((ui_action, params, responder)) = receiver.recv().await {
|
||||||
println!("Request: {}", request.body());
|
println!("Command: {}", ui_action);
|
||||||
SENDERGUI.lock().unwrap().as_ref().unwrap().send(UIAction::DoSomething);
|
println!("params: {}", params.is_some());
|
||||||
}
|
|
||||||
|
let ui_action = &ui_action[16..];
|
||||||
|
match ui_action {
|
||||||
|
"ui" => responder.respond(Response::new(include_str!("www/portable.html").as_bytes())),
|
||||||
|
"portable" => {
|
||||||
|
launcher.config.set_portable(true);
|
||||||
|
launcher.init_dirs();
|
||||||
|
}
|
||||||
|
"installation" => {
|
||||||
|
launcher.init_dirs();
|
||||||
|
}
|
||||||
|
"check_installation" => {
|
||||||
|
if launcher.is_portable() {
|
||||||
|
launcher.config.set_portable(true);
|
||||||
|
launcher.init_dirs();
|
||||||
|
if !launcher.is_config_exist() {
|
||||||
|
responder.respond(Response::new("show_login".as_bytes()))
|
||||||
|
} else {
|
||||||
|
responder.respond(Response::new("show_add".as_bytes()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"sign_up" => {
|
||||||
|
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
9
src/util.rs
Normal file
9
src/util.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use rand::{distr::Alphanumeric, Rng};
|
||||||
|
|
||||||
|
pub fn random_string(len: usize) -> String {
|
||||||
|
rand::rng()
|
||||||
|
.sample_iter(&Alphanumeric)
|
||||||
|
.take(len)
|
||||||
|
.map(char::from)
|
||||||
|
.collect()
|
||||||
|
}
|
4
src/www/font-awesome.min.css
vendored
Normal file
4
src/www/font-awesome.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -3,12 +3,12 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<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>
|
<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" />
|
<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>
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="flex bg-gray-100 h-screen">
|
<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 id="sidebar" class="flex h-screen bg-white w-16 flex-col justify-between border-e border-gray-100 hidden">
|
||||||
<div>
|
<div>
|
||||||
<div class="inline-flex size-16 items-center justify-center">
|
<div class="inline-flex size-16 items-center justify-center">
|
||||||
<a href="#" onclick="showSection(this, 'appearance')">
|
<a href="#" onclick="showSection(this, 'appearance')">
|
||||||
@ -126,19 +126,17 @@
|
|||||||
<p class="text-sm text-gray-500 mt-1">Installs Minecraft on your system for long-term use.</p>
|
<p class="text-sm text-gray-500 mt-1">Installs Minecraft on your system for long-term use.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="login-section" class="xsection bg-white shadow-lg rounded-xl p-6 w-96 text-center hidden">
|
<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>
|
<h2 class="text-2xl font-semibold text-gray-700">CraftX v1.0</h2>
|
||||||
|
|
||||||
<!-- Username -->
|
<!-- 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">
|
<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">
|
||||||
|
|
||||||
<!-- 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 -->
|
<!-- Sign In Button -->
|
||||||
<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">
|
class="mt-4 w-full bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition">
|
||||||
Sign In
|
Sign Up
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
@ -317,20 +315,26 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function runPortable() {
|
async function signUp() {
|
||||||
window.ipc.postMessage("run_portable");
|
$.post({url: "sign_up", data: JSON.stringify({ params: [$("#sign_up_username").val()] }) }, function(r) {
|
||||||
|
if( r.startsWith("show_") ) {
|
||||||
|
showSection(undefined, r.substring(5));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let response = await fetch('xcraft://data/fetch.json');
|
function runPortable() {
|
||||||
let data = await response.body;
|
console.log($.get("portable", function() {}));
|
||||||
alert(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function installMinecraft() {
|
function installMinecraft() {
|
||||||
window.ipc.postMessage("run_stadalone");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSection(obj, section) {
|
function showSection(obj, section) {
|
||||||
|
|
||||||
$(".menu-btn").each(function(i, d) {
|
$(".menu-btn").each(function(i, d) {
|
||||||
$(d).removeClass('bg-green-50');
|
$(d).removeClass('bg-green-50');
|
||||||
$(d).addClass('text-gray-500');
|
$(d).addClass('text-gray-500');
|
||||||
@ -344,6 +348,16 @@
|
|||||||
});
|
});
|
||||||
$("#"+section+"-section").removeClass('hidden');
|
$("#"+section+"-section").removeClass('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$( document ).ready(async function() {
|
||||||
|
|
||||||
|
$.get("check_installation", function(r) {
|
||||||
|
console.log(r);
|
||||||
|
if( r.startsWith("show_") ) {
|
||||||
|
showSection(undefined, r.substring(5));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user