browsertrix/frontend/config/dev-server.js
sua yoo 83c9203a11
Initial QA Review UI! (#1624)
QA Details page:
- Enables QA tab with ability to start automated analysis QA Run + view a and manual review status
- Pages listed with review status + overall crawl review status shown on QA details (relates to #1508)
- Initial placeholder for QA run analytics (part of #1589)
- Addresses a good deal of #1477

Automated Analysis QA in Review Mode:
- Ability to select from multiple analysis QA runs / view QA runs in QA details
- Shows analysis screenshot, text and resources compare and replay tabs (fixes #1496)
- Sorting by worst screenshot / worst text score for each QA run
- Includes pages sidebar with screenshot/text/resource compare results (fixes #1497)

Manual Review QA in Review Mode:
- Per-page replay available as separate tab (fixes #1499)
- Supports thumbs up, thumbs down, notes for each page
- Supports entering review status approval (good/acceptable/bad can be entered when finishing review

---------
Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
2024-04-04 15:09:52 -07:00

53 lines
1.5 KiB
JavaScript

/* eslint-env node */
const path = require("path");
require(path.resolve(process.cwd(), "./webpack.config.js"));
// for testing: for prod, using the version specified in Helm values.yaml
const RWP_BASE_URL =
process.env.RWP_BASE_URL || "https://cdn.jsdelivr.net/npm/replaywebpage/";
if (!process.env.API_BASE_URL) {
throw new Error(
"To run a dev frontend server, please set the API_BASE_URL pointing to your backend api server in '.env.local'",
);
}
const devBackendUrl = new URL(process.env.API_BASE_URL);
module.exports = {
proxy: {
"/api": {
target: devBackendUrl.href,
headers: {
Host: devBackendUrl.host,
},
ws: true,
},
"/data": {
target: devBackendUrl.href,
headers: {
Host: devBackendUrl.host,
},
},
},
// Serve replay service worker file
onBeforeSetupMiddleware: (server) => {
server.app.get("/replay/sw.js", (req, res) => {
res.set("Content-Type", "application/javascript");
res.send(`importScripts("${RWP_BASE_URL}sw.js")`);
});
server.app.get("/replay/ui.js", (req, res) => {
res.set("Content-Type", "application/javascript");
res.redirect(307, RWP_BASE_URL + "ui.js");
});
// serve a 404 page for /replay/ path, as that should be taken over by RWP
server.app.get("/replay/*", (req, res) => {
res.set("Content-Type", "application/javascript");
res.status(404).send(`{"error": "placeholder_for_replay"}`);
});
},
};