2 Commits

Author SHA1 Message Date
gitea-actions c0d7d7ce4f ci: release v3.0.1 2026-06-17 20:15:31 +00:00
lucasdpt a7a4bce19f fix: fix problem when launcher is closed 2026-06-17 22:14:09 +02:00
4 changed files with 20 additions and 4 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "oflauncher",
"version": "3.0.0",
"version": "3.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "oflauncher",
"version": "3.0.0",
"version": "3.0.1",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "oflauncher",
"version": "3.0.0",
"version": "3.0.1",
"description": "Launcher Minecraft custom pour le modpack ATM10 (1.21.1 / NeoForge)",
"main": "./out/main/index.js",
"author": "OFLauncher",
+8 -1
View File
@@ -3,7 +3,7 @@ import { join } from 'path'
import { setMainWindow } from './events'
import { IPC, type UserSettings, type PlayOptions } from '../shared/ipc'
import { login, logout, restoreSession, getCurrent } from './auth'
import { play, stopGame } from './play'
import { play, stopGame, isGameRunning } from './play'
import { getPackMetaCached } from './modpack'
import { getSettings, setSettings } from './settings'
import { paths } from './paths'
@@ -35,6 +35,13 @@ function createWindow(): BrowserWindow {
win.on('ready-to-show', () => win.show())
win.on('close', (e) => {
if (isGameRunning()) {
e.preventDefault()
win.hide()
}
})
// Liens externes -> navigateur système.
win.webContents.setWindowOpenHandler(({ url }) => {
void shell.openExternal(url)
+9
View File
@@ -1,4 +1,5 @@
import type { ChildProcess } from 'child_process'
import { app, BrowserWindow } from 'electron'
import { getCurrent } from './auth'
import { fetchPackMeta } from './modpack'
import { ensureJava } from './java'
@@ -47,6 +48,10 @@ export async function play(opts?: PlayOptions): Promise<void> {
gameProcess = proc
proc.on('close', () => {
gameProcess = null
const allHidden = BrowserWindow.getAllWindows().every((w) => !w.isVisible())
if (allHidden) {
app.quit()
}
})
} catch (e) {
emit.progress({ phase: 'error', message: (e as Error).message, progress: undefined })
@@ -60,3 +65,7 @@ export function stopGame(): boolean {
gameProcess.kill()
return true
}
export function isGameRunning(): boolean {
return gameProcess !== null
}