This commit is contained in:
Gilles Lazures 2025-05-11 07:30:13 +02:00
parent 48c5fd4ead
commit 0c01e826d9
3 changed files with 50 additions and 15 deletions

View File

@ -6,7 +6,8 @@
"checkBanStatus": "/api/v1/ban/iam",
"telemetry": "/api/v1/telemetry",
"gameFiles": "/api/v1/file/game",
"downloadFile": "/api/v1/file/game/download"
"downloadFile": "/api/v1/file/game/download",
"countdown": "/api/v1/countdown"
},
"websockets": {
"base": {

39
main.js
View File

@ -133,6 +133,17 @@ async function checkIfIAmBanned() {
}
}
async function checkCoutdown(uuid) {
try {
const response = await fetch(`${config.api.base}${config.api.endpoints.countdown}/${uuid}`)
const json = await response.json()
console.log(json)
return json.success
} catch (error) {
return false
}
}
app.whenReady().then(() => {
createLauncherWindow()
app.on("activate", async () => {
@ -189,8 +200,18 @@ ipcMain.on("call", async (event, data) => {
if (data.args.trim() != "") {
auth = Authenticator.getAuth(data.args.username, data.args.password)
launcherSettings.set("auth", { token: (await auth).access_token, type: "mojang", clientToken: (await auth).client_token })
await fetch(`${config.api.base}${config.api.endpoints.telemetry}/${hwid.getHWID()}/${(await auth).uuid}`)
await launcherWindow.loadFile(path.join(__dirname, "app", "logged.html"))
if (await checkCoutdown((await auth).uuid)) {
await launcherWindow.loadFile(path.join(__dirname, "app", "logged.html"))
await fetch(`${config.api.base}${config.api.endpoints.telemetry}/${hwid.getHWID()}/${(await auth).uuid}`)
} else {
await launcherWindow.loadURL("https://nyancraft.catboat.fr")
await launcherWindow.webContents.insertCSS("a.download-button { display: none; } #return-button { app-region: no-drag } ")
await launcherWindow.webContents.executeJavaScript(`
const returnButton = document.querySelector(\"#return-button\")
returnButton.innerText = "Fermer le launcher"
returnButton.onclick = () => system.call("window::close")
`)
}
} else {
dialog.showErrorBox("Erreur", "Le mot de passe n'est pas défini. Les comptes crackés ne sont pas supporté par le launcher.")
}
@ -203,8 +224,18 @@ ipcMain.on("call", async (event, data) => {
auth = token.mclc()
console.log(auth.meta)
launcherSettings.set("auth", { token: auth.meta, type: "msa", clientToken: auth.client_token })
launcherWindow.loadFile(path.join(__dirname, "app", "logged.html"))
fetch(`${config.api.base}${config.api.endpoints.telemetry}/${hwid.getHWID()}/${auth.uuid}`)
if (await checkCoutdown(auth.uuid)) {
launcherWindow.loadFile(path.join(__dirname, "app", "logged.html"))
fetch(`${config.api.base}${config.api.endpoints.telemetry}/${hwid.getHWID()}/${auth.uuid}`)
} else {
await launcherWindow.loadURL("https://nyancraft.catboat.fr")
await launcherWindow.webContents.insertCSS("a.download-button { display: none; } #return-button { app-region: no-drag } ")
await launcherWindow.webContents.executeJavaScript(`
const returnButton = document.querySelector(\"#return-button\")
returnButton.innerText = "Fermer le launcher"
returnButton.onclick = () => system.call("window::close")
`)
}
} catch (error) {
console.error(error)
if (error == "error.gui.closed") {

View File

@ -3,19 +3,22 @@ const RPC = require("discord-rpc")
class DiscordRPC {
constructor() {
readonly: this.activity = {
details: "Actif dans le launcher",
details: "Officiel | Solva x Alcaz",
timestamps : { start: Date.now() },
assets: {
large_image: "logo",
large_text: "CatBoat Minecraft Launcher"
large_image: "rpc_catboat_large",
large_text: "CatBoat Launcher",
small_image : "alflamme_comm_legoshi",
small_text: "by TheAlfiTeam",
},
buttons: [
{
label: "Discord",
url: "https://discord.com/invite/catboat"
"label": "Discord",
"url": "https://discord.gg/catboat"
},
{
label: "CatBoat",
url: "https://catboat.fr/"
"label": "Download Launcher",
"url": "https://catboat.thealfigame.fr"
}
],
instance: true
@ -30,12 +33,12 @@ class DiscordRPC {
this.client.request("SET_ACTIVITY", { pid: process.pid, activity: this.activity })
console.log("The Discord Rich Presence has been set successfully.")
})
this.client.login({ clientId: "1365563093157154868" }).catch(e => {
console.log(e)
this.client.login({ clientId: "1259291027148115988" }).catch(e => {
console.log("Silent client detected: the activity status has been disabled.")
console.log(e)
this.isEnabled = false
}).then(r => this.isEnabled = true)
.catch(err => console.log)
.catch(err => console.log(err))
}
}