mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-01 10:18:26 +00:00
* Partially Revert "Web: harden `xsrf_token` usage (#7491)"
This reverts commit b761cb46c4.
The reason for this revert is that it's incompatible with Vite's
server (https://github.com/mitmproxy/mitmproxy/issues/7969).
We keep the parts that are compatible, and add an additional
`Sec-Fetch-Site` check for for all requests.
* use type imports for Vite compatibility
* make flow columns work with function name minification
* make modals work with function name minification
* vite: move assets
* web: switch builds to vite
* move to vite
* vite: move css and js
* update CHANGELOG
* [autofix.ci] apply automated fixes
* fix test failures
* fix static viewer
* obtain xsrf cookie lazily
* split js/css bundles into app/vendor
* [autofix.ci] apply automated fixes
* update compiled assets
* fix nits
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react({
|
|
babel: {
|
|
plugins: [["babel-plugin-react-compiler", {}]],
|
|
},
|
|
}),
|
|
],
|
|
base: "",
|
|
build: {
|
|
outDir: "../mitmproxy/tools/web",
|
|
assetsDir: "static",
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: (id) => {
|
|
if (
|
|
id.includes("node_modules") ||
|
|
id.includes("vendor.less")
|
|
) {
|
|
return "vendor";
|
|
}
|
|
return null;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
host: "127.0.0.1",
|
|
proxy: {
|
|
"^/(?!@|src|node_modules|updates).+": {
|
|
target: "http://127.0.0.1:8081",
|
|
},
|
|
"/updates": {
|
|
target: "ws://127.0.0.1:8081",
|
|
ws: true,
|
|
},
|
|
},
|
|
},
|
|
});
|