mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
feat: compress and use new update video
This commit is contained in:
@@ -4,6 +4,7 @@ import { openPopup } from "./PopupManager";
|
||||
import { attachPopupMediaFullscreen } from "./attachPopupMediaFullscreen";
|
||||
import { createPopupSocialFooter } from "./createPopupSocialFooter";
|
||||
import { renderWhatsNewChangelogHtml } from "./whatsNewChangelog";
|
||||
import updateVideo from "@/resources/update-video.webm";
|
||||
|
||||
export function OpenWhatsNewPopup(onDismissed?: () => void) {
|
||||
const header = stringToHTML(
|
||||
@@ -17,13 +18,18 @@ export function OpenWhatsNewPopup(onDismissed?: () => void) {
|
||||
const imageContainer = document.createElement("div");
|
||||
imageContainer.classList.add("whatsnewImgContainer");
|
||||
|
||||
const heroImage = document.createElement("img");
|
||||
heroImage.src =
|
||||
"https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Plus/main/src/resources/updateimage1.webp";
|
||||
heroImage.alt = "BetterSEQTA+ update preview";
|
||||
heroImage.classList.add("whatsnewImg");
|
||||
imageContainer.appendChild(heroImage);
|
||||
attachPopupMediaFullscreen(heroImage);
|
||||
const heroVideo = document.createElement("video");
|
||||
heroVideo.src = updateVideo;
|
||||
heroVideo.classList.add("whatsnewImg");
|
||||
heroVideo.autoplay = true;
|
||||
heroVideo.muted = true;
|
||||
heroVideo.loop = true;
|
||||
heroVideo.playsInline = true;
|
||||
heroVideo.setAttribute("playsinline", "");
|
||||
heroVideo.setAttribute("aria-label", "BetterSEQTA+ update preview");
|
||||
imageContainer.appendChild(heroVideo);
|
||||
attachPopupMediaFullscreen(heroVideo);
|
||||
void heroVideo.play().catch(() => {});
|
||||
|
||||
const text = stringToHTML(/* html */ `
|
||||
<div class="whatsnewTextContainer" style="height: 50%;overflow-y: auto;">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Minimal allowlist for remote popup/API image (and media) URLs.
|
||||
* Only https: URLs are accepted; everything else is rejected.
|
||||
* Allowlist for popup/API media URLs.
|
||||
* Accepts https: and same-extension chrome-extension:/moz-extension: URLs.
|
||||
*/
|
||||
export function allowedPopupImageUrl(url: string | null | undefined): string | null {
|
||||
if (!url) return null;
|
||||
@@ -8,8 +8,20 @@ export function allowedPopupImageUrl(url: string | null | undefined): string | n
|
||||
if (!trimmed) return null;
|
||||
try {
|
||||
const parsed = new URL(trimmed);
|
||||
if (parsed.protocol !== "https:") return null;
|
||||
return parsed.href;
|
||||
if (parsed.protocol === "https:") return parsed.href;
|
||||
|
||||
if (
|
||||
parsed.protocol === "chrome-extension:" ||
|
||||
parsed.protocol === "moz-extension:"
|
||||
) {
|
||||
const extId =
|
||||
typeof chrome !== "undefined" && chrome.runtime?.id
|
||||
? chrome.runtime.id
|
||||
: undefined;
|
||||
if (extId && parsed.hostname === extId) return parsed.href;
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user