mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-03-02 00:31:51 -03:00
v2.4.8: UI improvements, update popup fixes, per-profile branch tracking
- Fix auto-update popup: indeterminate progress fallback when no download events, show 100% on complete - Remove macOS auto-update warning (app is now signed) - Disable update popup pulse animation - Remove news tab and news section from home screen - Center play section vertically, add community links with colored icons - Add game version + branch display on play page (from manifest) - Add last played timestamp tracking - Version badge links to git.sanhost.net releases - Profiles now store version_branch and version_client per-configuration - Profile switch restores branch/version and refreshes settings UI - DevTools enabled in dev mode (electron . --dev) - Reorder community links: Chat, Discord, TG Channel, TG Group, Source Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const {
|
||||
loadConfig,
|
||||
saveConfig,
|
||||
getModsPath
|
||||
const {
|
||||
loadConfig,
|
||||
saveConfig,
|
||||
getModsPath,
|
||||
loadVersionBranch,
|
||||
saveVersionBranch,
|
||||
loadVersionClient,
|
||||
saveVersionClient
|
||||
} = require('../core/config');
|
||||
|
||||
// Lazy-load modManager to avoid circular deps, or keep imports structured.
|
||||
@@ -39,11 +43,13 @@ class ProfileManager {
|
||||
name: 'Default',
|
||||
created: new Date().toISOString(),
|
||||
lastUsed: new Date().toISOString(),
|
||||
|
||||
|
||||
// settings specific to this profile
|
||||
// If global settings existed, we copy them here
|
||||
mods: config.installedMods || [], // Legacy mods are now part of default profile
|
||||
javaPath: config.javaPath || '',
|
||||
versionBranch: config.version_branch || 'release',
|
||||
versionClient: config.version_client || null,
|
||||
gameOptions: {
|
||||
minMemory: '1G',
|
||||
maxMemory: '4G',
|
||||
@@ -73,13 +79,16 @@ class ProfileManager {
|
||||
const config = loadConfig();
|
||||
const id = uuidv4();
|
||||
|
||||
// New profiles inherit the current branch/version
|
||||
const newProfile = {
|
||||
id,
|
||||
name: name.trim(),
|
||||
created: new Date().toISOString(),
|
||||
lastUsed: null,
|
||||
mods: [], // Start with no mods enabled
|
||||
javaPath: '',
|
||||
javaPath: '',
|
||||
versionBranch: loadVersionBranch(),
|
||||
versionClient: loadVersionClient(),
|
||||
gameOptions: {
|
||||
minMemory: '1G',
|
||||
maxMemory: '4G',
|
||||
@@ -128,20 +137,35 @@ class ProfileManager {
|
||||
}
|
||||
|
||||
console.log(`[ProfileManager] Switching to profile: ${config.profiles[id].name} (${id})`);
|
||||
|
||||
// 1. Update config first
|
||||
|
||||
// Save current branch/version to the outgoing profile
|
||||
const oldId = config.activeProfileId;
|
||||
if (oldId && config.profiles[oldId]) {
|
||||
config.profiles[oldId].versionBranch = loadVersionBranch();
|
||||
config.profiles[oldId].versionClient = loadVersionClient();
|
||||
}
|
||||
|
||||
// 1. Update config
|
||||
config.profiles[id].lastUsed = new Date().toISOString();
|
||||
saveConfig({
|
||||
saveConfig({
|
||||
activeProfileId: id,
|
||||
profiles: config.profiles
|
||||
profiles: config.profiles
|
||||
});
|
||||
|
||||
// 2. Trigger Mod Sync
|
||||
// We need to require this here to ensure it uses the *newly saved* active profile ID
|
||||
// 2. Restore branch/version from the new profile
|
||||
const newProfile = config.profiles[id];
|
||||
if (newProfile.versionBranch) {
|
||||
saveVersionBranch(newProfile.versionBranch);
|
||||
}
|
||||
if (newProfile.versionClient !== undefined) {
|
||||
saveVersionClient(newProfile.versionClient);
|
||||
}
|
||||
|
||||
// 3. Trigger Mod Sync
|
||||
const { syncModsForCurrentProfile } = require('./modManager');
|
||||
await syncModsForCurrentProfile();
|
||||
|
||||
return config.profiles[id];
|
||||
return newProfile;
|
||||
}
|
||||
|
||||
deleteProfile(id) {
|
||||
@@ -177,7 +201,7 @@ class ProfileManager {
|
||||
}
|
||||
|
||||
// Safety checks on updates
|
||||
const allowedFields = ['name', 'javaPath', 'gameOptions', 'mods'];
|
||||
const allowedFields = ['name', 'javaPath', 'gameOptions', 'mods', 'versionBranch', 'versionClient'];
|
||||
const sanitizedUpdates = {};
|
||||
|
||||
Object.keys(updates).forEach(key => {
|
||||
|
||||
Reference in New Issue
Block a user