Add generic file sync and improve UI for game launch

Introduced GenericFilesService to fetch and validate required game files before launching. Updated launcher version to beta and added support for AuthlibInjector agent in launch options. Improved avatar rendering and button states in the UI, including pixelated avatar display and disabled state handling for logout during game launch.
This commit is contained in:
2026-01-25 23:22:08 +01:00
parent 31fbf19189
commit 6f2e5f81a8
6 changed files with 146 additions and 10 deletions

View File

@@ -54,6 +54,8 @@ main > aside > nav > button:first-of-type > img {
width: 60px;
height: 60px;
border-radius: 5px;
image-rendering: pixelated;
image-rendering: crisp-edges;
}
main > aside > nav > button:nth-child(2) {
@@ -70,7 +72,7 @@ main > aside > nav > button:last-child {
margin-bottom: 0;
}
main > aside > nav > button:has(> i.fas.fa-sign-out-alt):hover {
main > aside > nav > button:has(> i.fas.fa-sign-out-alt):not(:disabled):hover {
color: #ff4747;
}
@@ -124,6 +126,11 @@ button.play:disabled {
filter: grayscale(100%);
}
button.logout:disabled {
cursor: not-allowed;
filter: brightness(0.70);
}
button.play > i {
margin-right: 5px;
font-size: 14px;

View File

@@ -3,6 +3,7 @@ const dynmapFrame = document.querySelector("article.frame.dynmap > iframe")
const capesSelector = document.querySelector("article.capes > div.capes")
const logsContainer = document.querySelector("div.container.logs")
const playButton = document.querySelector("button.play")
const logoutButton = document.querySelector("button.logout")
let viewerInstance = new skinview3d.SkinViewer({
canvas: document.getElementById("skin"),
@@ -43,7 +44,29 @@ window.getPlayer = async function getPlayer() {
return result
}
window.displayMinecraftHead = function displayMinecraftHead(skinUrl, targetImg) {
const canvas = document.createElement("canvas")
const ctx = canvas.getContext("2d")
const skinImg = new Image()
skinImg.crossOrigin = "anonymous"
skinImg.onload = function() {
canvas.width = 8
canvas.height = 8
ctx.imageSmoothingEnabled = false
ctx.drawImage(skinImg, 8, 8, 8, 8, 0, 0, 8, 8)
ctx.drawImage(skinImg, 40, 8, 8, 8, 0, 0, 8, 8)
document.querySelector(targetImg).src = canvas.toDataURL()
}
skinImg.src = skinUrl
}
window.profile = await getPlayer()
displayMinecraftHead(`https://yggdrasil.azures.fr/textures/${profile.skins.find(skin => skin.state == "ACTIVE").url.replace(/^\//, "")}`, "img.avatar")
window.refreshProfile = async function refreshProfile() {
window.profile = await getPlayer()
@@ -97,13 +120,16 @@ window.initSkin = async function initSkin() {
return
}
const skinUrl = `https://yggdrasil.azures.fr/textures/${profile.skins.find(skin => skin.state == "ACTIVE").url.replace(/^\//, "")}`
viewerInstance = new skinview3d.SkinViewer({
canvas: document.getElementById("skin"),
width: container.clientWidth,
height: container.clientHeight,
skin: `https://yggdrasil.azures.fr/textures/${profile.skins.find(skin => skin.state == "ACTIVE").url.replace(/^\//, "")}`
skin: skinUrl
})
displayMinecraftHead(skinUrl, "img.avatar")
const activeCape = window.profile.capes.find(s => s.state === "ACTIVE") || null
const capeUrl = activeCape == null ? null : `https://yggdrasil.azures.fr/textures/${activeCape.url.replace(/^\//, "")}?t=${Date.now()}`
@@ -147,6 +173,7 @@ window.validateSkinSelection = async function validateSkinSelection(localPath) {
if (activeSkin) {
const skinUrl = `https://yggdrasil.azures.fr/textures/${activeSkin.url.replace(/^\//, "")}?t=${Date.now()}`
const capeUrl = activeCape == null ? null : `https://yggdrasil.azures.fr/textures/${activeCape.url.replace(/^\//, "")}?t=${Date.now()}`
displayMinecraftHead(skinUrl, "img.avatar")
await viewerInstance.loadSkin(skinUrl, {
model: variant.toLowerCase() === "slim" ? "slim" : "default"
})
@@ -246,12 +273,14 @@ window.play = async function play() {
gamelog.clear()
showLoadingBar()
playButton.setAttribute("disabled", "")
logoutButton.setAttribute("disabled", "")
const gameLaunch = await system.call("launcher::game")
if (gameLaunch.success) {
hideLoadingBar()
} else {
hideLoadingBar()
playButton.removeAttribute("disabled")
logoutButton.removeAttribute("disabled")
}
}

View File

@@ -11,7 +11,7 @@
<aside>
<nav>
<button frame="profile" onclick="showPage(this.getAttribute('frame'))">
<img src="https://minotar.net/helm/BOBsonic576" alt="">
<img class="avatar" src="" alt="">
</button>
<button frame="game" onclick="showPage(this.getAttribute('frame'))">
<i class="fas fa-gamepad"></i>
@@ -25,7 +25,7 @@
<button frame="dynmap" onclick="initDynmap(); showPage(this.getAttribute('frame'))">
<i class="fas fa-map"></i>
</button>
<button onclick="system.call('auth::logout')">
<button class="logout" onclick="system.call('auth::logout')">
<i class="fas fa-sign-out-alt"></i>
</button>
</nav>