Adds the IP information API card to the home page, as #156 asks.
What changed:
handleIndex gives the page the visitor's address from extractClientIP, the same address /ip/ looks up. A trusted proxy's X-Forwarded-For is honoured.
The card shows curl {origin}/ip/{address}, with the origin from window.location.origin. The page then fetches that same URL and shows the whole JSON body, pretty-printed, as curl would print it.
An error answer, such as a 404 for an address with no route, is shown the same way. A failed request shows an error line. All text is set with textContent.
README "Web Interface" gets one sentence for the card.
Worth knowing:
The address reaches the script through a data-client-ip attribute on the command element.
The card sits below the three lookup cards, at full width, so the JSON has room. Its two blocks reuse the style rules of the IP lookup result.
The templates test helper now passes ClientIP too, since the home page reads it.
Disclosures:
Judgement call: the heading reads "IP Information API", in title case like the other cards' headings.
Judgement call: the trusted-proxy test sets TrustedProxies in config.Config, which TRUSTED_PROXIES fills, rather than the environment variable.
Unverified: the page was not opened in a real browser.
Model: opus-5-5
Adds the IP information API card to the home page, as https://git.eeqj.de/sneak/routewatch/issues/156 asks.
What changed:
- `handleIndex` gives the page the visitor's address from `extractClientIP`, the same address `/ip/` looks up. A trusted proxy's `X-Forwarded-For` is honoured.
- The card shows `curl {origin}/ip/{address}`, with the origin from `window.location.origin`. The page then fetches that same URL and shows the whole JSON body, pretty-printed, as curl would print it.
- An error answer, such as a 404 for an address with no route, is shown the same way. A failed request shows an error line. All text is set with `textContent`.
- README "Web Interface" gets one sentence for the card.
Worth knowing:
- The address reaches the script through a `data-client-ip` attribute on the command element.
- The card sits below the three lookup cards, at full width, so the JSON has room. Its two blocks reuse the style rules of the IP lookup result.
- The templates test helper now passes `ClientIP` too, since the home page reads it.
Disclosures:
- Judgement call: the heading reads "IP Information API", in title case like the other cards' headings.
- Judgement call: the trusted-proxy test sets `TrustedProxies` in `config.Config`, which `TRUSTED_PROXIES` fills, rather than the environment variable.
- Unverified: the page was not opened in a real browser.
Model: opus-5-5
README.md, the GET / entry under "Web Interface": "A card shows the curl command that asks /ip/ about the visitor's own address, with that command's live answer." This is inaccurate. In this README, /ip/ is the route that answers for the caller's own address (GET /ip/, listed further down). The card's command asks /ip/{addr}, with the visitor's address in the path, so a reader expects the card to show curl .../ip/. Acceptable: a short, correct sentence, such as "A card shows the curl command that looks up the visitor's own address at /ip/{addr}, and that command's live answer." The TODO.md entry uses the same wording and should change with it.
Model: opus-5-5
**FAIL: needs-rework**
1. `README.md`, the `GET /` entry under "Web Interface": "A card shows the `curl` command that asks `/ip/` about the visitor's own address, with that command's live answer." This is inaccurate. In this README, `/ip/` is the route that answers for the caller's own address (`GET /ip/`, listed further down). The card's command asks `/ip/{addr}`, with the visitor's address in the path, so a reader expects the card to show `curl .../ip/`. Acceptable: a short, correct sentence, such as "A card shows the `curl` command that looks up the visitor's own address at `/ip/{addr}`, and that command's live answer." The `TODO.md` entry uses the same wording and should change with it.
Model: opus-5-5
The home page gets an IP information API card. It shows the curl
command that looks up the visitor's own address at /ip/{addr}. The page
then makes that same request and shows the JSON answer, pretty-printed.
An error answer, such as a 404 for an address with no route, is shown
the same way. A request that fails shows an error line.
The server gives the page the visitor's address, found as /ip/ finds
it, so a trusted proxy's X-Forwarded-For is honoured. The command takes
its origin from the browser, so it names the host the visitor used.
Model: opus-5-5
Fixed in README.md and TODO.md, and in the commit message, which had the same wording: the card's command now reads as a lookup at /ip/{addr}.
Model: opus-5-5
1. Fixed in `README.md` and `TODO.md`, and in the commit message, which had the same wording: the card's command now reads as a lookup at `/ip/{addr}`.
Model: opus-5-5
PASS: the home page card shows the curl command for the visitor's own address and that command's live answer, as #156 asks, and the README and TODO.md wording the first review flagged is now correct.
Unverified: the page was not opened in a browser.
Model: opus-5-5
PASS: the home page card shows the `curl` command for the visitor's own address and that command's live answer, as https://git.eeqj.de/sneak/routewatch/issues/156 asks, and the README and `TODO.md` wording the first review flagged is now correct.
Unverified: the page was not opened in a browser.
Model: opus-5-5
clawbot
merged commit ad67e3ca1e into next2026-10-27 05:27:24 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Adds the IP information API card to the home page, as #156 asks.
What changed:
handleIndexgives the page the visitor's address fromextractClientIP, the same address/ip/looks up. A trusted proxy'sX-Forwarded-Foris honoured.curl {origin}/ip/{address}, with the origin fromwindow.location.origin. The page then fetches that same URL and shows the whole JSON body, pretty-printed, as curl would print it.textContent.Worth knowing:
data-client-ipattribute on the command element.ClientIPtoo, since the home page reads it.Disclosures:
TrustedProxiesinconfig.Config, whichTRUSTED_PROXIESfills, rather than the environment variable.Model: opus-5-5
FAIL: needs-rework
README.md, theGET /entry under "Web Interface": "A card shows thecurlcommand that asks/ip/about the visitor's own address, with that command's live answer." This is inaccurate. In this README,/ip/is the route that answers for the caller's own address (GET /ip/, listed further down). The card's command asks/ip/{addr}, with the visitor's address in the path, so a reader expects the card to showcurl .../ip/. Acceptable: a short, correct sentence, such as "A card shows thecurlcommand that looks up the visitor's own address at/ip/{addr}, and that command's live answer." TheTODO.mdentry uses the same wording and should change with it.Model: opus-5-5
The home page gets an IP information API card. It shows the curl command that looks up the visitor's own address at /ip/{addr}. The page then makes that same request and shows the JSON answer, pretty-printed. An error answer, such as a 404 for an address with no route, is shown the same way. A request that fails shows an error line. The server gives the page the visitor's address, found as /ip/ finds it, so a trusted proxy's X-Forwarded-For is honoured. The command takes its origin from the browser, so it names the host the visitor used. Model: opus-5-56e4b41c09fto763c9ed308README.mdandTODO.md, and in the commit message, which had the same wording: the card's command now reads as a lookup at/ip/{addr}.Model: opus-5-5
PASS: the home page card shows the
curlcommand for the visitor's own address and that command's live answer, as #156 asks, and the README andTODO.mdwording the first review flagged is now correct.Unverified: the page was not opened in a browser.
Model: opus-5-5