@@ -42,12 +43,25 @@
display: flex;
align-items: center;
justify-content: center;
+ position: relative;
+ overflow: hidden;
+ }
+
+ .background {
+ position: absolute;
+ top: 0;
+ left: 0;
+ height: 100%;
+ width: 100%;
+ background-size: cover;
+ filter: blur(3px);
+ z-index: -1;
}
.banner-text {
color: white;
font-weight: 600;
- font-size: 26px;
+ font-size: 20px;
}
.content {
From 3283534c62d0cdd7fa457a27c8078a35851b273f Mon Sep 17 00:00:00 2001
From: kawaiinekololis
Date: Thu, 21 Mar 2024 21:02:08 +0100
Subject: [PATCH 02/17] chore: update build workflow
---
.github/workflows/build.yml | 28 ++++++++--------------------
src-tauri/tauri.conf.json | 5 +++--
2 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index df4b228..d46c505 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,7 +1,7 @@
name: Build
on:
push:
- branches: [ tauri ]
+ branches: [ tauri_v2 ]
jobs:
build-tauri:
@@ -23,30 +23,18 @@ jobs:
node-version: 21
- name: install Rust
- uses: dtolnay/rust-toolchain@stable
+ uses: dtolnay/rust-toolchain@nightly
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
- sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libx11-dev xorg-dev libglu1-mesa-dev libglib2.0-0 libgtk2.0-dev
+ sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf
- - name: Cache cargo registry
- uses: actions/cache@v3
+ - name: Setup Cargo dependency cache
+ uses: Swatinem/rust-cache@v2
with:
- path: ~/.cargo/registry
- key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- - name: Cache cargo index
- uses: actions/cache@v3
- with:
- path: ~/.cargo/git
- key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
-
- - name: Cache tauri build
- uses: actions/cache@v3
- with:
- path: ./src-tauri/target
- key: ${{ runner.os }}-tauri-build-target-${{ hashFiles('**/Cargo.lock') }}
+ shared-key: shared
- name: install app dependencies and build it
run: yarn && yarn build
@@ -54,8 +42,8 @@ jobs:
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
- TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
- uses: actions/upload-artifact@v3
if: matrix.platform == 'ubuntu-latest'
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 8b0ae8d..5e06b40 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -47,14 +47,15 @@
"shortDescription": "A LiquidBounce launcher for Minecraft",
"longDescription": "A LiquidBounce hacked-client launcher for the game Minecraft",
"license": "GPL-3.0",
- "licenseFile": "LICENSE",
+ "licenseFile": "../LICENSE",
"resources": [],
"targets": [
"updater",
"msi",
"appimage",
"deb",
- "appimage"
+ "appimage",
+ "app"
],
"windows": {
"certificateThumbprint": null,
From 62f64f2b7adda736c4241680b21ac2050b00566b Mon Sep 17 00:00:00 2001
From: kawaiinekololis
Date: Thu, 21 Mar 2024 21:02:49 +0100
Subject: [PATCH 03/17] feat: hosts check on start-up
---
src-tauri/src/app/gui.rs | 14 ++++++++++--
src-tauri/src/minecraft/prelauncher.rs | 9 --------
src-tauri/src/utils/extract.rs | 2 +-
src-tauri/src/utils/hosts.rs | 29 ++++++++++++++-----------
src/lib/Window.svelte | 26 +++++++++++-----------
src/lib/common/social/ButtonIcon.svelte | 1 -
6 files changed, 42 insertions(+), 39 deletions(-)
diff --git a/src-tauri/src/app/gui.rs b/src-tauri/src/app/gui.rs
index 6da613d..3c38b60 100644
--- a/src-tauri/src/app/gui.rs
+++ b/src-tauri/src/app/gui.rs
@@ -44,7 +44,17 @@ async fn get_launcher_version() -> Result {
}
#[tauri::command]
-async fn check_online_status() -> Result<(), String> {
+async fn check_health() -> Result<(), String> {
+ // Check hosts
+ #[cfg(windows)]
+ {
+ use crate::utils::check_hosts_file;
+
+ info!("Checking hosts file...");
+ check_hosts_file().await
+ .map_err(|e| format!("{}", e))?;
+ }
+
info!("Checking online status");
HTTP_CLIENT.get("https://api.liquidbounce.net/")
.send().await
@@ -386,7 +396,7 @@ pub fn gui_main() {
runner_instance: Arc::new(Mutex::new(None))
})
.invoke_handler(tauri::generate_handler![
- check_online_status,
+ check_health,
get_options,
store_options,
request_branches,
diff --git a/src-tauri/src/minecraft/prelauncher.rs b/src-tauri/src/minecraft/prelauncher.rs
index b3524fb..a8fceeb 100644
--- a/src-tauri/src/minecraft/prelauncher.rs
+++ b/src-tauri/src/minecraft/prelauncher.rs
@@ -40,15 +40,6 @@ use crate::utils::{download_file, get_maven_artifact_path};
/// Prelaunching client
///
pub(crate) async fn launch(launch_manifest: LaunchManifest, launching_parameter: LaunchingParameter, additional_mods: Vec, progress: LauncherData, window: Arc>) -> Result<()> {
- // Check hosts
- #[cfg(windows)]
- {
- use crate::utils::check_hosts_file;
-
- info!("Checking hosts file...");
- check_hosts_file(&window).await?;
- }
-
info!("Loading minecraft version manifest...");
let mc_version_manifest = VersionManifest::fetch().await?;
diff --git a/src-tauri/src/utils/extract.rs b/src-tauri/src/utils/extract.rs
index 655cb32..3a05895 100644
--- a/src-tauri/src/utils/extract.rs
+++ b/src-tauri/src/utils/extract.rs
@@ -18,7 +18,7 @@
*/
use anyhow::{Result, Context};
-use std::{path::{Path, PathBuf}};
+use std::path::{Path, PathBuf};
use async_compression::tokio::bufread::GzipDecoder;
use async_zip::read::seek::ZipFileReader;
use tokio::fs::{create_dir_all, OpenOptions};
diff --git a/src-tauri/src/utils/hosts.rs b/src-tauri/src/utils/hosts.rs
index 683aa1e..494c460 100644
--- a/src-tauri/src/utils/hosts.rs
+++ b/src-tauri/src/utils/hosts.rs
@@ -1,16 +1,23 @@
-use std::sync::{Arc, Mutex};
+use std::env;
-use anyhow::{bail, Result};
-use tauri_plugin_shell::ShellExt;
+use anyhow::{bail, Context, Result};
+use tokio::fs;
-const HOSTS_PATH: &str = "C:\\Windows\\System32\\drivers\\etc\\hosts";
+const HOSTS_PATH: &str = "Windows\\System32\\drivers\\etc\\hosts";
+const HOSTS: [&str; 4] = ["mojang.com", "minecraft.net", "liquidbounce.net", "ccbluex.net"];
/// We have noticed many user have modified the hosts file to block the Minecraft authentication server.
/// This is likely by using a third-party program. Because LiquidLauncher requires access to the authentication server, we have to modify the hosts file to allow access.
/// we need to check the hosts file and alert the user if it has been modified.
-pub async fn check_hosts_file(window: &Arc>) -> Result<()> {
+pub async fn check_hosts_file() -> Result<()> {
+ // Get location of Windows hosts file dynamically
+ // "SystemDrive" env, if not assigned default to C:
+ let system_drive = env::var("SystemDrive").unwrap_or("C:".to_string());
+ let hosts_path = format!("{}\\{}", system_drive, HOSTS_PATH);
+
// Check if the hosts file has been modified
- let hosts_file = tokio::fs::read_to_string(HOSTS_PATH).await?;
+ let hosts_file = fs::read_to_string(&hosts_path).await
+ .context(format!("Failed to read hosts file at {}", hosts_path))?;
let flagged_entries = hosts_file.lines()
.filter(|line| {
@@ -27,16 +34,12 @@ pub async fn check_hosts_file(window: &Arc>) -> Result<()>
Some(domain) => domain,
None => return false,
};
-
- domain.contains("mojang.com") || domain.contains("minecraft.net")
+
+ HOSTS.iter().any(|&entry| domain.contains(entry))
})
.collect::>();
if !flagged_entries.is_empty() {
- // Open guide on how to remove the entries
- window.lock().unwrap()
- .shell().open("https://liquidbounce.net/docs/Tutorials/Fixing%20hosts%20file%20issues", None)?;
-
bail!(
"The hosts file has been modified to block the Minecraft authentication server.\n\
\n\
@@ -45,7 +48,7 @@ pub async fn check_hosts_file(window: &Arc>) -> Result<()>
The file is located at:\n\
{}",
flagged_entries.join("\n"),
- HOSTS_PATH
+ hosts_path
);
}
diff --git a/src/lib/Window.svelte b/src/lib/Window.svelte
index 1c77f7a..1a4e0c0 100644
--- a/src/lib/Window.svelte
+++ b/src/lib/Window.svelte
@@ -44,26 +44,26 @@
// Logout from current account
function logout() {
// Revoke the actual session
- invoke("logout", { accountData: options.currentAccount }).catch((e) =>
- console.error(e),
- );
+ invoke("logout", { accountData: options.currentAccount }).catch(console.error);
// Remove account data from options data
options.currentAccount = null;
options.store();
}
- invoke("check_online_status")
- .then((result) => {
- console.debug("Status", result);
- })
+ // Check if the launcher is online and passes health checks
+ invoke("check_health")
+ .then(() => console.info("Health Check passed"))
.catch((e) => {
- alert(
- "You are offline! Please connect to the internet and restart the app.\n If this problem persists, please contact the developer.\n\n (Error: " +
- e +
- ")",
- );
- console.error(e);
+ let message = e;
+ if (message.startsWith('"')) message = message.slice(1);
+ if (message.endsWith('"')) message = message.slice(0, -1);
+
+ console.error(message);
+ alert(message.replace(/\\n/g, "\n"));
+
+ // Open help page
+ open("https://liquidbounce.net/docs/Tutorials/Fixing%20LiquidLauncher");
});
diff --git a/src/lib/common/social/ButtonIcon.svelte b/src/lib/common/social/ButtonIcon.svelte
index 5eb164d..d32995d 100644
--- a/src/lib/common/social/ButtonIcon.svelte
+++ b/src/lib/common/social/ButtonIcon.svelte
@@ -1,5 +1,4 @@