Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat(masterclass): add file import functionality for cookies JSON and update textarea placeholder

Tonhodecaa36d3246
diff --git a/src/routes/courses/masterclass/+page.svelte b/src/routes/courses/masterclass/+page.svelte
index 0e5814cc..f5dd433a 100644
--- a/src/routes/courses/masterclass/+page.svelte
+++ b/src/routes/courses/masterclass/+page.svelte
@@ -17,6 +17,16 @@
};
let cookies = $state("");
+ let fileInput: HTMLInputElement = $state() as HTMLInputElement;
+ function onFileSelected(e: Event) {
+ const input = e.target as HTMLInputElement;
+ const file = input.files?.[0];
+ if (!file) return;
+ const reader = new FileReader();
+ reader.onload = () => { cookies = reader.result as string; };
+ reader.readAsText(file);
+ input.value = "";
+ }
let loading = $state(false);
let error = $state("");
@@ -299,15 +309,17 @@
<div class="form">
<label class="field">
- <span class="field-label">Cookie Header</span>
+ <span class="field-label">Cookies JSON</span>
<textarea
class="input token-textarea"
- placeholder="Paste your full Cookie header from browser DevTools (F12 > Network > Copy Cookie header)."
+ placeholder="Paste cookies JSON from browser extension or a raw token"
bind:value={cookies}
disabled={loading}
rows="4"
></textarea>
</label>
+ <input type="file" accept=".json,.txt" class="hidden-file-input" bind:this={fileInput} onchange={onFileSelected} />
+ <button class="button" onclick={() => fileInput?.click()} disabled={loading}>Import .json file</button>
{#if error}
<p class="error-msg">{error}</p>
@@ -483,10 +495,15 @@
margin-block: 0;
}
+ .hidden-file-input {
+ display: none;
+ }
+
.token-textarea {
resize: vertical;
min-height: 80px;
- font-size: 12px;
+ font-size: 11.5px;
+ font-family: var(--font-mono);
line-height: 1.5;
}