mitmproxy/web
Sleeyax 4c018bb9d4
mitmweb: add status/method badges to the flow table (#8335)
* feat(web): add status/method badges and flow-table tooltips

Replace the inline-colored status text with a colored status-code badge and render the request method as an outlined badge.
Both reuse the semantic state tokens, so they follow the dark theme automatically.
Add hover tooltips (via a new optional Icon `title` prop and a title on the TLS cell) to the TLS, replay, intercept, and error indicators.

Part of #7789.

* feat(web): tone down solid state fills in the dark theme

Add a soft variant of the state palette (`--mitmweb-<state>-soft-bg`/`-fg`) and use it for the status badges and the footer option labels.
A saturated fill glares against a dark surface once it is repeated across every row, so the soft fill sinks towards the background and the label text carries the hue.
The solid tokens stay vivid for the header connection label and `.btn-info`, which appear one at a time and are meant to draw the eye.
Light values alias the existing solid colors, so the light theme is unchanged.

* feat(web): drop the now-unused status-code color tokens

The status column renders a badge that reuses the semantic state tokens, so nothing consumes --mitmweb-status-1xx…5xx/-other any more.

* [autofix.ci] apply automated fixes

* refactor(web): unify the status and method badges into one component

The two components differed only in styling, so a single presentational Badge in common/ now carries the shared class and callers pass the variant class.
statusClass moves to flow/utils next to statusCode, mirroring getIcon which likewise returns a CSS class.

* fix(web): give the status and method badges the same height

The two badges sized themselves from their own font size, padding and border, so the outlined method badge came out about a pixel shorter than the filled status badge.
A fixed height on the shared base plus a transparent border makes the box identical regardless of the variant.

* fix(web): widen the status column so DNS codes fit

The badge's padding and border pushed word-shaped DNS response codes such as NOERROR past the 60px cell, where the table's overflow rule clipped them.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-08-03 09:26:46 +02:00
..
gen eslint: consistent-type-imports (#7975) 2026-01-02 01:44:09 +01:00
public/static Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00
src mitmweb: add status/method badges to the flow table (#8335) 2026-08-03 09:26:46 +02:00
.editorconfig
.prettierignore
eslint.config.mjs eslint: consistent-type-imports (#7975) 2026-01-02 01:44:09 +01:00
index.html Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00
jest.config.js Web: Show Local timezone in the Timing tab (#7804) 2025-08-08 08:08:30 +02:00
package-lock.json feat(web): add dark theme (#8317) 2026-07-29 07:45:53 +02:00
package.json feat(web): add dark theme (#8317) 2026-07-29 07:45:53 +02:00
README.md Update node.js version (#7992) 2025-11-24 18:46:06 +00:00
setup-global-jest.js Web: Show Local timezone in the Timing tab (#7804) 2025-08-08 08:08:30 +02:00
setup-jest.js feat(web): add dark theme (#8317) 2026-07-29 07:45:53 +02:00
tsconfig.json Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00
vite.config.ts Move mitmweb to Vite (#7971) 2025-11-13 18:05:51 +00:00

Quick Start

  • Install mitmproxy as described in ../CONTRIBUTING.md
  • Run node --version to make sure that you have at least Node.js 24 or above.
  • Run cd ./web to change to the directory with package.json.
  • Run npm install to install dependencies.
  • Run uv run mitmweb
  • Run npm start in a separate window to start the Vite development server for the web interface.

Testing

  • Run npm test to run the test suite.

Code formatting

Architecture

There are two components:

Contributing

We very much appreciate any (small) improvements to mitmweb. Please do not include the compiled assets in mitmproxy/tools/web/static in your pull request. Refreshing them on every commit would massively increase repository size. We will update these files before every release.

Developer Tools