Skip to content

Commit c3365f9

Browse files
committed
lint + format pass
1 parent 7cc86c0 commit c3365f9

File tree

9 files changed

+117
-61
lines changed

9 files changed

+117
-61
lines changed

src/electron/app-popup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ class AppRecPopup extends RecPopup {
2020
};
2121
}
2222

23-
firstUpdated() : Promise<void> {
23+
firstUpdated(): Promise<void> {
2424
listAllMsg(this.collLoader).then((msg) => {
2525
this.onMessage(msg);
2626
});
2727

28-
return super.firstUpdated()
28+
return super.firstUpdated();
2929
}
3030

3131
updated(changedProperties: PropertyValues<this>) {

src/electron/electron-recorder-app.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
/*eslint-env node */
22

3-
import { app, session, BrowserWindow, ipcMain, dialog, type HandlerDetails, WebContents, WindowOpenHandlerResponse } from "electron";
3+
import {
4+
app,
5+
session,
6+
BrowserWindow,
7+
ipcMain,
8+
dialog,
9+
type HandlerDetails,
10+
type WindowOpenHandlerResponse,
11+
} from "electron";
412
import { ElectronRecorder } from "./electron-recorder";
513

614
import {
@@ -249,10 +257,10 @@ class ElectronRecorderApp extends ElectronReplayApp {
249257
if (url.startsWith(STATIC_PREFIX)) {
250258
this.mainWindow!.loadURL(url);
251259
this.mainWindow!.show();
252-
return { action: 'deny' };
260+
return { action: "deny" };
253261
}
254262

255-
return { action: 'allow' };
263+
return { action: "allow" };
256264
});
257265

258266
ipcMain.on("popup-msg-" + id, async (event, msg) => {
@@ -272,17 +280,19 @@ class ElectronRecorderApp extends ElectronReplayApp {
272280
}
273281
});
274282

275-
recWebContents.setWindowOpenHandler((details: HandlerDetails) : WindowOpenHandlerResponse => {
276-
const { url } = details;
277-
return {
278-
action: "allow",
279-
outlivesOpener: true,
280-
createWindow: () => {
281-
const win = this.createRecordWindow({ url, collId, startRec });
282-
return win.webContents;
283-
}
284-
}
285-
});
283+
recWebContents.setWindowOpenHandler(
284+
(details: HandlerDetails): WindowOpenHandlerResponse => {
285+
const { url } = details;
286+
return {
287+
action: "allow",
288+
outlivesOpener: true,
289+
createWindow: () => {
290+
const win = this.createRecordWindow({ url, collId, startRec });
291+
return win.webContents;
292+
},
293+
};
294+
},
295+
);
286296

287297
recWebContents.on("destroyed", () => {
288298
// @ts-expect-error - TS2339 - Property 'recorders' does not exist on type 'ElectronRecorderApp'.

src/sw/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ declare let self: ServiceWorkerGlobalScope;
99

1010
if (self.registration) {
1111
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12-
const defaultConfig : Record<string, any> = {
12+
const defaultConfig: Record<string, any> = {
1313
baseUrlSourcePrefix: "/replay/index.html",
1414
convertPostToGet: false,
1515
};
@@ -37,6 +37,7 @@ if (self.registration) {
3737
const ApiClass = ExtAPI;
3838
const CollectionsClass = RecordingCollections;
3939

40+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4041
(self as any).sw = new SWReplay({
4142
ApiClass,
4243
staticData,

src/ui/app.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import fasCog from "@fortawesome/fontawesome-free/svgs/solid/cog.svg";
1313

1414
import "./coll";
1515
import "./coll-info";
16-
import "./coll-index";
1716
import "./recordembed";
17+
import "./coll-index";
1818

1919
import { BtrixClient } from "./upload";
2020

@@ -31,7 +31,6 @@ import {
3131
} from "auto-js-ipfs";
3232
import { getLocalOption, setLocalOption } from "../localstorage";
3333
import { type BtrixOpts } from "../types";
34-
import { WrRecCollIndex } from "./coll-index";
3534

3635
const VERSION = __AWP_VERSION__;
3736

@@ -281,7 +280,8 @@ class ArchiveWebApp extends ReplayWebApp {
281280
}
282281
}
283282

284-
getLoadInfo(sourceUrl: string) {
283+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
284+
getLoadInfo(sourceUrl: string): any {
285285
this.disableCSP();
286286

287287
if (this.loadInfo) {
@@ -1274,9 +1274,10 @@ class ArchiveWebApp extends ReplayWebApp {
12741274
const resp = await fetch(`${apiPrefix}/c/create`, { method, body });
12751275
await resp.json();
12761276

1277-
const index = this.renderRoot.querySelector("wr-rec-coll-index") as WrRecCollIndex;
1277+
const index = this.renderRoot.querySelector("wr-rec-coll-index")!;
12781278
if (index) {
1279-
index.loadItems();
1279+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1280+
(index as any).loadItems();
12801281
}
12811282
// @ts-expect-error - TS2339 - Property 'showNew' does not exist on type 'ArchiveWebApp'.
12821283
this.showNew = null;

src/ui/coll-index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { ItemIndex, html } from "replaywebpage";
2-
import type { PropertyValues } from "lit";
32
import { property } from "lit/decorators.js";
43

54
import prettyBytes from "pretty-bytes";
65
import { type WrRecCollInfo } from "./coll-info";
76
import { type WrRecItem } from "../types";
87

8+
import type { PropertyValues } from "lit";
9+
910
//============================================================================
1011
export class WrRecCollIndex extends ItemIndex {
1112
@property({ type: Object })

src/ui/coll-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class WrRecCollInfo extends ItemInfo {
123123
}
124124

125125
// @ts-expect-error - TS7006 - Parameter 'changedProps' implicitly has an 'any' type.
126-
updated(changedProps: Property) {
126+
updated(changedProps) {
127127
if (changedProps.has("shareOpts") && this.shareOpts) {
128128
const { ipfsOpts, btrixOpts } = this.shareOpts;
129129
this.ipfsOpts = ipfsOpts;

src/ui/coll.ts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ class WrRecColl extends Item {
7070
super.updated(changedProperties);
7171

7272
if (
73-
(changedProperties.has("embed") ||
74-
(changedProperties.has("item") ||
75-
changedProperties.has("loadInfo")) &&
73+
changedProperties.has("embed") ||
74+
((changedProperties.has("item") || changedProperties.has("loadInfo")) &&
7675
this.loadInfo &&
7776
this.embed &&
7877
this.item &&
@@ -86,8 +85,8 @@ class WrRecColl extends Item {
8685
msg_type: "update-favicon",
8786
id: this.item,
8887
url: this.tabData.url,
89-
favIconUrl: this.favIconUrl.split("mp_/")[1]
90-
})
88+
favIconUrl: this.favIconUrl.split("mp_/")[1],
89+
});
9190
}
9291
}
9392

@@ -144,9 +143,17 @@ class WrRecColl extends Item {
144143
<span class="size-label">${prettyBytes(this.totalSize)}</span>
145144
</span>
146145
${this.showFinish
147-
? html` <button class="button is-primary" @click="${this.onEmbedFinish}" type="button">Finish</button>`
146+
? html` <button
147+
class="button is-primary"
148+
@click="${this.onEmbedFinish}"
149+
type="button"
150+
>
151+
Finish
152+
</button>`
148153
: html`
149-
<a class="button is-primary" role="button"
154+
<a
155+
class="button is-primary"
156+
role="button"
150157
download="my-archive.wacz"
151158
href="${this.downloadUrl}"
152159
target="_blank"
@@ -157,10 +164,12 @@ class WrRecColl extends Item {
157164
}
158165

159166
renderCollInfo() {
167+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
168+
const itemInfo = this.itemInfo as any;
160169
return html` <div class="info-bg">
161170
<wr-rec-coll-info
162171
class="is-list"
163-
.item="${this.itemInfo as any}"
172+
.item="${itemInfo}"
164173
.shareOpts=${this.shareOpts}
165174
?detailed="${true}"
166175
></wr-rec-coll-info>
@@ -182,10 +191,17 @@ class WrRecColl extends Item {
182191

183192
onEmbedFinish() {
184193
if (navigator.serviceWorker.controller) {
185-
navigator.serviceWorker.controller.postMessage({ msg_type: "toggle-record", id: this.item, isRecording: false });
194+
navigator.serviceWorker.controller.postMessage({
195+
msg_type: "toggle-record",
196+
id: this.item,
197+
isRecording: false,
198+
});
186199
}
187200
if (window.parent !== window) {
188-
window.parent.postMessage({type: "awp-finish", downloadUrl: this.downloadUrl});
201+
window.parent.postMessage({
202+
type: "awp-finish",
203+
downloadUrl: this.downloadUrl,
204+
});
189205
}
190206
}
191207

@@ -203,14 +219,21 @@ class WrRecColl extends Item {
203219
}
204220

205221
navigateTo(value: string) {
206-
if (this.embed && !value.startsWith("https://") && !value.startsWith("http://")) {
222+
if (
223+
this.embed &&
224+
!value.startsWith("https://") &&
225+
!value.startsWith("http://")
226+
) {
207227
value = "https://" + value;
208228
}
209229
super.navigateTo(value);
210230
}
211231

212232
get downloadUrl() {
213-
return new URL(`${apiPrefix}/c/${this.item}/dl?format=wacz&pages=all`, window.location.href).href;
233+
return new URL(
234+
`${apiPrefix}/c/${this.item}/dl?format=wacz&pages=all`,
235+
window.location.href,
236+
).href;
214237
}
215238
}
216239

src/ui/recordembed.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Embed.setDefaultReplayFile("replay.html");
99
type AWPFinishEvent = {
1010
type: "awp-finish";
1111
downloadUrl: string;
12-
}
12+
};
1313

1414
type LiveProxyURLErrorEvent = {
1515
type: "live-proxy-url-error";
1616
url: string;
1717
status: number;
18-
}
18+
};
1919

2020
// ===========================================================================
2121
export class RecordEmbed extends Embed {
@@ -36,7 +36,7 @@ export class RecordEmbed extends Embed {
3636
this.appName = "Embedded ArchiveWeb.page";
3737
this.embed = "default";
3838
this.noWebWorker = true;
39-
39+
4040
this.coll = this.randomId();
4141

4242
const baseUrl = new URL(window.location.href);
@@ -101,11 +101,19 @@ export class RecordEmbed extends Embed {
101101
if (iframe && event.source === iframe.contentWindow) {
102102
switch (event.data.type) {
103103
case "awp-finish":
104-
this.dispatchEvent(new CustomEvent<AWPFinishEvent>("awp-finish", {detail: event.data}));
104+
this.dispatchEvent(
105+
new CustomEvent<AWPFinishEvent>("awp-finish", {
106+
detail: event.data,
107+
}),
108+
);
105109
break;
106110

107111
case "live-proxy-url-error":
108-
this.dispatchEvent(new CustomEvent<LiveProxyURLErrorEvent>("live-proxy-url-error", {detail: event.data}));
112+
this.dispatchEvent(
113+
new CustomEvent<LiveProxyURLErrorEvent>("live-proxy-url-error", {
114+
detail: event.data,
115+
}),
116+
);
109117
break;
110118

111119
default:

0 commit comments

Comments
 (0)