# ordissimo-android-store-web-server

JSON manifests of the Ordissimo Android store: for each device range, the list of apps to offer or install, with their `versionCode` and the URL and MD5 of the APK. The repository holds only the JSON files; the APKs are stored on the server.

- Served at `https://android.ordissimo.com/json/<file>`: `/var/www/html/json` on the server is a clone of this repository (branch `main`). A JSON change reaches devices only after a `git pull` there.
- APKs live on the same server, outside git: `/var/www/html/store/apk/<flavor>/` (`ordissimo`, `orange`, `other`, and `vrbank`, `waz` left from the removed flavors), plus older paths `store-orange/apk/` and `dpc/`.
- Read by Store-App (`Android-Apps-Root/Store-App`, file chosen in `StoreTypeRepository.kt`) and by the Ordissimo DPC (`ordissimodpc`, file given by the `profile_url` of its provisioning QR code, `Numero2Mini.json` by default).
- The apps themselves are built in the `Android-Apps-Root` repository; its Codemagic workflows write the `Debug*` files here.

## Essential rules

- **Production files reach customer devices** at the next pull on the server: `Numero2.json`, `Numero2Mini.json`, `Celia.json`, `PixstarTouch.json`, `Orange.json`, `ExclusiveMobile.json`. Only put there versions already tested through a `Debug*` file.
- **Store-App only offers a higher `versionCode`** than the installed one. The `md5` must be the one of the file on the server, or the install fails.
- **Copy the APK to the server before** referencing it in a JSON, and check its URL answers 200.
- **Numero2 Dialer**: always the key-rotated APK (`Dialer-App-release-v<N>_rotated.apk`), never the normal one (see [docs/decisions.md](docs/decisions.md#22-numero2-dialer-signed-with-a-key-rotation--active-2026-10-21)).
- **Codemagic commits here** ("Debug store: add …"): pull before editing, and edit with `jq --indent 2` to keep the format.
- Run `python3 validate_store.py` before committing.
- Never commit an APK, a keystore, a password or a server access.
- Commit messages in English, prefixed with the JSON or store name, then a verb in the imperative (`Numero2: update …`, `ExclusiveMobile: remove …`, `Debug store: …`), one topic per commit. A pushed production file is one `git pull` away from customers.
- Never commit or push without the maintainer's approval. Prepare the commits (stage the files), list the files and the proposed messages, then ask everything on one screen of multiple-choice questions (AskUserQuestion or the client's equivalent; several questions when it does not fit in one), so that the maintainer only picks answers. The first, recommended choice takes the whole chain: the commits with their messages and the push. The other choices split it (commit only, no push…), and the free-text answer says what to correct. An approval covers only what was asked. Once approved, run the whole chain and report once it is done, or at the first step that fails. Before pushing, run `git pull --rebase --autostash` (Codemagic pushes here), look at what the pulled commits changed and report it, and stop to ask on a conflict. The maintainer pulls on the server: remind it at the end, and for a production file, the customer service note too.

## Tools

- `python3 validate_store.py [file.json …] [--check-urls]`: schema check of every manifest (fields, types, MD5 format, a package listed twice for the same device); `--check-urls` also checks that every APK URL answers.
- `jq`: edit entries without reformatting (recipes in [docs/guides.md](docs/guides.md)).
- `apksigner` (Android SDK build-tools): sign and check APKs.

## Docs

- [docs/decisions.md](docs/decisions.md): open items first, then why the store works this way. Start here to resume work.
- [docs/guides.md](docs/guides.md): file map, entry format, publish an APK, update a production file, Numero2 Dialer, commits, data outside the repository.
