diff --git a/src/appmain.ts b/src/appmain.ts index 6aa36f6..e0eea76 100644 --- a/src/appmain.ts +++ b/src/appmain.ts @@ -26,7 +26,7 @@ import { SWManager } from "./swmanager"; import "./item"; import "./item-index"; import "./chooser"; -import { type LoadInfo } from "./item"; +import { type EmbedOpts, type LoadInfo } from "./item"; import type { FavIconEventDetail } from "./types"; // =========================================================================== @@ -59,6 +59,9 @@ export class ReplayWebApp extends LitElement { @property({ type: String }) embed: string | null = null; + @property({ type: Object }) + embedOpts: EmbedOpts = {}; + @property({ type: String }) collPageUrl = ""; @@ -398,6 +401,7 @@ export class ReplayWebApp extends LitElement { .loadInfo="${this.loadInfo}" sourceUrl="${this.sourceUrl || ""}" embed="${ifDefined(this.embed === null ? undefined : this.embed)}" + .embedOpts="${this.embedOpts}" appName="${this.appName}" swName="${ifDefined(this.swName)}" @replay-favicons=${this.onFavIcons} @@ -587,6 +591,10 @@ export class ReplayWebApp extends LitElement { if (!this.loadInfo) { this.loadInfo = {}; } + + if (this.pageParams.has("noMediaDownload")) { + this.embedOpts = { ...this.embedOpts, noMediaDownloadUI: true }; + } } if (this.pageParams.get("config")) { diff --git a/src/embed.ts b/src/embed.ts index ccd47c5..3ad5602 100644 --- a/src/embed.ts +++ b/src/embed.ts @@ -66,6 +66,8 @@ class Embed extends LitElement { @property({ type: Boolean }) noCache = false; @property({ type: Boolean }) hideOffscreen: boolean | undefined; + @property({ type: Boolean }) noMediaDownload = false; + @property({ type: Boolean }) useAdblock = false; @property({ type: String }) adblockRulesUrl = DEFAULT_ADBLOCK_FILE; @@ -324,6 +326,7 @@ class Embed extends LitElement { swName?: string; ruffle?: "1"; adblockUrl?: string; + noMediaDownload?: string; } = { source, customColl: this.coll, @@ -365,6 +368,10 @@ class Embed extends LitElement { params.adblockUrl = this.adblockRulesUrl; } + if (this.noMediaDownload) { + params.noMediaDownload = "1"; + } + this.paramString = new URLSearchParams( // Converting to unknown here so that we can ignore the URL -> string conversion necessary for the types to work out params as unknown as Record, diff --git a/src/item.ts b/src/item.ts index cdad0b7..3a95f78 100644 --- a/src/item.ts +++ b/src/item.ts @@ -87,6 +87,10 @@ export type LoadInfo = { importCollId?: string; }; +export type EmbedOpts = { + noMediaDownloadUI?: boolean; +}; + export type EmbedReplayData = { view?: "story" | "pages" | "resources"; url?: string; @@ -120,6 +124,9 @@ class Item extends LitElement { @property({ type: Object, attribute: false }) loadInfo: LoadInfo | null = null; + @property({ type: Object }) + embedOpts: EmbedOpts = {}; + @property({ type: Boolean }) showSidebar: boolean | null = null; @@ -1417,7 +1424,7 @@ class Item extends LitElement { Purge Cache + Full Reload ` : html``} - ${isReplay + ${isReplay && !this.embedOpts.noMediaDownloadUI ? html`