Skip to content

nexus_license_notify

miscellaneous · scripts/miscellaneous/nexus_license_notify.m

: nexus_license_notify ()
: info = nexus_license_notify (name, value, …)

Check the stored Nexus licence at launch and warn when there is a problem.

Called from the startup file of an interactive session. It only warns: it never stops Nexus from starting and never limits a feature. It asks the licence service of the download portal (POST /api/v1/license/status) and prints a warning when the service does not accept the stored email and key, when the licence is no longer active, or when it ends in 14, 7, 3 or 1 days. Everything else is silent: no licence stored, no network, a slow or failing service, a reply it does not understand.

The email and key are taken from NEXUS_LICENSE_EMAIL and NEXUS_LICENSE_KEY, else from the license.json written by the Windows installer (%ProgramData%\Nexus\license.json, then license.json in the per-user settings folder). On Linux that folder is ~/.config/nexus (or under XDG_CONFIG_HOME), on Windows %APPDATA%\Nexus. The file holds {"email": "...", "license_key": "..."} and may add a "server". The service is NEXUS_LICENSE_SERVER, else the "server" of the file, else https://nexusone.org.uk. The key is only sent to that service.

The service is asked at most once in 24 hours (3 second timeout). The time and the answer are kept in license-status in the per-user settings folder. Nothing happens for scripted runs (--eval, a script file), under a CI system, or for a development build without a build stamp.

To turn the check off, set NEXUS_NO_LICENSE_CHECK to any value, or put {"enabled": false} in license-check.json in the per-user settings folder. The interval in hours can be changed with NEXUS_LICENSE_CHECK_HOURS or "interval_hours" in the same file. Warnings use the identifier Nexus:LicenseCheck, so warning ("off", "Nexus:LicenseCheck") also silences them.

Options (name/value):

"Force"

Ask now, whatever the interval, the switches above or the session type, and print the result even when the licence is fine. Use it to test your setup.

"Server"

Base URL of the licence service.

"Timeout"

Seconds to wait for the service (default 3).

"FetchFcn"

Test hook: reply = fetch (url, body) returns the reply struct, or throws.

"Interactive"

Test hook: treat the session as interactive.

"StateDir"

Test hook: the per-user settings folder.

The optional output is a struct with the fields state (one of "skipped", "nolicense", "ok", "expiring", "inactive", "rejected", "unreachable"), message and days_remaining.