Updates
Configure update checks, install signed updates in the background, show "Update ready" with Reload now, choose prompt or silent mode, and handle update errors.
When you run ap push, buyers’ installed copies can update themselves. The
runtime finds the update, downloads it, verifies it and installs it. Your code
decides what the buyer sees.
AP.boot({ start: function (ctx) {}, updates: { check: "auto", mode: "background" } // the defaults});| Option | Values | Meaning |
|---|---|---|
mode |
"background" (default) |
Install as soon as an update is found, without asking. Then onInstalled fires: show Update ready with a Reload now button that calls AP.updates.reload(). |
"prompt" |
Tell your code through onAvailable; install only when your code calls AP.updates.install(info, cb) (for example from an Install button). Then onInstalled fires. |
|
"silent" |
Install like "background"; onInstalled fires with info.mode === "silent". Apps normally show nothing: the new version starts the next time the panel opens. |
|
check |
"auto" (default) |
Check when the app starts and every 6 hours. |
"manual" |
Check only when your code calls AP.updates.check(cb). |
Background is what buyers expect from AfterPresets extensions: the update is already installed when they hear about it, and one click restarts the panel on the new version.
To switch mode, change updates.mode in each panel’s src/panels/<id>/main.js
and keep the update screen (it handles every mode). Explain the tradeoffs to the
user before choosing another mode:
- prompt: buyers read the changelog first and can postpone a change, but many never click Install and stay on old versions.
- silent: no interruption, but buyers are not told what changed, and the old version keeps running until they reopen the panel or restart After Effects.
- Security is the same in every mode: every install checks the signature and
checksum and refuses anything unverified. Rollbacks by the seller
(
direction: "downgrade") install the same way.
AP.updates.onInstalled(function (info) {}); // an update was installed (any mode, any panel)AP.updates.onError(function (err) {}); // an automatic check or install failedAP.updates.onAvailable(function (info) {}); // prompt mode only: an update was foundAP.updates.reload(); // restart every open panel on the installed versionAP.updates.check(function (err, info) {}); // check nowAP.updates.install(info, function (err, result) {});Each on* call returns a function that removes the listener. Register
listeners before AP.boot so you do not miss the first automatic check.
AP.updates.reload()
Section titled “AP.updates.reload()”Reloads every open panel of this extension, then the current one, so the new
files run immediately (the runtime sends the internal event __ap.reload; each
other panel calls window.location.reload()). After the reload the new
main.js evaluates its embedded JSX again, so the ExtendScript functions are
the new ones too. Unsaved state in any open panel is lost: save
it first if your app has any. The runtime never reloads on its own.
info = { updateAvailable: true, version: "1.3.0", // the version that will be (or was) installed direction: "upgrade", // or "downgrade" when the seller rolled back changeLog: "Fixes export.", // notes for `version` only releaseNotes: [ // every release between the installed version and `version`, newest first { version: "1.3.0", changeLog: "Fixes export.", releaseDate: "2026-10-20T10:00:00.000Z" }, { version: "1.2.0", changeLog: "Adds presets.", releaseDate: "2026-10-01T09:00:00.000Z" } ] // onAvailable only: plus fields the install needs (downloadUrl, sha256, signature). // Pass `info` to install unchanged.};onInstalled receives { updateAvailable, version, direction, changeLog, releaseNotes, mode }, where mode is this panel’s mode ("background",
"prompt" or "silent"). AP.updates.check(cb) calls
cb(null, { updateAvailable: false }) when there is nothing new.
releaseNotes covers every release the buyer missed. Show all of them, not only
changeLog. Changelogs are Markdown written by the seller (the starter’s
update screen renders them with its Markdown helper): build DOM nodes with
textContent, never innerHTML, and open links only through
AP.license.openUrl(url) (http and https), so a click never navigates the panel.
Background mode: “Update ready” and Reload now
Section titled “Background mode: “Update ready” and Reload now”Show a popup from onInstalled with the notes, a primary Reload now button
and a secondary Later button. Later only hides the popup; the new version
starts on the next reload or the next time the panel opens.
Put the popup’s markup in HTML (one card per state) and fill it from JS.
The starter’s src/system/update-screen/ does exactly this:
<!-- update-screen.html (shortened) --><div data-state="ready"> <h2 id="update-title-ready">Update ready</h2> <p>Version <span data-field="version"></span> is installed. Reload to start using it.</p> <div data-slot="notes"></div> <button type="button" data-action="hide">Later</button> <button type="button" data-action="reload">Reload now</button></div>// update-screen.js (shortened)mount(updateRoot, markup);onAction(updateRoot, { reload: function () { AP.updates.reload(); }, hide: function () { showState(updateRoot, ""); }});AP.updates.onInstalled(function (info) { if (info.mode === "silent") return; var card = showState(updateRoot, "ready"); fill(card, { version: info.version }); renderNotes(card, info); // every missed release, newest first; Markdown via DOM nodes});onInstalled fires once per version per session, in every open panel (also
when another panel installed the update). Do not reload without the buyer’s
click: they may be in the middle of work.
Failure popup: “Update couldn’t finish”
Section titled “Failure popup: “Update couldn’t finish””When an automatic install fails, onError receives err with
err.stage === "install" and err.info (the same shape as onInstalled’s
info), so the popup can name the version and show the notes. Nothing was
changed, or the previous version was restored, so the extension keeps working.
Tell the buyer, in this order:
- The update could not be installed automatically; the current version still works.
err.message(one line, for support).- To get the new version, download the extension again from its product page
and run the installer. Open the page with
AP.license.openUrl(AP_CONFIG.productUrl).
Give the popup a Close button. Ignore err.stage === "check" (offline,
server busy; the next check retries) and err.code === "dev_build" (expected in
ap dev builds; log it instead).
AP.updates.onError(function (err) { if (!err || err.stage !== "install" || err.code === "dev_build") return; var card = showState(updateRoot, "error"); // its HTML holds the fixed wording above fill(card, { toVersion: err.info ? " to version " + err.info.version : "", error: err.message });});An automatic install that failed is not retried for the same version until the panel reloads, so the popup appears at most once per version per session.
Prompt mode: Install, then Update ready
Section titled “Prompt mode: Install, then Update ready”Show the notes from onAvailable with Install and Later. Install calls
AP.updates.install(info, cb); on success onInstalled fires and the same
Update ready popup offers Reload now. If install fails, cb(err)
receives the error (it does not go to onError): show the failure popup above.
AP.updates.onAvailable(function (info) { var card = showState(updateRoot, "available"); fill(card, { version: info.version }); renderNotes(card, info);});onAction(updateRoot, { install: function () { showState(updateRoot, "installing"); // "Downloading and verifying..." AP.updates.install(pendingInfo, function (err) { if (err) showError(pendingInfo, err); // On success onInstalled fires and shows "Update ready". }); }});onAvailable fires again on later checks (every 6 hours in auto mode) while
the update is still pending. Re-render; do not stack prompts.
Silent mode
Section titled “Silent mode”The runtime installs the update without asking, then calls onInstalled with
info.mode === "silent". Show nothing (the onInstalled handler above returns early); the
new version starts the next time the panel opens. Install failures still go to
onError; showing the failure popup is recommended.
What install does
Section titled “What install does”- Verifies the AfterPresets signature for this extension and version. Stops on failure before downloading.
- Downloads the release and checks its sha256. Stops on mismatch.
- Backs up the installed extension folder, then replaces its files. If copying fails, the backup is restored.
- Calls
cb(null, { version, backupPath })and firesonInstalledin every open panel of the extension.
Nothing is changed when any step before 3 fails. Only one panel installs at a
time. In background and silent mode, a panel that finds another panel already
installing stays quiet and receives onInstalled from it; a call you make to
install at the same moment gets busy.
Errors
Section titled “Errors”err is an Error with err.code. Errors from automatic checks and automatic
installs go to onError with err.stage = "check" or "install"; install
errors also carry err.info. Calls you make yourself report through their
callback only.
err.code |
Meaning | What to do |
|---|---|---|
network |
Offline or server unavailable | Ignore; the next check retries. |
license_required |
Licensing is off but the product is paid | Turn licensing on (see licensing.md). |
no_license |
Licensing is on but the buyer is not signed in | Nothing; the license screen is showing. |
not_owned, refunded, invalid_token |
License problem (licensing on) | The license screen updates itself. |
dev_build |
ap dev builds never install updates |
Expected during development. Do not show the failure popup. |
busy |
Another install is running | Try again later. |
bad_signature, bad_checksum, bad_zip, bad_update_info |
The download failed verification; nothing was installed | Show the failure popup. Do not retry in a loop. |
verify_unsupported |
The app is too old to verify signatures | Show the failure popup (reinstall from the product page). |
download_failed, install_failed |
Download or copy failed (the previous version is restored) | Show the failure popup. |
Channels
Section titled “Channels”When licensing is on, the seller and invited testers automatically receive
releases pushed with ap push --channel test; everyone else gets production
releases. The server decides this from the signed-in account, so you do not need
channel code. With licensing off, checks are anonymous and always get
production releases.
AP.updates.getChannel() / setChannel("production" | "test") exist for
advanced tools but do not change which release a buyer receives.
Testing
Section titled “Testing”ap dev builds check for updates but refuse to install (dev_build). To see
your update screen, call your renderer with a sample info object in the live
panel. The starter has App.previewUpdateScreen(state) with the states
"available", "installing", "ready" and "error".