From 827ac87ae1ce797af83e1991d4dcc0035670d856 Mon Sep 17 00:00:00 2001 From: wei Date: Tue, 25 Aug 2026 18:18:14 +0800 Subject: [PATCH] Upload missing helper files --- PlaylistSaverHelper/options.css | 10 ++++++++++ PlaylistSaverHelper/options.html | 25 +++++++++++++++++++++++++ PlaylistSaverHelper/options.js | 31 +++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 PlaylistSaverHelper/options.css create mode 100644 PlaylistSaverHelper/options.html create mode 100644 PlaylistSaverHelper/options.js diff --git a/PlaylistSaverHelper/options.css b/PlaylistSaverHelper/options.css new file mode 100644 index 0000000..930e2ea --- /dev/null +++ b/PlaylistSaverHelper/options.css @@ -0,0 +1,10 @@ +:root { color-scheme: light dark; font-family: system-ui, sans-serif; } +body { margin: 0; background: #181818; color: #f2f2f2; } +main { width: min(620px, calc(100% - 48px)); margin: 64px auto; padding: 28px; background: #242424; border: 1px solid #404040; border-radius: 12px; } +h1 { margin-top: 0; } +label { display: block; margin: 24px 0 8px; font-weight: 600; } +.key-row, .actions { display: flex; gap: 10px; align-items: center; } +input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #555; border-radius: 7px; font: 14px ui-monospace, monospace; } +button { padding: 10px 14px; border: 1px solid #666; border-radius: 7px; cursor: pointer; } +.actions { margin-top: 16px; } +#status { color: #8bd39a; } diff --git a/PlaylistSaverHelper/options.html b/PlaylistSaverHelper/options.html new file mode 100644 index 0000000..0cb97f3 --- /dev/null +++ b/PlaylistSaverHelper/options.html @@ -0,0 +1,25 @@ + + + + + + PlaylistSaver Helper Settings + + + +
+

PlaylistSaver Helper

+

Copy the secret key from PlaylistSaver and paste it below.

+ +
+ + +
+
+ + +
+
+ + + diff --git a/PlaylistSaverHelper/options.js b/PlaylistSaverHelper/options.js new file mode 100644 index 0000000..c30f7fa --- /dev/null +++ b/PlaylistSaverHelper/options.js @@ -0,0 +1,31 @@ +const keyInput = document.querySelector("#secretKey"); +const status = document.querySelector("#status"); + +chrome.storage.local.get(["secretKey", "showMissingKeyAlert"]).then(async ({ secretKey, showMissingKeyAlert }) => { + keyInput.value = secretKey || ""; + + if (showMissingKeyAlert) { + await chrome.storage.local.remove("showMissingKeyAlert"); + alert("Set the PlaylistSaver secret key before exporting cookies."); + keyInput.focus(); + } +}); + +document.querySelector("#toggleKey").addEventListener("click", event => { + const showing = keyInput.type === "text"; + keyInput.type = showing ? "password" : "text"; + event.currentTarget.textContent = showing ? "Show" : "Hide"; +}); + +document.querySelector("#saveKey").addEventListener("click", async () => { + const secretKey = keyInput.value.trim(); + if (!/^[A-Za-z0-9_-]{43}$/.test(secretKey)) { + status.textContent = "Invalid key. Copy it again from PlaylistSaver."; + status.style.color = "#ff8989"; + return; + } + + await chrome.storage.local.set({ secretKey }); + status.textContent = "Secret key saved."; + status.style.color = "#8bd39a"; +});