Files
aego/modules/update/res/docs/api.md
sanspie d436311f69 Stage 11i4: signed self-updates for Aego and exported games (D362)
update core: signed release.json (Ed25519) per channel, ETag check, resumable download with sha256, Auto/Ask/Off policy, appliers for the install.sh layout, AppImage, NSIS installer (keeps the replaced setup.exe for Restore) and .app, trial run with rollback.
Editor and launcher: banner, status bar, Help commands, Task Center download, install on restart.
CLI: aego update, aego release keygen|manifest, aego export --release-json.
Games: modules/update with update { url publicKey }, settings and the aego/update script API.
release.sh refuses to publish without AEGO_RELEASE_KEY and AEGO_UPDATE_KEY; install.sh lays out versions; make test-update runs a real v1 -> v2 update.
2026-10-26 19:36:15 +03:00

44 lines
1.2 KiB
Markdown

---
id: aego/update
summary: Finds a newer version of the game on its update server, downloads it and restarts the game on it.
---
A game updates itself when `project.aego` names its update server and the key that signs its releases:
```
update {
url="https://example.com/mygame/updates"
publicKey="<the public key from aego release keygen>"
}
```
The server holds one folder per channel, `stable/release.json` and `nightly/release.json`, each with its `release.json.sig`. `aego export --release-json` writes both next to the exported archive. The game checks at start; in the Auto mode it downloads the new version in the background, and the Settings View gets **Updates** and **Update channel**. Nothing installs without a valid signature and checksum. The sandbox has no update server, so this example needs a project.
## Example
```aes check
package demo
import (
"aego/log"
"aego/update"
)
script UpdateBanner {
var shown bool
func Update(dt float) {
if !shown && update.State() == "ready" {
shown = true
log.Info("version " + update.Version() + " is ready: " + update.Notes())
}
}
func Restart() {
if update.State() == "ready" {
update.Apply()
}
}
}
```