mirror of
https://git.sanhost.net/sanasol/hytale-f2p.git
synced 2026-02-26 06:41:47 -03:00
Enforce 16-char player name limit and update mod sync
Added a maxlength attribute to the player name input and enforced a 16-character limit in both install and settings scripts, providing user feedback if exceeded. Refactored modManager.js to replace symlink-based mod management with a copy-based system, copying enabled mods to HytaleSaves\Mods and removing legacy symlink logic to improve compatibility and avoid permission issues.
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
<label class="form-label" data-i18n="install.playerName">Player Name</label>
|
||||
<input type="text" id="installPlayerName"
|
||||
data-i18n-placeholder="install.playerNamePlaceholder" class="form-input"
|
||||
value="Player" />
|
||||
value="Player" maxlength="16" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -45,9 +45,17 @@ export function setupInstallation() {
|
||||
export async function installGame() {
|
||||
if (isDownloading || (installBtn && installBtn.disabled)) return;
|
||||
|
||||
const playerName = (installPlayerName ? installPlayerName.value.trim() : '') || 'Player';
|
||||
let playerName = (installPlayerName ? installPlayerName.value.trim() : '') || 'Player';
|
||||
const installPath = installPathInput ? installPathInput.value.trim() : '';
|
||||
|
||||
// Limit player name to 16 characters
|
||||
if (playerName.length > 16) {
|
||||
playerName = playerName.substring(0, 16);
|
||||
if (installPlayerName) {
|
||||
installPlayerName.value = playerName;
|
||||
}
|
||||
}
|
||||
|
||||
const selectedBranchRadio = document.querySelector('input[name="installBranch"]:checked');
|
||||
const selectedBranch = selectedBranchRadio ? selectedBranchRadio.value : 'release';
|
||||
|
||||
@@ -194,7 +202,16 @@ export async function browseInstallPath() {
|
||||
async function savePlayerName() {
|
||||
try {
|
||||
if (window.electronAPI && window.electronAPI.saveSettings) {
|
||||
const playerName = (installPlayerName ? installPlayerName.value.trim() : '') || 'Player';
|
||||
let playerName = (installPlayerName ? installPlayerName.value.trim() : '') || 'Player';
|
||||
|
||||
// Limit player name to 16 characters
|
||||
if (playerName.length > 16) {
|
||||
playerName = playerName.substring(0, 16);
|
||||
if (installPlayerName) {
|
||||
installPlayerName.value = playerName;
|
||||
}
|
||||
}
|
||||
|
||||
await window.electronAPI.saveSettings({ playerName });
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -439,6 +439,13 @@ async function savePlayerName() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerName.length > 16) {
|
||||
const msg = window.i18n ? window.i18n.t('notifications.playerNameTooLong') : 'Player name must be 16 characters or less';
|
||||
showNotification(msg, 'error');
|
||||
settingsPlayerName.value = playerName.substring(0, 16);
|
||||
return;
|
||||
}
|
||||
|
||||
await window.electronAPI.saveUsername(playerName);
|
||||
const successMsg = window.i18n ? window.i18n.t('notifications.playerNameSaved') : 'Player name saved successfully';
|
||||
showNotification(successMsg, 'success');
|
||||
|
||||
Reference in New Issue
Block a user