feat(desktop): download, update or remove the free city table from Settings #604

Merged
admin merged 1 commits from feat/city-table-settings into dev 2026-10-21 08:38:40 +00:00
Owner

Part of #573.

PR #594 gave the daemon DB-IP's free city table, downloaded only on request, and a city_estimate in GetNodeInfo. This lets the owner manage it from the app: Settings → This node → City table, next to Where this node is and Location discovery.

The card says what the table is (free, about 90 MB, downloaded only when asked, and places the node near its city from its public address). It says that downloading shows db-ip.com this machine's address and that lookups afterwards are local. It also warns that the city is an estimate, often tens of kilometres off. It shows whether the table is there and, if it is, the edition, size and download date. Download (and Update once a table is there) shows a busy state for as long as the daemon takes. Remove deletes the table. Once the table places the node, the card says so, as in "This node looks to be near Louisville, Kentucky, US". If the table can't place the node, the card says why: the node has not found its public address, or the owner's pin is used instead.

The credit the CC BY 4.0 licence asks for, "IP Geolocation by DB-IP", links to https://db-ip.com. The window opens no links itself, so in the desktop the link goes through a new app:open-db-ip handler with a fixed address, as app:open-docker-install does. In a paired browser it opens a new tab. GetCityTable, DownloadCityTable and RemoveCityTable are added to the desktop's allowed RPCs and to the NodeRpcMethod type. The pure parts are in lib/city-table.ts: reading either client's replies (strings or bigints, camelCase or snake_case), formatting the edition, size and date for the locale, and naming the place. Unit tests are in dev/city-table.test.mjs. All strings are in the seven locale files.

The daemon has no flag or environment variable for the table's download address; only its Go tests can point it elsewhere. So the e2e test never downloads. It writes a small table, with no rows, into the test node's data directory in the daemon's own form. It then checks the card's status, the credit link (with shell.openExternal stubbed) and Remove. The Download button is checked for presence only.

docs/user-guide.md and apps/sisyphus/README.md describe the card.

Checks: npm run -s typecheck; npm test (177 pass); and the e2e tests for the city table, the pin and location discovery (3 pass).

Part of #573. PR #594 gave the daemon DB-IP's free city table, downloaded only on request, and a `city_estimate` in `GetNodeInfo`. This lets the owner manage it from the app: **Settings → This node → City table**, next to **Where this node is** and **Location discovery**. The card says what the table is (free, about 90 MB, downloaded only when asked, and places the node near its city from its public address). It says that downloading shows db-ip.com this machine's address and that lookups afterwards are local. It also warns that the city is an estimate, often tens of kilometres off. It shows whether the table is there and, if it is, the edition, size and download date. **Download** (and **Update** once a table is there) shows a busy state for as long as the daemon takes. **Remove** deletes the table. Once the table places the node, the card says so, as in "This node looks to be near Louisville, Kentucky, US". If the table can't place the node, the card says why: the node has not found its public address, or the owner's pin is used instead. The credit the CC BY 4.0 licence asks for, "IP Geolocation by DB-IP", links to https://db-ip.com. The window opens no links itself, so in the desktop the link goes through a new `app:open-db-ip` handler with a fixed address, as `app:open-docker-install` does. In a paired browser it opens a new tab. `GetCityTable`, `DownloadCityTable` and `RemoveCityTable` are added to the desktop's allowed RPCs and to the `NodeRpcMethod` type. The pure parts are in `lib/city-table.ts`: reading either client's replies (strings or bigints, camelCase or snake_case), formatting the edition, size and date for the locale, and naming the place. Unit tests are in `dev/city-table.test.mjs`. All strings are in the seven locale files. The daemon has no flag or environment variable for the table's download address; only its Go tests can point it elsewhere. So the e2e test never downloads. It writes a small table, with no rows, into the test node's data directory in the daemon's own form. It then checks the card's status, the credit link (with `shell.openExternal` stubbed) and **Remove**. The Download button is checked for presence only. `docs/user-guide.md` and `apps/sisyphus/README.md` describe the card. Checks: `npm run -s typecheck`; `npm test` (177 pass); and the e2e tests for the city table, the pin and location discovery (3 pass).
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Sisyphus/Sisyphus#604