Skip to content

Conversation

@alvaro-carlisbino
Copy link

@alvaro-carlisbino alvaro-carlisbino commented Jan 23, 2026

Pull Request: Auto-Updater Implementation and Version Display

Hi everyone, I'm Alvaro (aka Bryzzen on Discord), a developer from Brazil. Thank you for taking the time to review my PR

🚀 Summary

This PR implements a robust auto-update system using electron-updater, replacing the legacy manual check. It introduces an event-driven architecture for handling update flows (availability, progress, completion) and exposes the application version to the UI footer. Additionally, it enforces "Clean Code" standards by removing comments from refactored files and ensuring strict MVVM/Service separation where applicable.

🛠 Technical Implementation Details

1. Auto-Updater Engine (backend/updateManager.js)

  • Dependency: Integrated electron-updater for handling GH Releases artifacts.
  • Architecture: Refactored from a poll-based class to an Event-Driven Class.
  • Logic:
    • autoDownload set to false for controlled UX (user sees popup -> downloads -> restarts).
    • Listeners mapped to IPC events: update-available, download-progress, update-downloaded, error.
    • Strict Policy: All code comments removed; logic is self-documenting.

2. IPC & Main Process (main.js & preload.js)

  • IPC Handlers:
    • check-for-updates: Triggers the check mechanism.
    • install-update: Calls autoUpdater.quitAndInstall().
    • get-app-version: Returns app.getVersion() for UI display.
  • ContextBridge: Exposed specific methods onUpdateProgress, onUpdateDownloaded, installUpdate to the renderer, maintaining security boundaries (Context Isolation).

3. Frontend / GUI (GUI/js/update.js, ui.js, index.html)

  • Update UI:
    • Refactored ClientUpdateManager to listen for new IPC events.
    • Added Real-time Progress Bar: Visualizes download-progress event data (percent, MB transferred/total).
    • Restart Flow: "Download" button transforms into "Restart & Install" upon update-downloaded.
  • Version Display:
    • Added footer span v<version> in index.html.
    • ui.js fetches version asynchronously on startup.

4. Configuration & CI/CD (package.json)

  • Publish Config: Added publish configuration for github provider (owner: amiayweb, repo: Hytale-F2P).
  • Semver Fix: Updated version 2.0.2b -> 2.0.3 to comply with semver standards required by electron-updater.

🧪 Testing

  • Dev Mode: Verified that autoUpdater skips checks locally (log: Skip checkForUpdates because application is not packed).
  • Production Build: Requires npm run build and a valid GitHub Release to fully end-to-end test download/install.
  • UI: Confirmed version v2.0.3 appears in the footer.

⚠️ Notes

  • Critical: To release, ensure the GitHub Token (GH_TOKEN) is set in the build environment or the release is drafted publicly.
  • Semver: Future versions must strictly follow MAJOR.MINOR.PATCH (e.g., 2.0.4) to function with the updater.

@fazrigading fazrigading added the good first issue Good for newcomers 👶 label Jan 23, 2026
@fazrigading fazrigading requested review from amiayweb and fazrigading and removed request for amiayweb January 23, 2026 15:33
…to-updater-implementation

# Conflicts:
#	GUI/js/update.js
#	package-lock.json
#	package.json
#	preload.js
@fazrigading
Copy link
Collaborator

Thank you so much for the contribution! We're currently pushing the next launcher version for latest update 'release' and 'pre-release' on Hytale official. We'll look through your PR after it. Stay tune!

@fazrigading fazrigading removed their request for review February 2, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue Good for newcomers 👶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants