Buying an app from the admin
Paid apps are sold by the App Markets of the stores (the extension exp_app_market on appstore.se7enx.com and appstore.exponential.earth). A site's App Store offers them on each app's page and installs a bought app itself.
Settings (appstore.ini)
[Market]
Enabled=enabled
Stores[]
Stores[sevenx]=https://appstore.se7enx.com
Stores[exponential]=https://appstore.exponential.earth
[Cache]
TTL[market]=3600Only https addresses count. The claim token and the key travel only between this site and a store of this list.
The flow
- The app page asks every store
GET <store>/market/api/app/(vendor)/<v>/(package)/<p>(keptTTL[market]seconds, "not sold here" too) and shows each offer: price, subscription or one-time, warranty, support channel and first-answer time, the guarantees, and the registry whose licensed downloads the key opens. - Buy (policy
appstore/buy, a POST toappstore/buy/<store>/(vendor)/<v>/(package)/<p>) sends the browser to the store's checkout<store>/market/buy/<app id>/(return)/<base64url>. The return address isappstore/bought/<store>/(vendor)/<v>/(package)/<p>/(claim)/{claim}; the store puts the claim token where{claim}stands (a view parameter: the App Store's views take no GET parameters). - Back at
appstore/boughtthe token is exchanged at that store (POST <store>/market/api/claim) for the license key, once. The key goes into the secret store (Setup > Secrets) asappstore_license_<vendor>_<name>; the registry is remembered in<var>/appstore/licenses.json. Withappstore/installthe app installs itself on every node; without it the page says that an administrator installs it. - Without
appstore/buythe page has "Ask an administrator to buy it":appstore/requestmails the site's[MailSettings] AdminEmailwith the app, the price and the link, and logs the request inappstore.log.
Licensed installs and updates
A Composer install or update of a package whose key the site holds is a licensed run (license_secret and registry
in the run's specification, filled in by itself):
- the registry joins composer.json's
repositoriesasregistry-<host>when it is not there (it stays after a rollback); - Composer gets the key in
COMPOSER_AUTH(http-basic, usertoken) for that run only: it is never written to a file or to the run's log, and it is taken out of the environment however the run ends; - a private app no source lists without a key is read from that registry with the key, so its page, its versions and Updates work like any other app.
A key bought on the store's own pages (not from the admin) works the same way: add it under Setup > Secrets as
appstore_license_<vendor>_<name>.
After a refund or the end of a subscription
The store revokes the key in the registry. The installed code keeps running; the next update is refused by the registry until the license is renewed.