mirror of
https://gitea.shironeko-all.duckdns.org/shironeko/Hytale-F2P-2.git
synced 2026-02-26 10:41:46 -03:00
Add Java path configuration and input handling
- Introduced a new input field for Java path in the launcher UI. - Updated the main process to handle saving and loading of the Java path. - Enhanced game launch functionality to accept a Java path parameter. - Added Java detection logic to find the Java executable on the system. - Created a .gitignore file to exclude build artifacts and dependencies.
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
dist/*
|
||||
node_modules/*
|
||||
@@ -10,6 +10,7 @@ const crypto = require('crypto');
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
const execFileAsync = promisify(execFile);
|
||||
const JAVA_EXECUTABLE = 'java' + (process.platform === 'win32' ? '.exe' : '');
|
||||
|
||||
function getAppDir() {
|
||||
const home = os.homedir();
|
||||
@@ -29,6 +30,182 @@ const GAME_DIR = path.join(APP_DIR, 'release', 'package', 'game', 'latest');
|
||||
const JRE_DIR = path.join(APP_DIR, 'release', 'package', 'jre', 'latest');
|
||||
const CONFIG_FILE = path.join(APP_DIR, 'config.json');
|
||||
|
||||
function expandHome(inputPath) {
|
||||
if (!inputPath) {
|
||||
return inputPath;
|
||||
}
|
||||
if (inputPath === '~') {
|
||||
return os.homedir();
|
||||
}
|
||||
if (inputPath.startsWith('~/') || inputPath.startsWith('~\\')) {
|
||||
return path.join(os.homedir(), inputPath.slice(2));
|
||||
}
|
||||
return inputPath;
|
||||
}
|
||||
|
||||
function loadConfig() {
|
||||
try {
|
||||
if (fs.existsSync(CONFIG_FILE)) {
|
||||
return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Notice: could not load config:', err.message);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
function saveConfig(update) {
|
||||
try {
|
||||
createFolders();
|
||||
const config = loadConfig();
|
||||
const next = { ...config, ...update };
|
||||
fs.writeFileSync(CONFIG_FILE, JSON.stringify(next, null, 2), 'utf8');
|
||||
} catch (err) {
|
||||
console.log('Notice: could not save config:', err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function findJavaOnPath(commandName = 'java') {
|
||||
const lookupCmd = process.platform === 'win32' ? 'where' : 'which';
|
||||
try {
|
||||
const { stdout } = await execFileAsync(lookupCmd, [commandName]);
|
||||
const line = stdout.split(/\r?\n/).map(lineItem => lineItem.trim()).find(Boolean);
|
||||
return line || null;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function getMacJavaHome() {
|
||||
if (process.platform !== 'darwin') {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const { stdout } = await execFileAsync('/usr/libexec/java_home');
|
||||
const home = stdout.trim();
|
||||
if (!home) {
|
||||
return null;
|
||||
}
|
||||
return path.join(home, 'bin', JAVA_EXECUTABLE);
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveJavaPath(inputPath) {
|
||||
const trimmed = (inputPath || '').trim();
|
||||
if (!trimmed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const expanded = expandHome(trimmed);
|
||||
if (fs.existsSync(expanded)) {
|
||||
const stat = fs.statSync(expanded);
|
||||
if (stat.isDirectory()) {
|
||||
const candidate = path.join(expanded, 'bin', JAVA_EXECUTABLE);
|
||||
return fs.existsSync(candidate) ? candidate : null;
|
||||
}
|
||||
return expanded;
|
||||
}
|
||||
|
||||
if (!path.isAbsolute(expanded)) {
|
||||
return await findJavaOnPath(trimmed);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function detectSystemJava() {
|
||||
const envHome = process.env.JAVA_HOME;
|
||||
if (envHome) {
|
||||
const envJava = path.join(envHome, 'bin', JAVA_EXECUTABLE);
|
||||
if (fs.existsSync(envJava)) {
|
||||
return envJava;
|
||||
}
|
||||
}
|
||||
|
||||
const macJava = await getMacJavaHome();
|
||||
if (macJava && fs.existsSync(macJava)) {
|
||||
return macJava;
|
||||
}
|
||||
|
||||
const pathJava = await findJavaOnPath('java');
|
||||
if (pathJava && fs.existsSync(pathJava)) {
|
||||
return pathJava;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
async function getJavaDetection() {
|
||||
const candidates = [];
|
||||
const bundledJava = getBundledJavaPath() || path.join(JRE_DIR, 'bin', JAVA_EXECUTABLE);
|
||||
|
||||
candidates.push({
|
||||
label: 'Bundled JRE',
|
||||
path: bundledJava,
|
||||
exists: fs.existsSync(bundledJava)
|
||||
});
|
||||
|
||||
const javaHomeEnv = process.env.JAVA_HOME;
|
||||
if (javaHomeEnv) {
|
||||
const envJava = path.join(javaHomeEnv, 'bin', JAVA_EXECUTABLE);
|
||||
candidates.push({
|
||||
label: 'JAVA_HOME',
|
||||
path: envJava,
|
||||
exists: fs.existsSync(envJava),
|
||||
note: fs.existsSync(envJava) ? '' : 'Not found'
|
||||
});
|
||||
} else {
|
||||
candidates.push({
|
||||
label: 'JAVA_HOME',
|
||||
path: '',
|
||||
exists: false,
|
||||
note: 'Not set'
|
||||
});
|
||||
}
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const macJava = await getMacJavaHome();
|
||||
if (macJava) {
|
||||
candidates.push({
|
||||
label: 'java_home',
|
||||
path: macJava,
|
||||
exists: fs.existsSync(macJava),
|
||||
note: fs.existsSync(macJava) ? '' : 'Not found'
|
||||
});
|
||||
} else {
|
||||
candidates.push({
|
||||
label: 'java_home',
|
||||
path: '',
|
||||
exists: false,
|
||||
note: 'Not found'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const pathJava = await findJavaOnPath('java');
|
||||
if (pathJava) {
|
||||
candidates.push({
|
||||
label: 'PATH',
|
||||
path: pathJava,
|
||||
exists: true
|
||||
});
|
||||
} else {
|
||||
candidates.push({
|
||||
label: 'PATH',
|
||||
path: '',
|
||||
exists: false,
|
||||
note: 'java not found'
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
javaPath: loadJavaPath(),
|
||||
candidates
|
||||
};
|
||||
}
|
||||
|
||||
function getOS() {
|
||||
if (process.platform === 'win32') return 'windows';
|
||||
if (process.platform === 'darwin') return 'darwin';
|
||||
@@ -105,20 +282,40 @@ async function installButler() {
|
||||
return butlerPath;
|
||||
}
|
||||
|
||||
let url;
|
||||
let urls = [];
|
||||
const osName = getOS();
|
||||
const arch = getArch();
|
||||
if (osName === 'windows') {
|
||||
url = 'https://broth.itch.zone/butler/windows-amd64/LATEST/archive/default';
|
||||
urls = ['https://broth.itch.zone/butler/windows-amd64/LATEST/archive/default'];
|
||||
} else if (osName === 'darwin') {
|
||||
url = 'https://broth.itch.zone/butler/darwin-amd64/LATEST/archive/default';
|
||||
if (arch === 'arm64') {
|
||||
urls = [
|
||||
'https://broth.itch.zone/butler/darwin-arm64/LATEST/archive/default',
|
||||
'https://broth.itch.zone/butler/darwin-amd64/LATEST/archive/default'
|
||||
];
|
||||
} else {
|
||||
urls = ['https://broth.itch.zone/butler/darwin-amd64/LATEST/archive/default'];
|
||||
}
|
||||
} else if (osName === 'linux') {
|
||||
url = 'https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default';
|
||||
urls = ['https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default'];
|
||||
} else {
|
||||
throw new Error('Operating system not supported');
|
||||
}
|
||||
|
||||
console.log('Fetching Butler tool...');
|
||||
let lastError = null;
|
||||
for (const url of urls) {
|
||||
try {
|
||||
await downloadFile(url, zipPath);
|
||||
lastError = null;
|
||||
break;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
}
|
||||
}
|
||||
if (lastError) {
|
||||
throw lastError;
|
||||
}
|
||||
|
||||
console.log('Unpacking Butler...');
|
||||
const zip = new AdmZip(zipPath);
|
||||
@@ -163,10 +360,9 @@ async function applyPWR(pwrFile, progressCallback) {
|
||||
const gameLatest = GAME_DIR;
|
||||
const stagingDir = path.join(gameLatest, 'staging-temp');
|
||||
|
||||
const gameClient = process.platform === 'win32' ? 'HytaleClient.exe' : 'HytaleClient';
|
||||
const clientPath = path.join(gameLatest, 'Client', gameClient);
|
||||
const clientPath = findClientPath(gameLatest);
|
||||
|
||||
if (fs.existsSync(clientPath)) {
|
||||
if (clientPath) {
|
||||
console.log('Game files detected, skipping patch installation.');
|
||||
return;
|
||||
}
|
||||
@@ -235,8 +431,8 @@ async function downloadJRE(progressCallback) {
|
||||
const osName = getOS();
|
||||
const arch = getArch();
|
||||
|
||||
const javaBin = path.join(JRE_DIR, 'bin', 'java' + (process.platform === 'win32' ? '.exe' : ''));
|
||||
if (fs.existsSync(javaBin)) {
|
||||
const bundledJava = getBundledJavaPath();
|
||||
if (bundledJava) {
|
||||
console.log('Java runtime found, skipping download');
|
||||
return;
|
||||
}
|
||||
@@ -294,9 +490,14 @@ async function downloadJRE(progressCallback) {
|
||||
await extractJRE(cacheFile, JRE_DIR);
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
const java = path.join(JRE_DIR, 'bin', 'java');
|
||||
if (fs.existsSync(java)) {
|
||||
fs.chmodSync(java, 0o755);
|
||||
const javaCandidates = [
|
||||
path.join(JRE_DIR, 'bin', JAVA_EXECUTABLE),
|
||||
path.join(JRE_DIR, 'Contents', 'Home', 'bin', JAVA_EXECUTABLE)
|
||||
];
|
||||
for (const javaPath of javaCandidates) {
|
||||
if (fs.existsSync(javaPath)) {
|
||||
fs.chmodSync(javaPath, 0o755);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,31 +584,93 @@ function flattenJREDir(jreLatest) {
|
||||
}
|
||||
}
|
||||
|
||||
function getJavaExec() {
|
||||
const javaBin = path.join(JRE_DIR, 'bin', 'java' + (process.platform === 'win32' ? '.exe' : ''));
|
||||
function getBundledJavaPath() {
|
||||
const candidates = [
|
||||
path.join(JRE_DIR, 'bin', JAVA_EXECUTABLE)
|
||||
];
|
||||
|
||||
if (fs.existsSync(javaBin)) {
|
||||
return javaBin;
|
||||
if (process.platform === 'darwin') {
|
||||
candidates.push(path.join(JRE_DIR, 'Contents', 'Home', 'bin', JAVA_EXECUTABLE));
|
||||
}
|
||||
|
||||
for (const candidate of candidates) {
|
||||
if (fs.existsSync(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getJavaExec() {
|
||||
const bundledJava = getBundledJavaPath();
|
||||
if (bundledJava) {
|
||||
return bundledJava;
|
||||
}
|
||||
|
||||
console.log('Notice: Java runtime not found, using system default');
|
||||
return 'java';
|
||||
}
|
||||
|
||||
async function launchGame(playerName = 'Player', progressCallback) {
|
||||
function getClientCandidates(gameLatest) {
|
||||
const candidates = [];
|
||||
if (process.platform === 'win32') {
|
||||
candidates.push(path.join(gameLatest, 'Client', 'HytaleClient.exe'));
|
||||
} else if (process.platform === 'darwin') {
|
||||
candidates.push(path.join(gameLatest, 'Client', 'Hytale.app', 'Contents', 'MacOS', 'HytaleClient'));
|
||||
candidates.push(path.join(gameLatest, 'Client', 'HytaleClient'));
|
||||
} else {
|
||||
candidates.push(path.join(gameLatest, 'Client', 'HytaleClient'));
|
||||
}
|
||||
return candidates;
|
||||
}
|
||||
|
||||
function findClientPath(gameLatest) {
|
||||
const candidates = getClientCandidates(gameLatest);
|
||||
for (const candidate of candidates) {
|
||||
if (fs.existsSync(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
async function launchGame(playerName = 'Player', progressCallback, javaPathOverride) {
|
||||
createFolders();
|
||||
|
||||
saveUsername(playerName);
|
||||
|
||||
await downloadJRE(progressCallback);
|
||||
const configuredJava = (javaPathOverride !== undefined && javaPathOverride !== null
|
||||
? javaPathOverride
|
||||
: loadJavaPath() || '').trim();
|
||||
let javaBin = null;
|
||||
|
||||
const javaBin = getJavaExec();
|
||||
if (configuredJava) {
|
||||
javaBin = await resolveJavaPath(configuredJava);
|
||||
if (!javaBin) {
|
||||
throw new Error(`Configured Java path not found: ${configuredJava}`);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
await downloadJRE(progressCallback);
|
||||
} catch (error) {
|
||||
const fallback = await detectSystemJava();
|
||||
if (fallback) {
|
||||
javaBin = fallback;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (!javaBin) {
|
||||
javaBin = getJavaExec();
|
||||
}
|
||||
}
|
||||
|
||||
const gameLatest = GAME_DIR;
|
||||
const gameClient = process.platform === 'win32' ? 'HytaleClient.exe' : 'HytaleClient';
|
||||
const clientPath = path.join(gameLatest, 'Client', gameClient);
|
||||
let clientPath = findClientPath(gameLatest);
|
||||
|
||||
if (!fs.existsSync(clientPath)) {
|
||||
if (!clientPath) {
|
||||
if (progressCallback) {
|
||||
progressCallback('Fetching game files...', null, null, null, null);
|
||||
}
|
||||
@@ -416,8 +679,10 @@ async function launchGame(playerName = 'Player', progressCallback) {
|
||||
await applyPWR(pwrFile, progressCallback);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(clientPath)) {
|
||||
throw new Error(`Game client missing at path: ${clientPath}`);
|
||||
clientPath = findClientPath(gameLatest);
|
||||
if (!clientPath) {
|
||||
const attempted = getClientCandidates(gameLatest).join(', ');
|
||||
throw new Error(`Game client missing. Tried: ${attempted}`);
|
||||
}
|
||||
|
||||
const uuid = uuidv4();
|
||||
@@ -444,29 +709,29 @@ async function launchGame(playerName = 'Player', progressCallback) {
|
||||
}
|
||||
|
||||
function saveUsername(username) {
|
||||
try {
|
||||
createFolders();
|
||||
const config = { username: username || 'Player' };
|
||||
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), 'utf8');
|
||||
} catch (err) {
|
||||
console.log('Notice: could not save username:', err.message);
|
||||
}
|
||||
saveConfig({ username: username || 'Player' });
|
||||
}
|
||||
|
||||
function loadUsername() {
|
||||
try {
|
||||
if (fs.existsSync(CONFIG_FILE)) {
|
||||
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
||||
const config = loadConfig();
|
||||
return config.username || 'Player';
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('Notice: could not load username:', err.message);
|
||||
|
||||
function saveJavaPath(javaPath) {
|
||||
const trimmed = (javaPath || '').trim();
|
||||
saveConfig({ javaPath: trimmed });
|
||||
}
|
||||
return 'Player';
|
||||
|
||||
function loadJavaPath() {
|
||||
const config = loadConfig();
|
||||
return config.javaPath || '';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
launchGame,
|
||||
saveUsername,
|
||||
loadUsername
|
||||
loadUsername,
|
||||
saveJavaPath,
|
||||
loadJavaPath,
|
||||
getJavaDetection
|
||||
};
|
||||
|
||||
28
index.html
28
index.html
@@ -255,6 +255,18 @@
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="w-[28rem]">
|
||||
<label class="block font-mono text-xs text-gray-400 mb-2 uppercase tracking-wider">
|
||||
Java Path (optional)
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="javaPath"
|
||||
class="input-field w-full rounded-lg px-4 py-3 text-white font-mono text-sm focus:outline-none"
|
||||
placeholder="/Library/Java/JavaVirtualMachines/.../bin/java"
|
||||
>
|
||||
</div>
|
||||
|
||||
<button
|
||||
id="playBtn"
|
||||
onclick="launch()"
|
||||
@@ -309,6 +321,7 @@
|
||||
const playBtn = document.getElementById('playBtn');
|
||||
const playText = document.getElementById('playText');
|
||||
const playerNameInput = document.getElementById('playerName');
|
||||
const javaPathInput = document.getElementById('javaPath');
|
||||
const progressText = document.getElementById('progressText');
|
||||
const progressPercent = document.getElementById('progressPercent');
|
||||
const progressSpeed = document.getElementById('progressSpeed');
|
||||
@@ -318,11 +331,17 @@
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
const savedUsername = await window.electronAPI.loadUsername();
|
||||
const [savedUsername, javaPath] = await Promise.all([
|
||||
window.electronAPI.loadUsername(),
|
||||
window.electronAPI.loadJavaPath()
|
||||
]);
|
||||
if (savedUsername) {
|
||||
playerNameInput.value = savedUsername;
|
||||
username = savedUsername;
|
||||
}
|
||||
if (typeof javaPath === 'string') {
|
||||
javaPathInput.value = javaPath;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load username:', error);
|
||||
} finally {
|
||||
@@ -374,8 +393,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
javaPathInput.addEventListener('input', async () => {
|
||||
await window.electronAPI.saveJavaPath(javaPathInput.value.trim());
|
||||
});
|
||||
|
||||
async function launch() {
|
||||
const playerName = playerNameInput.value.trim() || 'Player';
|
||||
const javaPath = javaPathInput.value.trim();
|
||||
|
||||
await window.electronAPI.saveUsername(playerName);
|
||||
|
||||
@@ -386,7 +410,7 @@
|
||||
playText.textContent = 'PROCESSING...';
|
||||
|
||||
try {
|
||||
const result = await window.electronAPI.launchGame(playerName);
|
||||
const result = await window.electronAPI.launchGame(playerName, javaPath);
|
||||
|
||||
if (result.success) {
|
||||
progressText.textContent = 'Game started!';
|
||||
|
||||
15
main.js
15
main.js
@@ -1,6 +1,6 @@
|
||||
const { app, BrowserWindow, ipcMain } = require('electron');
|
||||
const path = require('path');
|
||||
const { launchGame, saveUsername, loadUsername } = require('./backend/launcher');
|
||||
const { launchGame, saveUsername, loadUsername, saveJavaPath, loadJavaPath } = require('./backend/launcher');
|
||||
|
||||
let mainWindow;
|
||||
|
||||
@@ -61,7 +61,7 @@ app.on('window-all-closed', () => {
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('launch-game', async (event, playerName) => {
|
||||
ipcMain.handle('launch-game', async (event, playerName, javaPath) => {
|
||||
try {
|
||||
const progressCallback = (message, percent, speed, downloaded, total) => {
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
@@ -76,7 +76,7 @@ ipcMain.handle('launch-game', async (event, playerName) => {
|
||||
}
|
||||
};
|
||||
|
||||
await launchGame(playerName, progressCallback);
|
||||
await launchGame(playerName, progressCallback, javaPath);
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
@@ -102,3 +102,12 @@ ipcMain.handle('save-username', (event, username) => {
|
||||
ipcMain.handle('load-username', () => {
|
||||
return loadUsername();
|
||||
});
|
||||
|
||||
ipcMain.handle('save-java-path', (event, javaPath) => {
|
||||
saveJavaPath(javaPath);
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
ipcMain.handle('load-java-path', () => {
|
||||
return loadJavaPath();
|
||||
});
|
||||
|
||||
59
package-lock.json
generated
59
package-lock.json
generated
@@ -703,7 +703,6 @@
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
@@ -930,6 +929,7 @@
|
||||
"integrity": "sha512-+25nxyyznAXF7Nef3y0EbBeqmGZgeN/BxHX29Rs39djAfaFalmQ89SE6CWyDCHzGL0yt/ycBtNOmGTW0FyGWNw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"archiver-utils": "^2.1.0",
|
||||
"async": "^3.2.4",
|
||||
@@ -949,6 +949,7 @@
|
||||
"integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"glob": "^7.1.4",
|
||||
"graceful-fs": "^4.2.0",
|
||||
@@ -971,6 +972,7 @@
|
||||
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
@@ -986,7 +988,8 @@
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/archiver-utils/node_modules/string_decoder": {
|
||||
"version": "1.1.1",
|
||||
@@ -994,6 +997,7 @@
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
@@ -1105,6 +1109,7 @@
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
@@ -1474,6 +1479,7 @@
|
||||
"integrity": "sha512-D3uMHtGc/fcO1Gt1/L7i1e33VOvD4A9hfQLP+6ewd+BvG/gQ84Yh4oftEhAdjSMgBgwGL+jsppT7JYNpo6MHHg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"buffer-crc32": "^0.2.13",
|
||||
"crc32-stream": "^4.0.2",
|
||||
@@ -1563,6 +1569,7 @@
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
@@ -1576,6 +1583,7 @@
|
||||
"integrity": "sha512-NT7w2JVU7DFroFdYkeq8cywxrgjPHWkdX1wjpRQXPX5Asews3tA+Ght6lddQO5Mkumffp3X7GEqku3epj2toIw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"crc-32": "^1.2.0",
|
||||
"readable-stream": "^3.4.0"
|
||||
@@ -1935,6 +1943,7 @@
|
||||
"integrity": "sha512-oHkV0iogWfyK+ah9ZIvMDpei1m9ZRpdXcvde1wTpra2U8AFDNNpqJdnin5z+PM1GbQ5BoaKCWas2HSjtR0HwMg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"app-builder-lib": "24.13.3",
|
||||
"archiver": "^5.3.1",
|
||||
@@ -1948,6 +1957,7 @@
|
||||
"integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^6.0.1",
|
||||
@@ -1963,6 +1973,7 @@
|
||||
"integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"universalify": "^2.0.0"
|
||||
},
|
||||
@@ -1976,6 +1987,7 @@
|
||||
"integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 10.0.0"
|
||||
}
|
||||
@@ -2307,7 +2319,8 @@
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "8.1.0",
|
||||
@@ -2803,7 +2816,8 @@
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/isbinaryfile": {
|
||||
"version": "5.0.7",
|
||||
@@ -2940,6 +2954,7 @@
|
||||
"integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.0.5"
|
||||
},
|
||||
@@ -2953,6 +2968,7 @@
|
||||
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
@@ -2968,7 +2984,8 @@
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lazystream/node_modules/string_decoder": {
|
||||
"version": "1.1.1",
|
||||
@@ -2976,6 +2993,7 @@
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
@@ -2992,35 +3010,40 @@
|
||||
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
|
||||
"integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lodash.difference": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz",
|
||||
"integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lodash.flatten": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz",
|
||||
"integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lodash.union": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz",
|
||||
"integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/lowercase-keys": {
|
||||
"version": "2.0.0",
|
||||
@@ -3197,6 +3220,7 @@
|
||||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -3330,7 +3354,8 @@
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/progress": {
|
||||
"version": "2.0.3",
|
||||
@@ -3420,6 +3445,7 @@
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
@@ -3435,6 +3461,7 @@
|
||||
"integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"minimatch": "^5.1.0"
|
||||
}
|
||||
@@ -3517,7 +3544,8 @@
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
@@ -3716,6 +3744,7 @@
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
@@ -3826,6 +3855,7 @@
|
||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
@@ -3983,7 +4013,8 @@
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "9.0.1",
|
||||
@@ -4149,6 +4180,7 @@
|
||||
"integrity": "sha512-9qv4rlDiopXg4E69k+vMHjNN63YFMe9sZMrdlvKnCjlCRWeCBswPPMPUfx+ipsAWq1LXHe70RcbaHdJJpS6hyQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"archiver-utils": "^3.0.4",
|
||||
"compress-commons": "^4.1.2",
|
||||
@@ -4164,6 +4196,7 @@
|
||||
"integrity": "sha512-KVgf4XQVrTjhyWmx6cte4RxonPLR9onExufI1jhvw/MQ4BB6IsZD5gT8Lq+u/+pRkWna/6JoHpiQioaqFP5Rzw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"glob": "^7.2.3",
|
||||
"graceful-fs": "^4.2.0",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
launchGame: (playerName) => ipcRenderer.invoke('launch-game', playerName),
|
||||
launchGame: (playerName, javaPath) => ipcRenderer.invoke('launch-game', playerName, javaPath),
|
||||
closeWindow: () => ipcRenderer.invoke('window-close'),
|
||||
minimizeWindow: () => ipcRenderer.invoke('window-minimize'),
|
||||
saveUsername: (username) => ipcRenderer.invoke('save-username', username),
|
||||
loadUsername: () => ipcRenderer.invoke('load-username'),
|
||||
saveJavaPath: (javaPath) => ipcRenderer.invoke('save-java-path', javaPath),
|
||||
loadJavaPath: () => ipcRenderer.invoke('load-java-path'),
|
||||
onProgressUpdate: (callback) => {
|
||||
ipcRenderer.on('progress-update', (event, data) => callback(data));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user