feat: add live outage countdown cli dashboard
Some checks failed
Test blackout notifier / test (push) Failing after 2s
Hourly blackout check / check (push) Successful in 3s

This commit is contained in:
2026-07-18 08:11:55 +03:30
parent 0abf377f53
commit ded914a6fd
4 changed files with 1140 additions and 0 deletions

View File

@@ -169,3 +169,43 @@ Tests mock both external services and never send real messages.
Historical state from the previous implementation is retained at
`archive/blackouts-1404.json` for reference only and is not imported.
## Standalone outage dashboard
`main.sh` is a read-only terminal dashboard for the outage state committed to
this public repository. It downloads the latest `state/outages.json` directly
from Gitea, so it can be copied and run without cloning the project or installing
the Python application.
It requires Bash, `curl`, `jq`, and GNU `date`:
```sh
./main.sh
```
The display uses a flicker-free alternate terminal screen and runs until `q` is
pressed (or it is interrupted with `Ctrl+C`). It updates the countdown every
second and refetches the committed state every 10 minutes. Set a different whole
minute interval with `-i`/`--interval`:
```sh
./main.sh --interval 5
```
The dashboard uses Tehran time to show a large `HH : mm : ss` countdown for the outage
currently in progress or the nearest upcoming outage. A compact schedule below it
lists all active current and future events, including emergency outages. The
terminal output uses English-only labels and omits the stored address and reason
text. When there are no qualifying events it prints an `ALL CLEAR` screen and exits
successfully.
Colors are enabled only when output is attached to a terminal. Set `NO_COLOR` to
disable them explicitly, or set `COLUMNS` to control the rendered width:
```sh
NO_COLOR=1 COLUMNS=80 ./main.sh
```
When `pyfiglet` or `figlet` provides the `univers` font, the countdown uses it
automatically. Otherwise the bundled matching glyphs are used, keeping the same
appearance without making Figlet a dependency.