Skip to content

Commit

Permalink
loading: keep 'serveIndex' query arg on all sw.js loads, not just in …
Browse files Browse the repository at this point in the history
…embed.js (#242)

fixes embed 'purge cache + reload'
bump to 1.8.12
  • Loading branch information
ikreymer authored and emma-sg committed Nov 29, 2023
1 parent 03fefc8 commit 5a36b32
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## CHANGES

v1.8.12
- Loading: Fixes embed 'Purge Cache + Reload', ensure '?serveIndex=1' is always set on all service worker loading

v1.8.11

- Loading: Use default html index, avoid custom html injection (via wabac.js 2.16.12)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "replaywebpage",
"productName": "ReplayWeb.page",
"version": "1.8.11",
"version": "1.8.12",
"description": "Serverless Web Archive Replay",
"repository": "https://github.com/webrecorder/replayweb.page",
"homepage": "https://replayweb.page/",
Expand Down
1 change: 1 addition & 0 deletions src/appmain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ export class ReplayWebApp extends LitElement {
if (this.useRuffle) {
qp.set("injectScripts", "ruffle/ruffle.js");
}
qp.set("serveIndex", "1");
query = qp.toString();
if (query.length) {
name += "?" + query;
Expand Down
29 changes: 29 additions & 0 deletions src/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import INDEX_HTML from "../index.html";

import { SWReplay } from "@webrecorder/wabac/src/swmain";

import { WorkerLoader } from "@webrecorder/wabac/src/loaders";

if (self.registration) {
const staticData = new Map();

const prefix = self.registration.scope;

staticData.set(prefix, { type: "text/html", content: INDEX_HTML });
staticData.set(prefix + "index.html", {
type: "text/html",
content: INDEX_HTML,
});

const sp = new URLSearchParams(self.location.search);

const defaultConfig = {};

if (sp.get("ruffle") == "1") {
defaultConfig.injectScripts = ["ruffle/ruffle.js"];
}

self.sw = new SWReplay({ staticData, defaultConfig });
} else {
new WorkerLoader(self);
}

0 comments on commit 5a36b32

Please sign in to comment.