settings.html
| 1 | {{define "settings"}} |
| 2 | <div class="page-header"> |
| 3 | <h2>Settings</h2> |
| 4 | </div> |
| 5 | |
| 6 | <div class="settings-layout"> |
| 7 | <article> |
| 8 | <h3>Global Settings</h3> |
| 9 | <form method="post" action="/settings"> |
| 10 | <label for="refresh_interval">Auto-refresh Interval (seconds)</label> |
| 11 | <input type="number" id="refresh_interval" name="refresh_interval" min="1" max="300" |
| 12 | value="{{.Data.Settings.RefreshInterval}}"> |
| 13 | |
| 14 | <label> |
| 15 | <input type="checkbox" name="auto_refresh_library" value="1" |
| 16 | {{if .Data.Settings.AutoRefreshLibrary}}checked{{end}}> |
| 17 | Auto-refresh Library page |
| 18 | </label> |
| 19 | |
| 20 | <label> |
| 21 | <input type="checkbox" name="auto_refresh_downloads" value="1" |
| 22 | {{if .Data.Settings.AutoRefreshDownloads}}checked{{end}}> |
| 23 | Auto-refresh Queue page |
| 24 | </label> |
| 25 | |
| 26 | <label for="cookies">Cookies (cookies.txt format)</label> |
| 27 | <textarea id="cookies" name="cookies" rows="6" placeholder="Paste cookies.txt content here...">{{.Data.Settings.Cookies}}</textarea> |
| 28 | <small>Paste the contents of a cookies.txt file. Will be passed to yt-dlp via --cookies.</small> |
| 29 | |
| 30 | <div class="form-actions"> |
| 31 | <button type="submit" class="primary">Save Settings</button> |
| 32 | </div> |
| 33 | </form> |
| 34 | </article> |
| 35 | |
| 36 | <article> |
| 37 | <h3>Theme</h3> |
| 38 | <div class="theme-selector"> |
| 39 | <form method="post" action="/theme" class="inline"> |
| 40 | <input type="hidden" name="theme" value="light"> |
| 41 | <button type="submit" class="secondary {{if eq .Theme "light"}}active{{end}}">Light</button> |
| 42 | </form> |
| 43 | <form method="post" action="/theme" class="inline"> |
| 44 | <input type="hidden" name="theme" value="dark"> |
| 45 | <button type="submit" class="secondary {{if eq .Theme "dark"}}active{{end}}">Dark</button> |
| 46 | </form> |
| 47 | <form method="post" action="/theme" class="inline"> |
| 48 | <input type="hidden" name="theme" value="auto"> |
| 49 | <button type="submit" class="secondary {{if eq .Theme "auto"}}active{{end}}">Auto</button> |
| 50 | </form> |
| 51 | </div> |
| 52 | </article> |
| 53 | |
| 54 | <article> |
| 55 | <h3>Presets</h3> |
| 56 | |
| 57 | <div class="presets-list"> |
| 58 | {{range .Data.Presets}} |
| 59 | <article> |
| 60 | <div class="preset-header"> |
| 61 | <h4>{{.Name}} {{if .IsDefault}}<span class="badge">default</span>{{end}}</h4> |
| 62 | <details class="delete-overlay"> |
| 63 | <summary role="button" class="small danger">Delete</summary> |
| 64 | <div class="overlay-panel"> |
| 65 | <p>Are you sure you want to delete preset <strong>{{.Name}}</strong>?</p> |
| 66 | <form method="post" action="/settings/presets/{{.ID}}/delete" class="form-actions"> |
| 67 | <button type="submit" class="danger">Yes, Delete</button> |
| 68 | </form> |
| 69 | </div> |
| 70 | </details> |
| 71 | </div> |
| 72 | |
| 73 | {{if .Description}} |
| 74 | <p class="preset-description">{{.Description}}</p> |
| 75 | {{end}} |
| 76 | |
| 77 | <div class="preset-flags"> |
| 78 | <strong>Effective flags:</strong> |
| 79 | <pre>{{presetFlags .}}</pre> |
| 80 | </div> |
| 81 | |
| 82 | <div class="preset-actions"> |
| 83 | <details> |
| 84 | <summary role="button" class="small"><span class="edit-text">Edit</span><span class="cancel-text">Cancel</span></summary> |
| 85 | <form method="post" action="/settings/presets/{{.ID}}" class="edit-form"> |
| 86 | {{template "preset_form" .}} |
| 87 | <div class="form-actions"> |
| 88 | <button type="submit" class="primary">Update Preset</button> |
| 89 | </div> |
| 90 | </form> |
| 91 | </details> |
| 92 | </div> |
| 93 | </article> |
| 94 | {{else}} |
| 95 | <p>No presets yet. Create one below.</p> |
| 96 | {{end}} |
| 97 | </div> |
| 98 | |
| 99 | <article> |
| 100 | <h4>Create Preset</h4> |
| 101 | <form method="post" action="/settings/presets"> |
| 102 | {{template "preset_form_create" .}} |
| 103 | |
| 104 | <div class="form-actions"> |
| 105 | <button type="submit" class="primary">Create Preset</button> |
| 106 | </div> |
| 107 | </form> |
| 108 | </article> |
| 109 | </article> |
| 110 | </div> |
| 111 | {{end}} |
| 112 | |
| 113 | {{define "preset_form"}} |
| 114 | <div class="form-group"> |
| 115 | <label for="name">Name *</label> |
| 116 | <input type="text" name="name" required |
| 117 | value="{{if .}}{{.Name}}{{end}}"> |
| 118 | </div> |
| 119 | |
| 120 | <div class="form-group"> |
| 121 | <label for="description">Description</label> |
| 122 | <input type="text" name="description" |
| 123 | value="{{if .}}{{.Description}}{{end}}"> |
| 124 | </div> |
| 125 | |
| 126 | <div class="form-group"> |
| 127 | <label> |
| 128 | <input type="checkbox" name="is_default" value="1" |
| 129 | {{if .}}{{if .IsDefault}}checked{{end}}{{end}}> |
| 130 | Set as default preset |
| 131 | </label> |
| 132 | </div> |
| 133 | |
| 134 | <div class="conditional-section"> |
| 135 | <label>Format Selection</label> |
| 136 | <div class="radio-group format-mode"> |
| 137 | <label> |
| 138 | <input type="radio" name="format_mode" value="default" class="conditional-trigger" |
| 139 | {{if .}}{{if or (eq .FormatMode "default") (eq .FormatMode "")}}checked{{end}}{{else}}checked{{end}}> |
| 140 | yt-dlp default |
| 141 | </label> |
| 142 | <label> |
| 143 | <input type="radio" name="format_mode" value="preset" class="conditional-trigger" |
| 144 | {{if .}}{{if eq .FormatMode "preset"}}checked{{end}}{{end}}> |
| 145 | Preset format |
| 146 | </label> |
| 147 | <label> |
| 148 | <input type="radio" name="format_mode" value="custom" class="conditional-trigger" |
| 149 | {{if .}}{{if eq .FormatMode "custom"}}checked{{end}}{{end}}> |
| 150 | Custom format |
| 151 | </label> |
| 152 | </div> |
| 153 | |
| 154 | <div class="conditional-content format-preset"> |
| 155 | <div class="form-row"> |
| 156 | <div class="form-group"> |
| 157 | <label for="format">Format</label> |
| 158 | <select name="format"> |
| 159 | <option value="best" {{if .}}{{if eq .Format "best"}}selected{{end}}{{end}}>best</option> |
| 160 | <option value="worst" {{if .}}{{if eq .Format "worst"}}selected{{end}}{{end}}>worst</option> |
| 161 | <option value="bestvideo+bestaudio" {{if .}}{{if eq .Format "bestvideo+bestaudio"}}selected{{end}}{{end}}>bestvideo+bestaudio</option> |
| 162 | <option value="bestvideo" {{if .}}{{if eq .Format "bestvideo"}}selected{{end}}{{end}}>bestvideo</option> |
| 163 | <option value="bestaudio" {{if .}}{{if eq .Format "bestaudio"}}selected{{end}}{{end}}>bestaudio</option> |
| 164 | </select> |
| 165 | </div> |
| 166 | |
| 167 | <div class="form-group"> |
| 168 | <label for="quality">Max Quality</label> |
| 169 | <select name="quality"> |
| 170 | <option value="" {{if .}}{{if eq .Quality ""}}selected{{end}}{{end}}>No limit</option> |
| 171 | <option value="720" {{if .}}{{if eq .Quality "720"}}selected{{end}}{{end}}>720p</option> |
| 172 | <option value="1080" {{if .}}{{if eq .Quality "1080"}}selected{{end}}{{end}}>1080p</option> |
| 173 | <option value="1440" {{if .}}{{if eq .Quality "1440"}}selected{{end}}{{end}}>1440p</option> |
| 174 | <option value="2160" {{if .}}{{if eq .Quality "2160"}}selected{{end}}{{end}}>4K (2160p)</option> |
| 175 | </select> |
| 176 | </div> |
| 177 | </div> |
| 178 | </div> |
| 179 | |
| 180 | <div class="conditional-content format-custom"> |
| 181 | <div class="form-group"> |
| 182 | <label for="custom_format">Custom Format</label> |
| 183 | <input type="text" name="custom_format" placeholder="e.g., bestvideo+bestaudio/best or format ID like 22" |
| 184 | value="{{if .}}{{.CustomFormat}}{{end}}"> |
| 185 | <small>Overrides the format selection. Use yt-dlp format syntax.</small> |
| 186 | </div> |
| 187 | </div> |
| 188 | </div> |
| 189 | |
| 190 | <div class="conditional-section"> |
| 191 | <div class="form-group"> |
| 192 | <label> |
| 193 | <input type="checkbox" name="extract_audio" value="1" class="conditional-trigger" |
| 194 | {{if .}}{{if .ExtractAudio}}checked{{end}}{{end}}> |
| 195 | Extract audio only |
| 196 | </label> |
| 197 | </div> |
| 198 | <div class="conditional-content"> |
| 199 | <div class="form-group"> |
| 200 | <label>Audio Format</label> |
| 201 | <div class="radio-group"> |
| 202 | <label><input type="radio" name="audio_format" value="mp3" {{if .}}{{if eq .AudioFormat "mp3"}}checked{{end}}{{end}}> MP3</label> |
| 203 | <label><input type="radio" name="audio_format" value="flac" {{if .}}{{if eq .AudioFormat "flac"}}checked{{end}}{{end}}> FLAC</label> |
| 204 | <label><input type="radio" name="audio_format" value="wav" {{if .}}{{if eq .AudioFormat "wav"}}checked{{end}}{{end}}> WAV</label> |
| 205 | <label><input type="radio" name="audio_format" value="opus" {{if .}}{{if eq .AudioFormat "opus"}}checked{{end}}{{end}}> Opus</label> |
| 206 | <label><input type="radio" name="audio_format" value="aac" {{if .}}{{if eq .AudioFormat "aac"}}checked{{end}}{{end}}> AAC</label> |
| 207 | <label><input type="radio" name="audio_format" value="" {{if .}}{{if eq .AudioFormat ""}}checked{{end}}{{else}}checked{{end}}> Default (no conversion)</label> |
| 208 | </div> |
| 209 | </div> |
| 210 | </div> |
| 211 | </div> |
| 212 | |
| 213 | <div class="conditional-section"> |
| 214 | <div class="form-group"> |
| 215 | <label> |
| 216 | <input type="checkbox" name="embed_subs" value="1" class="conditional-trigger" |
| 217 | {{if .}}{{if .EmbedSubs}}checked{{end}}{{end}}> |
| 218 | Embed subtitles |
| 219 | </label> |
| 220 | </div> |
| 221 | <div class="conditional-content"> |
| 222 | <div class="form-group"> |
| 223 | <label for="sub_langs">Subtitle Languages</label> |
| 224 | <input type="text" name="sub_langs" placeholder="e.g., en,de,fr or all" |
| 225 | value="{{if .}}{{.SubLangs}}{{else}}en{{end}}"> |
| 226 | <small>Comma-separated language codes or "all"</small> |
| 227 | </div> |
| 228 | </div> |
| 229 | </div> |
| 230 | |
| 231 | <div class="form-group"> |
| 232 | <label> |
| 233 | <input type="checkbox" name="embed_thumbnail" value="1" |
| 234 | {{if .}}{{if .EmbedThumbnail}}checked{{end}}{{else}}checked{{end}}> |
| 235 | Embed thumbnail |
| 236 | </label> |
| 237 | </div> |
| 238 | |
| 239 | <div class="form-group"> |
| 240 | <label> |
| 241 | <input type="checkbox" name="embed_metadata" value="1" |
| 242 | {{if .}}{{if .EmbedMetadata}}checked{{end}}{{else}}checked{{end}}> |
| 243 | Embed metadata |
| 244 | </label> |
| 245 | </div> |
| 246 | |
| 247 | <div class="form-group"> |
| 248 | <label> |
| 249 | <input type="checkbox" name="write_info_json" value="1" |
| 250 | {{if .}}{{if .WriteInfoJSON}}checked{{end}}{{else}}checked{{end}}> |
| 251 | Write info JSON |
| 252 | </label> |
| 253 | </div> |
| 254 | |
| 255 | <div class="form-group"> |
| 256 | <label for="output_template">Output Template</label> |
| 257 | <input type="text" name="output_template" |
| 258 | value="{{if .}}{{.OutputTemplate}}{{else}}%(title)s [%(id)s].%(ext)s{{end}}"> |
| 259 | <small>Use / for subfolders. Example: %(playlist_title)s/%(title)s.%(ext)s</small> |
| 260 | </div> |
| 261 | |
| 262 | <div class="form-group"> |
| 263 | <label for="custom_flags">Custom Flags</label> |
| 264 | <textarea name="custom_flags" rows="2" placeholder="Any additional yt-dlp flags...">{{if .}}{{.CustomFlags}}{{end}}</textarea> |
| 265 | </div> |
| 266 | {{end}} |
| 267 | |
| 268 | {{define "preset_form_create"}} |
| 269 | <div class="form-group"> |
| 270 | <label for="name">Name *</label> |
| 271 | <input type="text" name="name" required> |
| 272 | </div> |
| 273 | |
| 274 | <div class="form-group"> |
| 275 | <label for="description">Description</label> |
| 276 | <input type="text" name="description"> |
| 277 | </div> |
| 278 | |
| 279 | <div class="form-group"> |
| 280 | <label> |
| 281 | <input type="checkbox" name="is_default" value="1"> |
| 282 | Set as default preset |
| 283 | </label> |
| 284 | </div> |
| 285 | |
| 286 | <div class="conditional-section"> |
| 287 | <label>Format Selection</label> |
| 288 | <div class="radio-group format-mode"> |
| 289 | <label> |
| 290 | <input type="radio" name="format_mode" value="default" class="conditional-trigger" checked> |
| 291 | yt-dlp default |
| 292 | </label> |
| 293 | <label> |
| 294 | <input type="radio" name="format_mode" value="preset" class="conditional-trigger"> |
| 295 | Preset format |
| 296 | </label> |
| 297 | <label> |
| 298 | <input type="radio" name="format_mode" value="custom" class="conditional-trigger"> |
| 299 | Custom format |
| 300 | </label> |
| 301 | </div> |
| 302 | |
| 303 | <div class="conditional-content format-preset"> |
| 304 | <div class="form-row"> |
| 305 | <div class="form-group"> |
| 306 | <label for="format">Format</label> |
| 307 | <select name="format"> |
| 308 | <option value="best" selected>best</option> |
| 309 | <option value="worst">worst</option> |
| 310 | <option value="bestvideo+bestaudio">bestvideo+bestaudio</option> |
| 311 | <option value="bestvideo">bestvideo</option> |
| 312 | <option value="bestaudio">bestaudio</option> |
| 313 | </select> |
| 314 | </div> |
| 315 | |
| 316 | <div class="form-group"> |
| 317 | <label for="quality">Max Quality</label> |
| 318 | <select name="quality"> |
| 319 | <option value="" selected>No limit</option> |
| 320 | <option value="720">720p</option> |
| 321 | <option value="1080">1080p</option> |
| 322 | <option value="1440">1440p</option> |
| 323 | <option value="2160">4K (2160p)</option> |
| 324 | </select> |
| 325 | </div> |
| 326 | </div> |
| 327 | </div> |
| 328 | |
| 329 | <div class="conditional-content format-custom"> |
| 330 | <div class="form-group"> |
| 331 | <label for="custom_format">Custom Format</label> |
| 332 | <input type="text" name="custom_format" placeholder="e.g., bestvideo+bestaudio/best or format ID like 22"> |
| 333 | <small>Overrides the format selection. Use yt-dlp format syntax.</small> |
| 334 | </div> |
| 335 | </div> |
| 336 | </div> |
| 337 | |
| 338 | <div class="conditional-section"> |
| 339 | <div class="form-group"> |
| 340 | <label> |
| 341 | <input type="checkbox" name="extract_audio" value="1" class="conditional-trigger"> |
| 342 | Extract audio only |
| 343 | </label> |
| 344 | </div> |
| 345 | <div class="conditional-content"> |
| 346 | <div class="form-group"> |
| 347 | <label>Audio Format</label> |
| 348 | <div class="radio-group"> |
| 349 | <label><input type="radio" name="audio_format" value="mp3"> MP3</label> |
| 350 | <label><input type="radio" name="audio_format" value="flac"> FLAC</label> |
| 351 | <label><input type="radio" name="audio_format" value="wav"> WAV</label> |
| 352 | <label><input type="radio" name="audio_format" value="opus"> Opus</label> |
| 353 | <label><input type="radio" name="audio_format" value="aac"> AAC</label> |
| 354 | <label><input type="radio" name="audio_format" value="" checked> Default (no conversion)</label> |
| 355 | </div> |
| 356 | </div> |
| 357 | </div> |
| 358 | </div> |
| 359 | |
| 360 | <div class="conditional-section"> |
| 361 | <div class="form-group"> |
| 362 | <label> |
| 363 | <input type="checkbox" name="embed_subs" value="1" class="conditional-trigger"> |
| 364 | Embed subtitles |
| 365 | </label> |
| 366 | </div> |
| 367 | <div class="conditional-content"> |
| 368 | <div class="form-group"> |
| 369 | <label for="sub_langs">Subtitle Languages</label> |
| 370 | <input type="text" name="sub_langs" placeholder="e.g., en,de,fr or all" value="en"> |
| 371 | <small>Comma-separated language codes or "all"</small> |
| 372 | </div> |
| 373 | </div> |
| 374 | </div> |
| 375 | |
| 376 | <div class="form-group"> |
| 377 | <label> |
| 378 | <input type="checkbox" name="embed_thumbnail" value="1" checked> |
| 379 | Embed thumbnail |
| 380 | </label> |
| 381 | </div> |
| 382 | |
| 383 | <div class="form-group"> |
| 384 | <label> |
| 385 | <input type="checkbox" name="embed_metadata" value="1" checked> |
| 386 | Embed metadata |
| 387 | </label> |
| 388 | </div> |
| 389 | |
| 390 | <div class="form-group"> |
| 391 | <label> |
| 392 | <input type="checkbox" name="write_info_json" value="1" checked> |
| 393 | Write info JSON |
| 394 | </label> |
| 395 | </div> |
| 396 | |
| 397 | <div class="form-group"> |
| 398 | <label for="output_template">Output Template</label> |
| 399 | <input type="text" name="output_template" |
| 400 | value="%(title)s.%(ext)s"> |
| 401 | <small>Use / for subfolders. Example: %(playlist_title)s/%(title)s.%(ext)s</small> |
| 402 | </div> |
| 403 | |
| 404 | <div class="form-group"> |
| 405 | <label for="custom_flags">Custom Flags</label> |
| 406 | <textarea name="custom_flags" rows="2" placeholder="Any additional yt-dlp flags..."></textarea> |
| 407 | </div> |
| 408 | {{end}} |
| 409 |