Upload missing helper files
This commit is contained in:
@@ -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; }
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>PlaylistSaver Helper Settings</title>
|
||||||
|
<link rel="stylesheet" href="options.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>PlaylistSaver Helper</h1>
|
||||||
|
<p>Copy the secret key from PlaylistSaver and paste it below.</p>
|
||||||
|
<label for="secretKey">Secret key</label>
|
||||||
|
<div class="key-row">
|
||||||
|
<input id="secretKey" type="password" autocomplete="off" spellcheck="false">
|
||||||
|
<button id="toggleKey" type="button">Show</button>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<button id="saveKey" type="button">Save key</button>
|
||||||
|
<span id="status" role="status"></span>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<script src="options.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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";
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user