mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-10-19 14:33:17 +00:00
Adblock support (#534)
Now that RWP 2.0.0 with adblock support has been released (webrecorder/replayweb.page#307), this enables adblock on the QA mode RWP embed, to get more accurate screenshots. Fetches the adblock.gz directly from RWP (though could also fetch it separately from Easylist) Updates to 1.1.0-beta.5
This commit is contained in:
parent
b5f3238c29
commit
e15f0c95d9
4 changed files with 14 additions and 4 deletions
|
@ -48,9 +48,10 @@ ADD config/ /app/
|
|||
|
||||
ADD html/ /app/html/
|
||||
|
||||
ARG RWP_VERSION=1.8.15
|
||||
ARG RWP_VERSION=2.0.0
|
||||
ADD https://cdn.jsdelivr.net/npm/replaywebpage@${RWP_VERSION}/ui.js /app/html/rwp/
|
||||
ADD https://cdn.jsdelivr.net/npm/replaywebpage@${RWP_VERSION}/sw.js /app/html/rwp/
|
||||
ADD https://cdn.jsdelivr.net/npm/replaywebpage@${RWP_VERSION}/adblock/adblock.gz /app/html/rwp/adblock.gz
|
||||
|
||||
RUN chmod a+x /app/dist/main.js /app/dist/create-login-profile.js && chmod a+r /app/html/rwp/*
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
url="about:blank"
|
||||
ts=""
|
||||
coll="replay"
|
||||
useAdblock
|
||||
>
|
||||
</replay-web-page>
|
||||
</body>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "browsertrix-crawler",
|
||||
"version": "1.1.0-beta.4",
|
||||
"version": "1.1.0-beta.5",
|
||||
"main": "browsertrix-crawler",
|
||||
"type": "module",
|
||||
"repository": "https://github.com/webrecorder/browsertrix-crawler",
|
||||
|
|
|
@ -16,6 +16,11 @@ const uiJS = fs.readFileSync(new URL("../../html/rwp/ui.js", import.meta.url), {
|
|||
encoding: "utf8",
|
||||
});
|
||||
|
||||
const adblockGZ = fs.readFileSync(
|
||||
new URL("../../html/rwp/adblock.gz", import.meta.url),
|
||||
{},
|
||||
);
|
||||
|
||||
// ============================================================================
|
||||
const PORT = 9990;
|
||||
|
||||
|
@ -76,9 +81,7 @@ export class ReplayServer {
|
|||
return;
|
||||
|
||||
case "/sw.js":
|
||||
case "/sw.js?serveIndex=1":
|
||||
case "/replay/sw.js":
|
||||
case "/replay/sw.js?serveIndex=1":
|
||||
response.writeHead(200, { "Content-Type": "application/javascript" });
|
||||
response.end(swJS);
|
||||
return;
|
||||
|
@ -88,6 +91,11 @@ export class ReplayServer {
|
|||
response.end(uiJS);
|
||||
return;
|
||||
|
||||
case "/replay/adblock/adblock.gz":
|
||||
response.writeHead(200, { "Content-Type": "application/gzip" });
|
||||
response.end(adblockGZ);
|
||||
return;
|
||||
|
||||
case this.sourceUrl:
|
||||
if (this.sourceContentType && this.origFileSource) {
|
||||
if (!this.sourceSize) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue