Installation counter after review: strict input, limits, country only, GitHub outages
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

- /api/update takes a 32-hex id, an x.y.z version and a known platform; at most 5 new
  installations a day per address are counted (made-up ids do not flood the bot).
- A download's notice: once a day per file and visitor; notices name the country only,
  as the texts promise; Android's text also says the system is sent.
- The release cache is not locked while GitHub is asked (one request asks, the others
  get what is known); after a failure GitHub is asked again in a minute, not on every
  request.
- An unrecognised desktop installation counts as 'other'; the bot logs a wrong token or a
  second listener; .env.example lists the bot's settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-24 14:08:05 +03:00
parent d15989bff1
commit df2ee6f528
15 changed files with 106 additions and 35 deletions

View file

@ -73,18 +73,21 @@ The programs (desktop and Android, from 1.0.1) check for updates through `GET /a
instead of GitHub: the answer is GitHub's latest release (the fields the programs read:
`tag_name`, `html_url`, `assets[].name/browser_download_url/size`), and the call is counted
in the `launches` table — one row per installation and local day: the random id the
program made up, its version, platform (`windows`, `macos`, `deb`, `rpm`, `arch`, `aur`,
`appimage`, `flatpak`, `tarball`, `source`, `android`, `android-noengine`) and the country
of the address (the address is not kept). The local network is not counted. `/stats`
program made up (32 hex digits), its version, platform (`windows`, `macos`, `deb`, `rpm`,
`arch`, `aur`, `appimage`, `flatpak`, `tarball`, `other`, `android`, `android-noengine`) and
the country of the address (the address is not kept). The local network is not counted,
nor more than 5 new installations a day from one address. `/stats`
shows installations that ran today, in 7 and 30 days, in all, and new ones in 7 days, by
platform, and the versions of the last 7 days. A program that cannot reach the site asks
GitHub (uncounted); one with the update check turned off is not counted.
GitHub (uncounted); one with the update check at start turned off is counted only when
the user checks by hand.
## Telegram
With `TELEGRAM_TOKEN` (the owner's bot) and `TELEGRAM_CHAT` (the owner's chat id) in
`.env`, the site writes to the owner: «⬇️ Скачали …» for a person's download (not
crawlers, the owner or the local network), «🆕 Новая установка №N» for an installation's
`.env`, the site writes to the owner (with the country only): «⬇️ Скачали …» for a
person's download (not crawlers, the owner or the local network; once a day per file and
visitor), «🆕 Новая установка №N» for an installation's
first run, «⬆️ Обновилась …» when it runs a new version, «▶️ Запуск …» when it runs on a
new day (once a day at most). `/stat` answers with today and all time: downloads,
installations that ran and new ones, active in 7 and 30 days, by platform. Only the