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", "checkBanStatus": "/api/v1/ban/iam",
"telemetry": "/api/v1/telemetry", "telemetry": "/api/v1/telemetry",
"gameFiles": "/api/v1/file/game", "gameFiles": "/api/v1/file/game",
"downloadFile": "/api/v1/file/game/download" "downloadFile": "/api/v1/file/game/download",
"countdown": "/api/v1/countdown"
}, },
"websockets": { "websockets": {
"base": { "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(() => { app.whenReady().then(() => {
createLauncherWindow() createLauncherWindow()
app.on("activate", async () => { app.on("activate", async () => {
@ -189,8 +200,18 @@ ipcMain.on("call", async (event, data) => {
if (data.args.trim() != "") { if (data.args.trim() != "") {
auth = Authenticator.getAuth(data.args.username, data.args.password) auth = Authenticator.getAuth(data.args.username, data.args.password)
launcherSettings.set("auth", { token: (await auth).access_token, type: "mojang", clientToken: (await auth).client_token }) 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}`) if (await checkCoutdown((await auth).uuid)) {
await launcherWindow.loadFile(path.join(__dirname, "app", "logged.html")) 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 { } else {
dialog.showErrorBox("Erreur", "Le mot de passe n'est pas défini. Les comptes crackés ne sont pas supporté par le launcher.") 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() auth = token.mclc()
console.log(auth.meta) console.log(auth.meta)
launcherSettings.set("auth", { token: auth.meta, type: "msa", clientToken: auth.client_token }) launcherSettings.set("auth", { token: auth.meta, type: "msa", clientToken: auth.client_token })
launcherWindow.loadFile(path.join(__dirname, "app", "logged.html")) if (await checkCoutdown(auth.uuid)) {
fetch(`${config.api.base}${config.api.endpoints.telemetry}/${hwid.getHWID()}/${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) { } catch (error) {
console.error(error) console.error(error)
if (error == "error.gui.closed") { if (error == "error.gui.closed") {

View File

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