diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2680c6a..273da37 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,14 @@
- Desktop/mobile lyrics view following playback, individual track previews,
availability icons, and local version editing in the admin track editor.
+## v0.16.5 — 2026-11-24
+
+- Downloads opens with transfer activity across torrents, YouTube and local
+ files. Filter by status or open a job to see its details.
+- On phones, torrent file selection has a dedicated scrollable view with the
+ download action in reach. Uploads awaiting review remain accessible from
+ the same manager.
+
## v0.16.4 — 2026-11-24
- Artist, playlist and release pages immediately show the outline of the artwork
diff --git a/Cargo.lock b/Cargo.lock
index 822d756..468429c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2062,7 +2062,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "furumusic"
-version = "0.16.4"
+version = "0.16.5"
dependencies = [
"anyhow",
"async-stream",
diff --git a/Cargo.toml b/Cargo.toml
index aa28015..ac7fbe1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "furumusic"
-version = "0.16.4"
+version = "0.16.5"
edition = "2024"
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
diff --git a/src/i18n/phrases.rs b/src/i18n/phrases.rs
index 545fee4..6aa9e51 100644
--- a/src/i18n/phrases.rs
+++ b/src/i18n/phrases.rs
@@ -515,6 +515,18 @@ translations! {
// Player download/history UI
player_torrent_manager: "Download Manager" , "Менеджер загрузок";
+ player_download_title: "Downloads", "Загрузки";
+ player_download_overview: "Overview", "Обзор";
+ player_download_add: "Add", "Добавить";
+ player_download_imports: "Imports", "Импорт";
+ player_download_activity: "Recent activity", "Последние загрузки";
+ player_download_filter_all: "All statuses", "Все статусы";
+ player_download_filter_active: "In progress", "В работе";
+ player_download_filter_attention: "Needs attention", "Требуют внимания";
+ player_download_filter_history: "Finished", "Завершённые";
+ player_download_empty: "No downloads yet", "Загрузок пока нет";
+ player_download_empty_filter: "No downloads with this status", "Нет загрузок с таким статусом";
+ player_download_more: "Show more", "Показать ещё";
player_import_torrent: "Open Download Manager" , "Открыть менеджер загрузок";
player_youtube: "YouTube" , "YouTube";
player_torrents: "Torrents" , "Торренты";
@@ -531,6 +543,7 @@ translations! {
player_youtube_clear_selection: "Clear selection" , "Снять все";
player_youtube_selected_count: "selected" , "выбрано";
player_import_destination: "Add downloads to a playlist" , "Добавить загруженное в плейлист";
+ player_download_playlist_label: "Playlist" , "Плейлист";
player_import_destination_hint: "Selected audio tracks will be added automatically after processing, including tracks already in the library." , "Выбранные аудиотреки будут добавлены автоматически после обработки, включая уже имеющиеся в библиотеке.";
player_youtube_destination: "Add imported tracks to playlist" , "Добавить импортированные треки в плейлист";
player_youtube_no_destination: "Do not add to a playlist" , "Не добавлять в плейлист";
@@ -680,6 +693,7 @@ translations! {
player_failed: "Failed" , "Ошибка";
player_paused: "Paused" , "Пауза";
player_no_torrent_selected: "No torrent selected" , "Торрент не выбран";
+ player_no_torrent_files: "No files available" , "Нет доступных файлов";
player_downloaded: "Downloaded" , "Загружено";
player_speed: "Speed" , "Скорость";
player_down: "down" , "вниз";
diff --git a/templates/player.html b/templates/player.html
index 2baf732..4f9dab4 100644
--- a/templates/player.html
+++ b/templates/player.html
@@ -23,6 +23,13 @@ if ('serviceWorker' in navigator) {
{% include "player/sidebar_styles.html" %}
{% include "player/collection_styles.html" %}
{% include "player/listening_styles.html" %}
+{% if downloads_enabled %}
+
+{% endif %}
{% endblock head_extra %}
{% block body %}
@@ -41,5 +48,6 @@ if ('serviceWorker' in navigator) {
{% include "player/playlist_header_scripts.html" %}
{% include "player/playlist_filter_scripts.html" %}
{% include "player/scripts.html" %}
+{% if downloads_enabled %}{% include "player/download_manager_scripts.html" %}{% endif %}
{% endblock body %}
diff --git a/templates/player/download_destination.html b/templates/player/download_destination.html
new file mode 100644
index 0000000..c64484a
--- /dev/null
+++ b/templates/player/download_destination.html
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ {% if kind == "youtube" %}{{ t.player_youtube_destination_hint }}{% else %}{{ t.player_import_destination_hint }}{% endif %}
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/player/download_files.html b/templates/player/download_files.html
new file mode 100644
index 0000000..901d656
--- /dev/null
+++ b/templates/player/download_files.html
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
{{ t.player_drop_audio_title }}{{ t.player_local_files }}
+ {{ t.player_drop_audio_formats }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% let kind = "local" %}
+ {% include "player/download_destination.html" %}
+
+
+
+
+
+
+
+
+
+
{{ t.player_upload_history }}
+
+
+
+ {{ t.player_loading_content }}{% include "player/skeleton_tracks.html" %}
+
+
{{ t.player_no_file_uploads }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/player/download_imports.html b/templates/player/download_imports.html
new file mode 100644
index 0000000..4f3a00f
--- /dev/null
+++ b/templates/player/download_imports.html
@@ -0,0 +1,204 @@
+
+
+
+
+
{{ t.player_my_uploaded_tracks }}
+
+
+
+
+
+
+ {{ t.player_loading_content }}{% include "player/skeleton_tracks.html" %}
+
+
+
+
+
{{ t.player_no_uploaded_tracks }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ t.player_hidden }}
+
--
+
+
+
+
+
+
+
+
+
{{ t.player_hidden }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/player/download_manager.css b/templates/player/download_manager.css
new file mode 100644
index 0000000..21a9847
--- /dev/null
+++ b/templates/player/download_manager.css
@@ -0,0 +1,129 @@
+.downloads-dialog {
+ --download-gutter: clamp(14px, 2vw, 24px);
+ position: fixed; inset: 0; margin: 0; width: 100%; height: 100%;
+ max-width: none; max-height: none; padding: 16px; border: 0;
+ background: transparent; color: var(--text-primary); color-scheme: dark;
+}
+.downloads-dialog[open] { display: grid; place-items: center; }
+.downloads-dialog::backdrop { background: rgb(0 0 0 / .68); }
+.downloads-shell {
+ display: flex; flex-direction: column; width: min(960px, 100%); height: min(670px, 88dvh);
+ min-height: 0; overflow: hidden; border: 1px solid var(--bg-active); border-radius: 14px;
+ background: var(--bg-secondary); box-shadow: 0 16px 64px #0006;
+}
+.downloads-shell :is(button,input,select,summary,[tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
+.downloads-head {
+ display: flex; align-items: center; flex: none; gap: 12px; padding: 12px var(--download-gutter);
+ border-bottom: 1px solid var(--border-color);
+}
+.downloads-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 21px; line-height: 1.2; }
+.downloads-head h2:focus { outline: none; }
+.downloads-head svg, .downloads-nav svg, .download-activity-row svg, .downloads-empty svg,
+.download-icon-button svg, .download-button svg {
+ width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor;
+ stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round;
+}
+.downloads-head .downloads-mark { color: var(--accent); width: 22px; height: 22px; }
+.download-button, .download-icon-button {
+ display: inline-flex; align-items: center; justify-content: center; gap: 6px;
+ min-height: 34px; padding: 5px 11px; border: 1px solid var(--bg-active); border-radius: 7px;
+ background: var(--bg-elevated); color: var(--text-primary); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
+}
+.download-icon-button { width: 34px; flex: none; padding: 0; border-color: transparent; background: transparent; color: var(--text-secondary); }
+.download-button:hover, .download-icon-button:hover { background: var(--bg-hover); color: var(--text-primary); }
+.download-button.primary { border-color: transparent; background: var(--accent); color: #081a0e; }
+.download-button.primary:hover { background: var(--accent-hover); }
+.downloads-shell button:disabled { opacity: .45; cursor: default; }
+.downloads-shell :is(.download-field,.upload-field input:not([type=checkbox]),.upload-field select,.upload-field textarea,.upload-bulk-bar input,.upload-bulk-bar select),
+.download-list-heading select {
+ min-height: 35px; padding: 6px 9px; border: 1px solid var(--bg-active); border-radius: 6px;
+ background: var(--bg-primary); color: var(--text-primary); font: inherit; font-size: 13px;
+}
+.downloads-add { position: relative; }
+.downloads-add-menu {
+ position: absolute; z-index: 8; inset: calc(100% + 5px) 0 auto auto; min-width: 154px; padding: 4px;
+ border: 1px solid var(--bg-active); border-radius: 8px; background: var(--bg-elevated); box-shadow: 0 8px 22px #0006;
+}
+.downloads-add-menu button, .downloads-nav button {
+ display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
+ color: var(--text-secondary); background: transparent; cursor: pointer; font: inherit; font-size: 13px; text-align: start;
+}
+.downloads-add-menu button { color: var(--text-primary); }
+.downloads-add-menu button:hover, .downloads-nav button:hover { background: var(--bg-hover); color: var(--text-primary); }
+.downloads-layout { display: grid; flex: 1; min-height: 0; grid-template-columns: 148px minmax(0,1fr); }
+.downloads-rail { display: flex; flex-direction: column; padding: 12px 8px; border-inline-end: 1px solid var(--border-color); background: var(--bg-primary); min-width: 0; }
+.downloads-nav { display: grid; gap: 3px; }
+.downloads-nav button { min-height: 38px; }
+.downloads-nav button[aria-selected="true"] { color: #a1e6b6; background: #1d3827; }
+.downloads-nav button small { margin-inline-start: auto; border-radius: 5px; padding: 1px 4px; background: var(--bg-active); color: var(--text-primary); }
+.downloads-worker { display: flex; align-items: center; gap: 7px; margin: auto 5px 0; padding: 10px 5px 0; color: var(--text-secondary); font-size: 11px; }
+.downloads-worker i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--text-subdued); }
+.downloads-worker i.busy { background: var(--accent); }
+.downloads-main, .downloads-content { display: flex; flex: 1; min-height: 0; min-width: 0; flex-direction: column; }
+.downloads-content > [role=tabpanel] { flex: 1; min-width: 0; min-height: 0; }
+.downloads-content > .download-source-pane { padding-top: 15px; }
+.downloads-notice { display: flex; align-items: center; gap: 8px; flex: none; border-bottom: 1px solid var(--border-color); padding: 2px var(--download-gutter); font-size: 12px; color: #b5dbbf; }
+.downloads-notice span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
+.downloads-notice.error { color: #f1abab; }
+.download-overview, .downloads-content > .upload-manager-panel { padding: 14px var(--download-gutter); }
+.download-overview { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
+.download-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
+.download-list-heading h3 { margin: 0; font-size: 16px; }
+.download-list-heading select { max-width: 55%; }
+.download-activity { list-style: none; padding: 0; margin: 0; }
+.download-activity li { border-bottom: 1px solid var(--border-color); }
+.download-activity-row {
+ width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center;
+ gap: 12px; padding: 9px 4px; border: 0; border-radius: 5px; background: transparent;
+ color: var(--text-primary); font: inherit; text-align: start; cursor: pointer;
+}
+.download-activity-row:hover { background: var(--bg-hover); }
+.download-source-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; color: var(--text-secondary); background: var(--bg-elevated); }
+.download-job-title, .download-job-status { display: grid; gap: 3px; min-width: 0; }
+.download-job-title strong,.download-job-title small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
+.download-job-title strong { font-size: 14px; font-weight: 600; }
+.download-job-title small,.download-job-status { font-size: 12px; color: var(--text-secondary); }
+.download-job-status { justify-items: end; text-align: end; max-width: 18ch; }
+.download-job-status[data-group=active] { color: #9adeb0; }
+.download-job-status[data-group=attention] { color: #e3c694; }
+.download-job-status progress { width: 52px; height: 4px; accent-color: var(--accent); }
+.download-more { margin-top: 12px; }
+.downloads-empty { display: grid; justify-items: center; gap: 12px; padding: clamp(32px,9vh,84px) 10px; color: var(--text-secondary); text-align: center; }
+.downloads-empty svg { width: 30px; height: 30px; }
+.downloads-empty p { margin: 0; font-size: 14px; }
+.downloads-shell .upload-manager-grid { grid-template-columns: minmax(0,1fr); }
+.downloads-shell .upload-manager-grid.has-reviews { grid-template-columns: minmax(185px, .6fr) minmax(0,1.4fr); }
+.downloads-shell .upload-library-column { min-width: 0; }
+.downloads-shell .upload-manager-head p { color: var(--text-secondary); }
+@media (prefers-reduced-motion: no-preference) {
+ .downloads-shell, .downloads-content > [role=tabpanel] { animation: download-pane-in 140ms ease-out; }
+ @keyframes download-pane-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
+}
+@media(max-width: 650px) {
+ .downloads-dialog { padding: 0; --download-gutter: 12px; }
+ .downloads-shell { width: 100%; height: 100dvh; border: 0; border-radius: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
+ .downloads-head { gap: 6px; padding: 7px var(--download-gutter); }
+ .downloads-head h2 { font-size: 18px; }
+ .download-button,.download-icon-button { min-height: 40px; }
+ .downloads-head .download-icon-button { width: 40px; }
+ .downloads-add-menu button { min-height: 40px; }
+ .downloads-layout { display: flex; flex-direction: column; }
+ .downloads-rail { flex: none; padding: 0 4px; border: 0; border-bottom: 1px solid var(--border-color); }
+ .downloads-nav { grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 0; }
+ .downloads-nav button { position: relative; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 1px; min-height: 44px; font-size: 11px; text-align: center; }
+ .downloads-nav button[aria-selected="true"] { border-radius: 0; box-shadow: inset 0 -2px var(--accent); background: transparent; }
+ .downloads-nav button small { position: absolute; inset: 1px 1px auto auto; }
+ .downloads-worker { display: none; }
+ .download-overview, .downloads-content > .upload-manager-panel { padding-top: 10px; }
+ .download-activity-row { gap: 7px; }
+ .download-job-status { max-width: 11ch; }
+ .download-job-title strong { font-size: 13px; }
+ .downloads-content > .upload-manager-panel { display: block; overflow: auto; overscroll-behavior: contain; }
+ .downloads-shell .upload-manager-grid { display: flex; flex-direction: column; overflow: visible; }
+ .downloads-shell :is(.upload-library-column,.upload-review-column) { overflow: visible; max-height: none; padding: 0; }
+ .downloads-shell input.download-field { font-size: 16px; }
+}
+@media (max-height: 480px) {
+ .downloads-dialog { padding: 0; }
+ .downloads-shell { height: 100dvh; }
+}
diff --git a/templates/player/download_manager.html b/templates/player/download_manager.html
new file mode 100644
index 0000000..9091c44
--- /dev/null
+++ b/templates/player/download_manager.html
@@ -0,0 +1,62 @@
+
+
+
diff --git a/templates/player/download_manager_scripts.html b/templates/player/download_manager_scripts.html
new file mode 100644
index 0000000..d8df604
--- /dev/null
+++ b/templates/player/download_manager_scripts.html
@@ -0,0 +1,91 @@
+
diff --git a/templates/player/download_overview.html b/templates/player/download_overview.html
new file mode 100644
index 0000000..46a38a0
--- /dev/null
+++ b/templates/player/download_overview.html
@@ -0,0 +1,39 @@
+
+
+
+
{{ t.player_download_activity }}
+
+
+
+ {{ t.player_loading_content }}{% include "player/skeleton_tracks.html" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/player/download_sources.css b/templates/player/download_sources.css
new file mode 100644
index 0000000..3c260b3
--- /dev/null
+++ b/templates/player/download_sources.css
@@ -0,0 +1,146 @@
+.download-source-pane {
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+ min-width: 0;
+ min-height: 0;
+ height: 100%;
+ padding: 0 var(--download-gutter, 16px) 16px;
+ overflow-y: auto;
+ overscroll-behavior: contain;
+ scrollbar-width: thin;
+}
+.download-source-pane > * { flex: none; min-width: 0; }
+.download-link-form { display: grid; gap: 6px; }
+.download-link-form label, .download-destination-label label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
+.download-link-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
+.download-link-controls input, .download-destination-fields :is(select,input) { min-width: 0; width: 100%; }
+.download-destination {
+ display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
+ column-gap: 10px; min-width: 0;
+}
+.download-destination-label { display: flex; align-items: center; gap: 1px; }
+.download-destination-fields { display: flex; min-width: 0; gap: 6px; }
+.download-destination-fields > :is(select, input) { flex: 1 1 0; }
+.download-playlist-help { position: relative; display: inline-flex; }
+.download-help-button {
+ display: grid; place-items: center; width: 28px; height: 30px;
+ border: 0; background: none; border-radius: 5px; color: var(--text-secondary); cursor: help;
+}
+.download-help-button:hover { color: var(--text-primary); background: var(--bg-hover); }
+.download-playlist-help [role=tooltip] {
+ position: absolute; inset-block-end: calc(100% + 3px); inset-inline-start: -42px;
+ width: min(240px, 65vw); z-index: 4; padding: 8px 10px;
+ background: var(--bg-active); color: var(--text-primary); border: 1px solid var(--border-color);
+ box-shadow: 0 4px 15px #0006; border-radius: 6px; font-size: 12px; line-height: 1.45;
+}
+.download-source-history { min-width: 0; }
+.download-history-heading, .download-preview-title, .download-selection-actions, .download-job-actions, .download-pick-actions {
+ display: flex; align-items: center; gap: 8px;
+}
+.download-history-heading, .download-preview-title { justify-content: space-between; }
+.download-history-heading { padding-bottom: 5px; border-bottom: 1px solid var(--border-color); }
+.download-history-heading h4, .download-preview-title h4 { margin: 0; color: var(--text-primary); font-size: 14px; font-weight: 650; line-height: 1.35; }
+.download-source-empty { margin: 0; padding: 15px 0; color: var(--text-secondary); font-size: 13px; }
+.download-preview-title { min-width: 0; }
+.download-preview-title h4 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.download-preview-title > span { flex: none; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
+.download-video-preview, .download-local-selection { display: grid; gap: 10px; min-width: 0; }
+.download-video-picker { min-width: 0; border-block: 1px solid var(--border-color); }
+.download-video-all, .download-video-row {
+ display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 35px;
+ padding: 5px 8px; cursor: pointer; font-size: 13px;
+}
+.download-video-all { background: var(--bg-secondary); font-weight: 600; }
+.download-video-row:hover, .download-job-summary:hover { background: var(--bg-hover); }
+.download-video-all input, .download-video-row input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
+.download-video-list { max-height: min(42dvh, 410px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
+.download-video-row > :last-child { overflow-wrap: anywhere; }
+.download-video-index, .download-job-progress-number { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
+.download-selection-actions { justify-content: end; flex-wrap: wrap; }
+.download-local-drop {
+ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
+ padding: 12px; border: 1px dashed var(--bg-active); border-radius: 8px; background: var(--bg-primary);
+ transition: border-color 140ms, background 140ms;
+}
+.download-local-drop.dragging { border-color: var(--accent); background: #1db95410; }
+.download-local-lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
+.download-local-lead > svg { width: 21px; height: 21px; color: var(--text-secondary); }
+.download-source-pane svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
+.download-local-lead strong, .download-local-lead small, .download-job-name strong, .download-job-name small, .download-item-main > :is(strong,small) { display: block; }
+.download-local-lead strong { font-size: 13px; }
+.download-local-lead small, .download-job-name small, .download-item-main > small { color: var(--text-secondary); font-size: 12px; line-height: 1.4; }
+.download-local-lead .download-local-mobile { display: none; }
+.download-job, .download-file-job { border-bottom: 1px solid var(--border-color); }
+.download-job-summary, .download-file-job, .download-track-details summary {
+ display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto;
+ align-items: center; gap: 10px; min-width: 0; padding: 8px 4px;
+}
+.download-job-summary {
+ width: 100%; text-align: start; border: 0; border-radius: 4px;
+ background: transparent; color: var(--text-primary); cursor: pointer; font: inherit;
+}
+.download-job-chevron, .download-file-symbol { width: 16px; height: 16px; color: var(--text-secondary); }
+.download-job-chevron { transition: transform 140ms; }
+.download-job-summary[aria-expanded=true] .download-job-chevron { transform: rotate(90deg); }
+.download-job-summary :is(strong, small), .download-file-job :is(strong, small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.download-job-name { min-width: 0; }
+.download-job-name strong, .download-item-main > strong { font-size: 13px; font-weight: 600; }
+.download-job-detail { display: grid; gap: 8px; padding: 3px 5px 12px 32px; }
+.download-job-disclosure { display: grid; grid-template-rows: 0fr; opacity: 0; }
+.download-job-disclosure.opened { grid-template-rows: 1fr; opacity: 1; }
+.download-job-disclosure > div { min-height: 0; overflow: hidden; }
+@media (prefers-reduced-motion: no-preference) {
+ .download-job-disclosure { transition: grid-template-rows 140ms ease, opacity 140ms; }
+}
+.download-source-progress { display: grid; gap: 4px; color: var(--text-secondary); font-size: 12px; }
+.download-source-progress div { display: flex; justify-content: space-between; gap: 8px; }
+.download-source-progress progress { display: block; width: 100%; height: 4px; border: 0; border-radius: 3px; background: var(--bg-active); color: var(--accent); accent-color: var(--accent); }
+.download-source-progress progress::-webkit-progress-bar { background: var(--bg-active); border-radius: 3px; }
+.download-source-progress progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
+.download-source-progress progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
+.download-job-items { display: grid; margin: 0; padding: 0; list-style: none; }
+.download-track-details summary { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; padding-inline: 0; cursor: pointer; list-style: none; }
+.download-track-details summary::-webkit-details-marker { display: none; }
+.download-track-details summary:hover { color: var(--accent-hover); }
+.download-track-details summary .torrent-status-badge::after {
+ content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 1px 2px 6px;
+ border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg);
+}
+.download-track-details[open] summary .torrent-status-badge::after { transform: rotate(225deg); }
+@media (prefers-reduced-motion: no-preference) {
+ .download-track-details summary .torrent-status-badge::after { transition: transform 140ms; }
+}
+.download-steps { display: flex; flex-wrap: wrap; gap: 5px 14px; padding: 3px 0 8px; list-style: none; }
+.download-steps li { color: var(--text-secondary); font-size: 11px; }
+.download-steps li::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 4px; border: 1px solid var(--text-secondary); border-radius: 50%; }
+.download-steps li.done::before, .download-steps li.active::before { border-color: var(--accent); }
+.download-steps li.done::before { background: var(--accent); }
+.download-steps li:is(.failed,.cancelled)::before { border-color: #eba8a8; background: #eba8a8; }
+.download-item-main { min-width: 0; overflow-wrap: anywhere; }
+.download-job-actions { flex-wrap: wrap; }
+.download-source-error { margin: 4px 0 0; overflow-wrap: anywhere; color: #eba8a8; font-size: 12px; }
+.download-file-job > .download-source-error { grid-column: 2 / -1; }
+.download-file-remove:hover { color: #eba8a8; }
+.download-source-pane .torrent-status-badge { max-width: 30ch; font-weight: 600; text-transform: none; white-space: normal; line-height: 1.25; }
+@media (max-width: 600px) {
+ .download-source-pane { gap: 12px; }
+ .download-link-controls { gap: 5px; }
+ .download-destination { align-items: start; gap: 6px; }
+ .download-destination-label { min-height: 38px; }
+ .download-destination-fields { flex-direction: column; }
+ .download-destination-fields > :is(select,input) { flex: auto; }
+ .download-video-list { max-height: 42dvh; }
+ .download-video-all, .download-video-row { min-height: 40px; }
+ .download-local-lead .download-local-desktop { display: none; }
+ .download-local-lead .download-local-mobile { display: block; }
+ .download-job-summary { grid-template-columns: 14px minmax(0, 1fr) auto; }
+ .download-job-progress-number { display: none; }
+ .download-job-detail { padding-inline: 2px; }
+ .download-job-summary, .download-file-job, .download-track-details summary { gap: 6px; }
+ .download-source-pane .torrent-status-badge { max-width: 13ch; }
+}
+@media (prefers-reduced-motion: reduce) {
+ .download-local-drop, .download-job-chevron { transition: none; }
+ .download-playlist-help [role=tooltip] { transition-duration: 0s !important; }
+}
diff --git a/templates/player/download_torrent.css b/templates/player/download_torrent.css
new file mode 100644
index 0000000..e7e98de
--- /dev/null
+++ b/templates/player/download_torrent.css
@@ -0,0 +1,106 @@
+.download-torrent-panel {
+ display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; height: 100%; min-width: 0;
+ padding: 0 var(--download-gutter) 12px; overflow: hidden;
+}
+.torrent-sessions, .torrent-task, .torrent-session-detail {
+ display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0;
+}
+.torrent-task, .torrent-session-detail { overflow-y: auto; overscroll-behavior: contain; }
+.torrent-pane-head {
+ display: flex; align-items: center; gap: 8px; flex: none; min-height: 52px;
+ padding: 6px 0; border-bottom: 1px solid var(--border-color);
+}
+.torrent-pane-head h4 { min-width: 0; flex: 1; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; line-height: 1.3; }
+.torrent-pane-head h4 small { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
+.download-torrent-panel svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
+.download-torrent-panel :is(button, input, select, summary, [tabindex="0"]):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
+.torrent-sessions-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
+.torrent-pane-empty { margin: 0; padding: 24px 0; color: var(--text-secondary); font-size: 13px; }
+.torrent-session-open {
+ display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
+ width: 100%; min-height: 58px; padding: 9px 8px; border: 0; border-bottom: 1px solid var(--border-color);
+ border-radius: 0; background: transparent; color: var(--text-secondary); text-align: start; font: inherit; cursor: pointer;
+}
+.torrent-session-open:hover { background: var(--bg-hover); }
+.torrent-session-open .torrent-session-icon { width: 20px; height: 20px; }
+.torrent-session-copy { display: grid; gap: 4px; min-width: 0; }
+.torrent-session-copy :is(strong, small) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
+.torrent-session-copy strong { color: var(--text-primary); font-size: 14px; font-weight: 600; }
+.torrent-session-copy small, .torrent-transfer-summary small, .torrent-node small { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
+.download-torrent-panel progress { display: block; width: min(140px, 100%); height: 3px; appearance: none; overflow: hidden; border: 0; border-radius: 4px; background: var(--bg-active); color: var(--accent); }
+.download-torrent-panel progress::-webkit-progress-bar { background: var(--bg-active); }
+.download-torrent-panel progress::-webkit-progress-value { background: var(--accent); }
+.download-torrent-panel progress::-moz-progress-bar { background: var(--accent); }
+.torrent-source-form {
+ flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
+ width: min(100%, 648px); padding: 18px 0;
+}
+.torrent-source-form .torrent-input-label, .torrent-source-form > input { grid-column: 1 / -1; }
+.torrent-source-form .torrent-input-label { margin: 0; color: var(--text-secondary); font-size: 13px; }
+.torrent-source-form input[type="text"] { min-width: 0; width: 100%; margin: 0; }
+.torrent-source-form .torrent-file-source {
+ position: relative; display: flex; align-items: center; gap: 8px; justify-self: start; min-width: 0; max-width: 100%; min-height: 36px;
+ margin: 0; padding: 4px 10px; border: 1px dashed var(--border-color); border-radius: 6px;
+ color: var(--text-secondary); cursor: pointer; font-size: 13px;
+}
+.torrent-file-source:hover, .torrent-source-form .torrent-file-source.picked { background: var(--bg-hover); color: var(--text-primary); }
+.torrent-file-source:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
+.torrent-file-source input[type="file"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
+.torrent-file-source span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.torrent-file-source small { font-weight: 400; font-size: 12px; color: var(--text-secondary); }
+.torrent-transfer-summary { display: flex; align-items: center; gap: 8px; flex: none; min-height: 42px; }
+.torrent-live-progress { display: flex; align-items: center; gap: 7px; margin-inline-start: auto; }
+.torrent-live-progress progress { width: clamp(22px, 8vw, 100px); }
+.torrent-transfer-info { position: relative; margin-inline-start: auto; }
+.torrent-transfer-info summary { list-style: none; cursor: pointer; }
+.torrent-transfer-info summary::-webkit-details-marker { display: none; }
+.torrent-transfer-info dl { position: absolute; z-index: 4; inset: 100% 0 auto auto; width: min(260px, 65vw); margin: 0; padding: 8px 12px; border: 1px solid var(--bg-active); border-radius: 8px; background: var(--bg-elevated); box-shadow: 0 6px 22px #0007; }
+.torrent-transfer-info dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-block: 4px; font-size: 12px; }
+.torrent-transfer-info dt { color: var(--text-secondary); }
+.torrent-transfer-info dd { margin: 0; text-align: end; overflow-wrap: anywhere; }
+.torrent-selection-tools {
+ display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; min-height: 36px; padding: 0 6px;
+ background: var(--bg-elevated); border: 1px solid var(--border-color); border-bottom: 0; border-radius: 7px 7px 0 0;
+}
+.torrent-selection-tools .torrent-master-check { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0; cursor: pointer; color: var(--text-secondary); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
+.torrent-tree-controls { display: flex; }
+.download-torrent-panel input[type="checkbox"] { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
+.torrent-session-detail .torrent-file-tree {
+ flex: 1 1 auto; min-height: 100px; margin: 0; overflow: auto; overscroll-behavior: contain;
+ border: 1px solid var(--border-color); border-radius: 0 0 7px 7px; background: var(--bg-primary);
+}
+.torrent-file-tree .torrent-tree-row {
+ display: flex; align-items: stretch; gap: 0; min-height: 35px; padding: 0 9px 0 calc(4px + var(--depth, 0) * 12px);
+ border-bottom: 1px solid var(--border-color);
+}
+.torrent-file-tree .torrent-tree-row:last-child { border-bottom: 0; }
+.torrent-file-tree .torrent-tree-row:hover { background: var(--bg-hover); }
+.torrent-folder-toggle { display: grid; place-items: center; flex: none; width: 28px; padding: 0; border: 0; border-radius: 4px; color: var(--text-secondary); background: transparent; cursor: pointer; }
+.torrent-folder-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
+.torrent-folder-toggle svg { width: 14px; height: 14px; transition: transform 120ms ease; }
+.torrent-folder-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
+.torrent-file-tree .torrent-node { display: flex; align-items: center; flex: 1; gap: 8px; min-width: 0; margin: 0; color: var(--text-primary); cursor: pointer; font-size: 13px; font-weight: 400; }
+.torrent-node span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.torrent-node svg { color: var(--text-secondary); width: 15px; }
+.torrent-node small { white-space: nowrap; }
+.torrent-start-bar { display: flex; gap: 12px; align-items: end; justify-content: space-between; flex: none; padding: 10px 0 0; }
+.torrent-start-bar .download-destination { flex: 1; min-width: 0; max-width: 510px; }
+.torrent-start { flex: none; }
+.torrent-loading { overflow: hidden; }
+@media(max-width: 600px) {
+ .torrent-pane-head { min-height: 47px; gap: 4px; }
+ .torrent-pane-head h4 { font-size: 15px; }
+ .torrent-session-open { gap: 6px; padding-inline: 3px; }
+ .torrent-pane-head :is(.download-button,.download-icon-button), .torrent-start, .torrent-file-source { min-height: 40px; }
+ .torrent-file-source small { display: none; }
+ .torrent-file-tree .torrent-tree-row { min-height: 40px; padding-inline-start: calc(2px + var(--depth, 0) * 6px); }
+ .torrent-folder-toggle { width: 32px; }
+ .torrent-selection-tools .torrent-master-check { min-height: 40px; }
+ .torrent-start-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding-top: 8px; }
+ .torrent-start-bar .download-destination { max-width: none; }
+}
+@media (prefers-reduced-motion: no-preference) {
+ .torrent-task, .torrent-sessions, .torrent-transfer-info[open] dl { animation: torrent-pane-in 130ms ease-out; }
+ @keyframes torrent-pane-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
+}
+@media (prefers-reduced-motion: reduce) { .torrent-folder-toggle svg { transition: none; } }
diff --git a/templates/player/download_torrent.html b/templates/player/download_torrent.html
new file mode 100644
index 0000000..84186d1
--- /dev/null
+++ b/templates/player/download_torrent.html
@@ -0,0 +1,156 @@
+
+
+
+
+
+ {{ t.player_saved_torrents }}
+
+
+
+
+
+ {{ t.player_loading_content }}
+ {% include "player/skeleton_tracks.html" %}
+
+
+
+ {{ t.player_no_saved_torrents }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t.player_loading_content }}
+ {% include "player/skeleton_tracks.html" %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - {{ t.player_status }}
+ - {{ t.player_size }}
+ - {{ t.player_speed }}
+ - {{ t.player_peers }}
+ - {{ t.player_eta }}
+
+
+
+
+
+
+
+ {{ t.player_resolving }}
+ {% include "player/skeleton_tracks.html" %}
+
+
+
+ {{ t.player_no_torrent_files }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/player/download_youtube.html b/templates/player/download_youtube.html
new file mode 100644
index 0000000..a08feae
--- /dev/null
+++ b/templates/player/download_youtube.html
@@ -0,0 +1,131 @@
+
+
+
+
+ {% include "player/skeleton_tracks.html" %}
+
+
+
+
+
+
+
+
+ {% let kind = "youtube" %}
+ {% include "player/download_destination.html" %}
+
+
+
+
+
+
+
+
+
{{ t.player_youtube_downloads }}
+
+
+
+ {{ t.player_loading_content }}{% include "player/skeleton_tracks.html" %}
+
+
{{ t.player_no_youtube_downloads }}
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+ - {{ t.player_downloading }}
+ - FFmpeg
+ - {{ t.player_ai_prefix }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/player/modals.html b/templates/player/modals.html
index f7733ea..3475b44 100644
--- a/templates/player/modals.html
+++ b/templates/player/modals.html
@@ -89,885 +89,7 @@
-
-
-
-
-
-
-
{{ t.player_torrent_manager }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% if youtube_downloads_enabled %}
-
- {% endif %}
- {% if torrent_downloads_enabled %}
-
- {% endif %}
-
-
-
-
-
-
-
-
-
-
-
-
{{ t.player_youtube_preview_title }}
-
-
- ·
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t.player_youtube_destination_hint }}
-
-
-
-
-
-
- {{ t.player_youtube_downloads }}
-
-
-
-
-
-
-
{{ t.player_no_youtube_downloads }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t.player_downloading }}
-
-
- FFmpeg
-
-
- {{ t.player_ai_prefix }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t.player_import_destination_hint }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t.player_audio_folder_hint }}
-
-
-
-
-
-
-
-
-
{{ t.player_import_destination_hint }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t.player_upload_history }}
-
-
-
-
-
- {{ t.player_no_file_uploads }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t.player_my_uploaded_tracks }}
-
-
-
-
-
-
-
-
{{ t.player_no_uploaded_tracks }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ t.player_hidden }}
-
--
-
-
-
-
-
-
-
-
-
{{ t.player_hidden }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t.player_hidden }}
-
-
-
- ·
-
- ·
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {% if downloads_enabled %}{% include "player/download_manager.html" %}{% endif %}
diff --git a/templates/player/scripts.html b/templates/player/scripts.html
index 9f6b9a5..f122a57 100644
--- a/templates/player/scripts.html
+++ b/templates/player/scripts.html
@@ -4949,7 +4949,9 @@ document.addEventListener('alpine:init', () => {
downloadsEnabled: {{ downloads_enabled }},
torrentDownloadsEnabled: {{ torrent_downloads_enabled }},
youtubeDownloadsEnabled: {{ youtube_downloads_enabled }},
- sourceTab: {% if youtube_downloads_enabled %}'youtube'{% else if torrent_downloads_enabled %}'torrents'{% else %}'files'{% endif %},
+ sourceTab: 'overview',
+ overviewLoading: false,
+ overviewLoaded: false,
youtubeUrl: '',
youtubePreview: null,
youtubePreviewSelected: new Set(),
@@ -4961,11 +4963,10 @@ document.addEventListener('alpine:init', () => {
localTargetPlaylistId: null,
youtubePlaylistChoice: '',
youtubeNewPlaylistTitle: '',
- youtubePlaylistSyncKey: '',
+ downloadPlaylistStates: {},
youtubePreviewLoading: false,
youtubeJobs: [],
youtubeExpandedJobId: null,
- youtubeJobsInitialized: false,
youtubeLoading: false,
youtubeSubmitting: false,
youtubeCancellingIds: new Set(),
@@ -4980,6 +4981,7 @@ document.addEventListener('alpine:init', () => {
magnet: '',
sessions: [],
loadingSessions: false,
+ sessionsLoaded: false,
currentJob: null,
previewData: null,
workspaceMode: 'empty',
@@ -5029,16 +5031,13 @@ document.addEventListener('alpine:init', () => {
},
open() {
- if (!this.downloadsEnabled) return;
+ if (!this.downloadsEnabled || this.modal) return;
+ this.sourceTab = 'overview';
this.modal = true;
Alpine.store('playlists')?.reload?.();
this.message = '';
this.error = false;
- if (this.sourceTab === 'youtube') this.loadYoutubeJobs();
- else if (this.sourceTab === 'uploads') this.loadUploads();
- else if (this.sourceTab === 'files') this.loadLocalUploadHistory();
- else this.loadSessions();
- if (this.sourceTab !== 'uploads') this.loadUploads({ silent: true });
+ this.refreshDownloads();
this.loadAgentStatus();
this._startRefresh();
},
@@ -5060,21 +5059,31 @@ document.addEventListener('alpine:init', () => {
},
showSourceTab(tab) {
- const tabs = ['files', 'uploads'];
- if (this.youtubeDownloadsEnabled) tabs.unshift('youtube');
- if (this.torrentDownloadsEnabled) tabs.unshift('torrents');
- this.sourceTab = tabs.includes(tab) ? tab : tabs[0];
+ if (tab === 'torrents' && !this.torrentDownloadsEnabled || tab === 'youtube' && !this.youtubeDownloadsEnabled) return;
+ if (this.sourceTab === tab) return;
+ this._stopPoll();
+ if (tab === 'torrents') this.showTorrentOverview();
+ this.sourceTab = tab;
this._setMessage('');
- if (this.sourceTab === 'youtube') this.loadYoutubeJobs();
- else if (this.sourceTab === 'uploads') {
- this._stopPoll();
- this.loadUploads();
+ this.refreshDownloads();
+ },
+
+ async refreshDownloads(silent = false) {
+ if (this.sourceTab === 'youtube') return this.loadYoutubeJobs({silent});
+ if (this.sourceTab === 'files') return this.loadLocalUploadHistory({silent});
+ if (this.sourceTab === 'uploads') return this.loadUploads({silent});
+ if (this.sourceTab === 'torrents') return this.loadSessions({silent});
+ if (this.overviewLoading) return;
+ this.overviewLoading = true;
+ try {
+ const requests = [this.loadLocalUploadHistory({silent})];
+ if (this.youtubeDownloadsEnabled) requests.push(this.loadYoutubeJobs({silent}));
+ if (this.torrentDownloadsEnabled) requests.push(this.loadSessions({silent}));
+ await Promise.all(requests);
+ this.overviewLoaded = true;
+ } finally {
+ this.overviewLoading = false;
}
- else if (this.sourceTab === 'files') {
- this._stopPoll();
- this.loadLocalUploadHistory();
- }
- else this.loadSessions();
},
async loadYoutubeJobs({ silent = false } = {}) {
@@ -5090,25 +5099,7 @@ document.addEventListener('alpine:init', () => {
) {
this.youtubeExpandedJobId = null;
}
- if (!this.youtubeJobsInitialized) {
- const activeJob = this.youtubeJobs.find(job => !this.youtubeJobTerminal(job.status));
- this.youtubeExpandedJobId = this.youtubePreview ? null : (activeJob?.id || null);
- this.youtubeJobsInitialized = true;
- }
- const playlistSyncKey = this.youtubeJobs
- .filter(job => Number(job.target_playlist_id || 0) > 0)
- .map(job => [
- job.id,
- job.status,
- Number(job.completed_items || 0),
- Number(job.failed_items || 0),
- Number(job.review_items || 0),
- ].join(':'))
- .join('|');
- if (playlistSyncKey && playlistSyncKey !== this.youtubePlaylistSyncKey) {
- this.youtubePlaylistSyncKey = playlistSyncKey;
- Alpine.store('playlists')?.reload?.();
- }
+ this.refreshChangedPlaylists('youtube', this.youtubeJobs);
} catch (err) {
if (!silent) this._setMessage(err.message || T.youtubeLoadFailed, true);
} finally {
@@ -5116,6 +5107,15 @@ document.addEventListener('alpine:init', () => {
}
},
+ refreshChangedPlaylists(source, jobs) {
+ const state = jobs.filter(job => job.target_playlist_id)
+ .map(job => [job.id, job.target_playlist_id, job.status, job.completed_items, job.failed_items, job.review_items].join(':'))
+ .sort().join('|');
+ const previous = this.downloadPlaylistStates[source];
+ this.downloadPlaylistStates[source] = state;
+ if (previous !== undefined && previous !== state) Alpine.store('playlists')?.reload?.();
+ },
+
clearYoutubePreview() {
this.youtubePreview = null;
this.youtubePreviewSelected = new Set();
@@ -5498,16 +5498,19 @@ document.addEventListener('alpine:init', () => {
this._stopPoll();
this.workspaceMode = 'new';
this.file = null;
- this.localFiles = [];
this.magnet = '';
- this.uploadProgress = 0;
- this.uploadProgressText = '';
this.currentJob = null;
this.previewData = null;
this.treeRoot = null;
this.selected = new Set();
this.expanded = new Set();
- this._setMessage(T.chooseTorrent);
+ this._setMessage('');
+ },
+
+ showTorrentOverview() {
+ this._stopPoll();
+ this.workspaceMode = 'empty';
+ this._setMessage('');
},
_setMessage(message, error = false) {
@@ -5642,16 +5645,13 @@ document.addEventListener('alpine:init', () => {
progressDetailText(job) {
if (!job) return '';
- const size = this.bytes(job.selected_size || job.total_size);
- if (this.isCompleted(job)) return size;
+ const bytes = job.selected_size || job.total_size || this.previewData?.total_size;
+ if (!bytes) return '';
+ const size = this.bytes(bytes);
+ if (this.isCompleted(job) || !job.downloaded_bytes) return size;
return this.bytes(job.downloaded_bytes) + ' / ' + size;
},
- actionButtonClass() {
- if (this.isCurrentCompletedLocked()) return 'modal-btn-ghost';
- return this.isCurrentDownloading() ? 'modal-btn-pause' : 'modal-btn-primary';
- },
-
actionButtonText() {
if (this.normalizedStatus(this.currentJob) === 'resolving') return T.resolving;
if (this.isCurrentCompletedLocked()) return T.completed;
@@ -5660,7 +5660,7 @@ document.addEventListener('alpine:init', () => {
actionButtonDisabled() {
return this.loading
- || (!this.isCurrentDownloading() && !this.importDestinationValid('torrent'))
+ || (!this.isCurrentDownloading() && (!this.selected.size || !this.importDestinationValid('torrent')))
|| this.isCurrentCompletedLocked()
|| this.normalizedStatus(this.currentJob) === 'resolving'
|| !this.previewData
@@ -6164,16 +6164,7 @@ document.addEventListener('alpine:init', () => {
this._stopRefresh();
this._refreshTimer = setInterval(() => {
if (!this.modal) return;
- if (this.sourceTab === 'youtube') {
- this.loadYoutubeJobs({ silent: true });
- }
- else if (this.sourceTab === 'uploads') {
- this.loadUploads({ silent: true });
- }
- else if (this.sourceTab === 'files') {
- this.loadLocalUploadHistory({ silent: true });
- }
- else this.loadSessions();
+ this.refreshDownloads(true);
this.loadAgentStatus();
}, 5000);
},
@@ -6209,10 +6200,7 @@ document.addEventListener('alpine:init', () => {
const job = data.job || null;
this.workspaceMode = 'session';
this.file = null;
- this.localFiles = [];
this.magnet = '';
- this.uploadProgress = 0;
- this.uploadProgressText = '';
this.previewData = preview;
this.currentJob = job;
this.torrentPlaylistChoice = job?.target_playlist_id ? String(job.target_playlist_id) : '';
@@ -6225,33 +6213,34 @@ document.addEventListener('alpine:init', () => {
if (job) this._rememberJob(job);
},
- async loadSessions() {
+ async loadSessions({silent = false} = {}) {
this.loadingSessions = true;
try {
const res = await fetch('/api/player/torrents');
const data = await res.json();
if (!res.ok) throw new Error(data.error || T.loadTorrentsFailed);
this.sessions = Array.isArray(data) ? data : [];
- if (this.sessions.some(job => job.target_playlist_id)) Alpine.store('playlists')?.reload?.();
+ this.refreshChangedPlaylists('torrents', this.sessions);
this._syncCurrentJobFromSessions();
- await this._refreshResolvedSelection();
+ if (this.sourceTab === 'torrents') await this._refreshResolvedSelection();
} catch (err) {
- this._setMessage(err.message || String(err), true);
+ if (!silent) this._setMessage(err.message || String(err), true);
} finally {
+ this.sessionsLoaded = true;
this.loadingSessions = false;
}
},
async _refreshResolvedSelection() {
- if (!this.currentJob || !this.previewData || (this.previewData.files || []).length > 0) return;
+ if (this.workspaceMode !== 'session' || !this.currentJob || !this.previewData || (this.previewData.files || []).length > 0) return;
const selected = this.sessions.find(job => job.id === this.currentJob.id);
if (!selected || this.normalizedStatus(selected) === 'resolving') return;
try {
const res = await fetch(`/api/player/torrents/session/${selected.id}`);
const data = await res.json();
- if (!res.ok) return;
+ if (!res.ok || !this._isSelectedJob(selected.id)) return;
this._applySession(data);
- this._setMessage(T.allFilesSelected);
+ this._setMessage('');
} catch {}
},
@@ -6259,18 +6248,22 @@ document.addEventListener('alpine:init', () => {
if (!id || this.loading) return;
this._stopPoll();
this.loading = true;
- this._setMessage(T.openingSavedTorrent);
+ this.workspaceMode = 'opening';
+ this._setMessage('');
try {
const res = await fetch(`/api/player/torrents/session/${id}`);
const data = await res.json();
+ if (this.workspaceMode !== 'opening' || !this.modal || this.sourceTab !== 'torrents') return;
if (!res.ok) throw new Error(data.error || T.openTorrentFailed);
this._applySession(data);
- this._setMessage(T.savedTorrentOpened);
if (data.job && (data.job.active || data.job.status === 'downloading' || data.job.status === 'moving')) {
this._poll(data.job.id);
}
} catch (err) {
- this._setMessage(err.message || String(err), true);
+ if (this.workspaceMode === 'opening') {
+ this.workspaceMode = 'empty';
+ this._setMessage(err.message || String(err), true);
+ }
} finally {
this.loading = false;
}
@@ -6286,11 +6279,12 @@ document.addEventListener('alpine:init', () => {
if (!res.ok) throw new Error(data.error || T.deleteTorrentFailed);
this.sessions = this.sessions.filter(job => job.id !== id);
if (this.previewData && this.previewData.id === id) {
+ this._stopPoll();
this.previewData = null;
this.currentJob = null;
this.treeRoot = null;
this.selected = new Set();
- this.workspaceMode = this.sessions.length ? 'empty' : 'new';
+ this.workspaceMode = 'empty';
}
this._setMessage(T.torrentRemoved);
} catch (err) {
@@ -6466,7 +6460,7 @@ document.addEventListener('alpine:init', () => {
const data = await res.json().catch(() => null);
if (!res.ok) throw new Error(data?.error || T.fileUploadLoadFailed);
this.localUploadHistory = Array.isArray(data) ? data : [];
- if (this.localUploadHistory.some(item => item.target_playlist_id)) Alpine.store('playlists')?.reload?.();
+ this.refreshChangedPlaylists('files', this.localUploadHistory);
} catch (err) {
if (!silent) this._setMessage(err.message || T.fileUploadLoadFailed, true);
} finally {
@@ -6509,7 +6503,7 @@ document.addEventListener('alpine:init', () => {
this.workspaceMode = 'new';
this.selected = new Set();
this.expanded = new Set();
- this._setMessage(this.file ? T.readingTorrent : T.resolvingMagnet);
+ this._setMessage('');
try {
const payload = this.file
@@ -6522,9 +6516,7 @@ document.addEventListener('alpine:init', () => {
});
const data = await res.json();
if (!res.ok) throw new Error(data.error || T.previewFailed);
-
- this._applySession(data);
- this._setMessage((data.preview?.files || []).length ? T.allFilesSelected : T.resolving);
+ if (this.isImporting() && this.modal && this.sourceTab === 'torrents') this._applySession(data);
await this.loadSessions();
} catch (err) {
this._setMessage(err.message || String(err), true);
@@ -6657,10 +6649,6 @@ document.addEventListener('alpine:init', () => {
return rows;
},
- rowIndent(node) {
- return Math.min(10 + Math.max(node.depth, 0) * 18, 82);
- },
-
toggleExpand(node) {
if (node.type !== 'folder') return;
const next = new Set(this.expanded);
@@ -6691,14 +6679,6 @@ document.addEventListener('alpine:init', () => {
return 'partial';
},
- nodeCheckClass(node) {
- const state = this.nodeState(node);
- return {
- checked: state === 'checked',
- partial: state === 'partial',
- };
- },
-
toggleNode(node) {
const next = new Set(this.selected);
if (node.type === 'file') {
@@ -6739,7 +6719,7 @@ document.addEventListener('alpine:init', () => {
this.currentJob = data;
this._rememberJob(data);
this._setMessage(T.downloadStarted);
- this._poll(data.id);
+ if (this._isSelectedJob(data.id) && this.modal && this.sourceTab === 'torrents') this._poll(data.id);
await this.loadSessions();
} catch (err) {
this._setMessage(err.message || String(err), true);
@@ -6778,14 +6758,11 @@ document.addEventListener('alpine:init', () => {
try {
const res = await fetch(`/api/player/torrents/${id}/status`);
const data = await res.json();
+ if (this._pollJobId !== id) return;
if (!res.ok) throw new Error(data.error || T.statusFailed);
this._rememberJob(data);
- if (this._isSelectedJob(id)) {
- this.currentJob = data;
- this._setMessage(
- this.statusLabel(data) + ' - ' + this.progressValue(data).toFixed(1) + '% - ' + this.bytes(data.downloaded_bytes),
- data.status === 'failed'
- );
+ if (this._isSelectedJob(id) && data.status === 'failed') {
+ this._setMessage(this.statusText(data), true);
}
if (data.status === 'complete' || data.status === 'failed') {
this._stopPoll();
@@ -6793,6 +6770,7 @@ document.addEventListener('alpine:init', () => {
this.loadAgentStatus();
}
} catch (err) {
+ if (this._pollJobId !== id) return;
if (this._isSelectedJob(id)) this._setMessage(err.message || String(err), true);
this._stopPoll();
}
diff --git a/templates/player/styles.html b/templates/player/styles.html
index ebe80cd..450fc2c 100644
--- a/templates/player/styles.html
+++ b/templates/player/styles.html
@@ -3440,10 +3440,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
.modal-btn:hover { filter: brightness(1.1); }
.modal-btn-primary { background: var(--accent); color: #000; }
-.modal-btn-pause {
- background: #f0b84d;
- color: #111;
-}
.modal-btn-ghost { background: transparent; color: var(--text-secondary); }
.modal-btn-danger {
background: rgba(229,96,96,0.16);
@@ -3457,842 +3453,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
gap: 8px;
}
-.torrent-modal {
- width: min(1180px, calc(100vw - 48px));
- max-width: 1180px;
- height: min(820px, calc(100dvh - 64px));
- max-height: calc(100dvh - 64px);
- overflow: hidden;
-}
-
-.torrent-modal.youtube-mode {
- width: min(1440px, calc(100vw - 32px));
- max-width: 1440px;
-}
-
-.torrent-modal-head {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: 14px;
- margin-bottom: 12px;
- flex: 0 0 auto;
- position: relative;
-}
-
-.torrent-modal-head h3 {
- margin: 0;
-}
-
-.torrent-client-status {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- justify-content: flex-end;
- gap: 6px;
- min-width: 0;
- color: var(--text-subdued);
- font-size: 12px;
-}
-
-.torrent-status-pill {
- display: inline-flex;
- align-items: center;
- gap: 5px;
- min-height: 24px;
- padding: 3px 8px;
- border-radius: 999px;
- background: var(--bg-primary);
- border: 1px solid var(--border-color);
- color: var(--text-secondary);
- font-size: 12px;
- white-space: nowrap;
-}
-
-.torrent-modal-close {
- display: none;
- align-items: center;
- justify-content: center;
- flex: 0 0 auto;
- width: 34px;
- height: 34px;
- border: 1px solid var(--border-color);
- border-radius: 999px;
- background: var(--bg-primary);
- color: var(--text-secondary);
- cursor: pointer;
-}
-
-.torrent-modal-close svg {
- width: 18px;
- height: 18px;
-}
-
-.torrent-status-pill.active {
- border-color: rgba(29,185,84,0.42);
- color: #9ff0b9;
-}
-
-.torrent-agent-pill.active {
- border-color: rgba(240,184,77,0.45);
- color: #ffd78a;
-}
-
-.torrent-agent-dot {
- width: 7px;
- height: 7px;
- border-radius: 50%;
- background: var(--text-subdued);
-}
-
-.torrent-agent-pill.active .torrent-agent-dot {
- background: #f0b84d;
- box-shadow: 0 0 0 3px rgba(240,184,77,0.14);
-}
-
-.torrent-tabs {
- display: flex;
- gap: 6px;
- margin-bottom: 12px;
- flex: 0 0 auto;
-}
-
-.torrent-tab-btn {
- min-height: 34px;
- border: 1px solid var(--border-color);
- border-radius: 6px;
- background: var(--bg-primary);
- color: var(--text-secondary);
- display: inline-flex;
- align-items: center;
- gap: 6px;
- padding: 0 12px;
- font-size: 13px;
- font-weight: 800;
- cursor: pointer;
-}
-
-.torrent-tab-btn:hover,
-.torrent-tab-btn.active {
- color: var(--text-primary);
- background: var(--bg-hover);
-}
-
-.torrent-tab-btn.active {
- border-color: rgba(29,185,84,0.42);
-}
-
-.torrent-tab-count {
- min-width: 18px;
- height: 18px;
- border-radius: 999px;
- background: rgba(29,185,84,0.2);
- color: #9ff0b9;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- font-size: 11px;
-}
-
-.download-source-tabs {
- padding-bottom: 10px;
- border-bottom: 1px solid var(--border-color);
-}
-
-.download-source-tabs .torrent-tab-btn {
- min-width: 112px;
- justify-content: center;
-}
-
-.download-torrent-panel,
-.youtube-manager-panel {
- min-height: 0;
- flex: 1 1 auto;
-}
-
-.file-upload-panel {
- min-height: 0;
- flex: 1 1 auto;
- display: flex;
- flex-direction: column;
- gap: 12px;
- overflow: hidden;
-}
-
-.file-upload-input {
- position: absolute;
- width: 1px;
- height: 1px;
- overflow: hidden;
- clip: rect(0, 0, 0, 0);
- clip-path: inset(50%);
- white-space: nowrap;
-}
-
-.file-drop-zone {
- min-height: 176px;
- flex: 0 0 auto;
- display: flex !important;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 6px;
- margin: 0 !important;
- padding: 24px;
- border: 2px dashed var(--border-color);
- border-radius: 12px;
- background: var(--bg-primary);
- color: var(--text-subdued);
- text-align: center;
- cursor: pointer;
- transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
-}
-
-.file-drop-zone:hover,
-.file-drop-zone.dragging {
- border-color: var(--accent);
- background: rgba(29,185,84,0.08);
-}
-
-.file-drop-zone.dragging {
- transform: scale(0.995);
-}
-
-.file-drop-zone strong {
- color: var(--text-primary);
- font-size: 15px;
-}
-
-.file-drop-zone span {
- font-size: 12px;
-}
-
-.file-drop-zone small {
- margin-top: 2px;
- color: var(--text-muted);
- font-size: 10px;
-}
-
-.file-drop-icon {
- width: 42px;
- height: 42px;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 4px;
- border-radius: 50%;
- background: rgba(29,185,84,0.14);
- color: #7ee29e;
-}
-
-.file-drop-icon svg {
- width: 23px;
- height: 23px;
-}
-
-.file-upload-selection {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
- padding: 10px 12px;
- border: 1px solid var(--border-color);
- border-radius: 8px;
- background: var(--bg-primary);
- color: var(--text-secondary);
- font-size: 12px;
- font-weight: 700;
-}
-
-.file-upload-picker-actions {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 8px;
-}
-
-.file-upload-picker-actions small {
- color: var(--text-subdued);
- font-size: 11px;
-}
-
-.file-upload-selection > div {
- display: flex;
- gap: 7px;
-}
-
-.file-upload-history-head {
- margin-top: 2px;
-}
-
-.file-upload-history {
- min-height: 0;
- flex: 1 1 auto;
- display: flex;
- flex-direction: column;
- gap: 8px;
- overflow-y: auto;
- padding-right: 4px;
-}
-
-.file-upload-history-row {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto auto;
- gap: 10px;
- align-items: center;
- padding: 11px 12px;
- border: 1px solid var(--border-color);
- border-radius: 8px;
- background: var(--bg-primary);
-}
-
-.file-upload-history-main {
- min-width: 0;
-}
-
-.file-upload-history-title {
- overflow: hidden;
- color: var(--text-primary);
- font-size: 12px;
- font-weight: 750;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.file-upload-history-meta {
- margin-top: 3px;
- color: var(--text-subdued);
- font-size: 10px;
-}
-
-.download-torrent-panel {
- display: flex;
- flex-direction: column;
-}
-
-.youtube-manager-panel {
- display: flex;
- flex-direction: column;
- gap: 12px;
- overflow: hidden;
-}
-
-.youtube-download-form {
- flex: 0 0 auto;
- padding: 14px;
- border: 1px solid var(--border-color);
- border-radius: 9px;
- background: var(--bg-primary);
-}
-
-.youtube-download-form-row {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- gap: 10px;
- align-items: center;
-}
-
-.torrent-modal .youtube-download-form-row input[type="text"] {
- margin: 0;
-}
-
-.youtube-download-hint {
- margin: 8px 0 0;
- color: var(--text-subdued);
- font-size: 11px;
- line-height: 1.45;
-}
-
-.youtube-preview-card {
- min-height: 370px;
- flex: 1 1 520px;
- display: flex;
- flex-direction: column;
- gap: 10px;
- padding: 14px;
- border: 1px solid rgba(29,185,84,0.35);
- border-radius: 9px;
- background: var(--bg-primary);
-}
-
-.youtube-preview-head,
-.youtube-preview-footer {
- flex: 0 0 auto;
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
-}
-
-.youtube-preview-head h4 {
- margin: 0 0 4px;
- color: var(--text-primary);
- font-size: 13px;
-}
-
-.youtube-preview-head p {
- margin: 0;
- color: var(--text-subdued);
- font-size: 11px;
-}
-
-.youtube-preview-head strong {
- color: var(--text-secondary);
-}
-
-.youtube-preview-controls,
-.youtube-preview-footer > div {
- display: flex;
- align-items: center;
- gap: 7px;
- flex: 0 0 auto;
-}
-
-.youtube-preview-list {
- min-height: 190px;
- flex: 1 1 260px;
- overflow-y: auto;
- border: 1px solid var(--border-color);
- border-radius: 7px;
- background: var(--bg-secondary);
-}
-
-.youtube-preview-destination {
- flex: 0 0 auto;
- display: grid;
- grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
- grid-template-rows: auto auto;
- column-gap: 14px;
- row-gap: 4px;
- align-items: center;
- padding: 10px;
- border: 1px solid var(--border-color);
- border-radius: 7px;
- background: var(--bg-secondary);
-}
-
-.youtube-preview-destination > label {
- grid-column: 1;
- grid-row: 1;
- margin: 0;
-}
-
-.youtube-preview-destination-fields {
- grid-column: 2;
- grid-row: 1 / 3;
- display: grid;
- grid-template-columns: 1fr;
- gap: 8px;
-}
-
-.youtube-preview-destination-fields.creating {
- grid-template-columns: repeat(2, minmax(0, 1fr));
-}
-
-.youtube-preview-destination p {
- grid-column: 1;
- grid-row: 2;
- margin: 0;
- color: var(--text-subdued);
- font-size: 10px;
- line-height: 1.4;
-}
-
-.youtube-preview-row {
- display: grid;
- grid-template-columns: auto 30px minmax(0, 1fr);
- gap: 8px;
- align-items: center;
- min-height: 38px;
- padding: 6px 10px;
- border-bottom: 1px solid var(--border-color);
- color: var(--text-secondary);
- cursor: pointer;
-}
-
-.youtube-preview-row:last-child {
- border-bottom: 0;
-}
-
-.youtube-preview-row:hover,
-.youtube-preview-row.selected {
- background: var(--bg-hover);
- color: var(--text-primary);
-}
-
-.youtube-preview-row input[type="checkbox"] {
- width: 15px;
- height: 15px;
- margin: 0;
- accent-color: #1db954;
-}
-
-.youtube-preview-item-title {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: 12px;
- font-weight: 650;
-}
-
-.youtube-preview-footer {
- color: var(--text-subdued);
- font-size: 11px;
- font-weight: 700;
-}
-
-.youtube-download-list-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 10px;
- flex: 0 0 auto;
- color: var(--text-secondary);
- font-size: 12px;
- font-weight: 800;
- text-transform: uppercase;
-}
-
-.youtube-download-list {
- min-height: 0;
- flex: 1 1 180px;
- display: flex;
- flex-direction: column;
- gap: 10px;
- overflow-y: auto;
- padding-right: 4px;
-}
-
-.youtube-empty-state {
- min-height: 180px;
- border: 1px dashed var(--border-color);
- border-radius: 9px;
-}
-
-.youtube-job-card {
- flex: 0 0 auto;
- padding: 0;
- border: 1px solid var(--border-color);
- border-radius: 9px;
- background: var(--bg-primary);
- overflow: hidden;
-}
-
-.youtube-job-card.collapsed {
- border-color: rgba(255,255,255,0.08);
-}
-
-.youtube-job-summary {
- width: 100%;
- min-height: 50px;
- display: grid;
- grid-template-columns: 16px minmax(0, 1fr) auto auto;
- align-items: center;
- gap: 10px;
- padding: 10px 13px;
- border: 0;
- background: transparent;
- color: inherit;
- font: inherit;
- text-align: left;
- cursor: pointer;
-}
-
-.youtube-job-summary:hover {
- background: var(--bg-hover);
-}
-
-.youtube-job-chevron {
- width: 8px;
- height: 8px;
- border-right: 2px solid var(--text-subdued);
- border-bottom: 2px solid var(--text-subdued);
- transform: rotate(45deg) translate(-2px, -2px);
- transition: transform 140ms ease;
-}
-
-.youtube-job-card.collapsed .youtube-job-chevron {
- transform: rotate(-45deg);
-}
-
-.youtube-job-card.collapsed .youtube-job-meta {
- display: none;
-}
-
-.youtube-job-compact-progress {
- color: var(--text-subdued);
- font-size: 11px;
- font-weight: 800;
- white-space: nowrap;
-}
-
-.youtube-job-details {
- padding: 0 13px 13px;
-}
-
-.youtube-job-head,
-.youtube-item-head {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- align-items: start;
- gap: 10px;
-}
-
-.youtube-job-heading,
-.youtube-item-main {
- min-width: 0;
-}
-
-.youtube-job-title,
-.youtube-item-title {
- overflow: hidden;
- color: var(--text-primary);
- font-weight: 800;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.youtube-job-title { font-size: 14px; }
-.youtube-item-title { font-size: 12px; }
-
-.youtube-job-meta,
-.youtube-item-meta {
- margin-top: 3px;
- color: var(--text-subdued);
- font-size: 11px;
- line-height: 1.35;
-}
-
-.youtube-job-progress {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- align-items: center;
- gap: 10px;
- margin-top: 0;
- color: var(--text-subdued);
- font-size: 11px;
-}
-
-.youtube-job-progress .torrent-session-progress,
-.youtube-item-download-progress .torrent-session-progress {
- margin-top: 0;
-}
-
-.youtube-job-error,
-.youtube-item-error {
- margin: 8px 0 0;
- color: #ffb9b9;
- font-size: 11px;
- line-height: 1.4;
- overflow-wrap: anywhere;
-}
-
-.youtube-item-list {
- display: flex;
- flex-direction: column;
- gap: 7px;
- margin-top: 11px;
-}
-
-.youtube-item-row {
- padding: 10px;
- border: 1px solid rgba(255,255,255,0.07);
- border-radius: 7px;
- background: var(--bg-elevated);
-}
-
-.youtube-item-row.failed {
- border-color: rgba(229,96,96,0.3);
-}
-
-.youtube-item-head {
- grid-template-columns: 28px minmax(0, 1fr) auto;
- align-items: center;
-}
-
-.youtube-item-index {
- color: var(--text-muted);
- font-size: 10px;
- font-weight: 900;
- text-align: center;
-}
-
-.youtube-item-download-progress {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- gap: 10px;
- align-items: center;
- margin-top: 8px;
- color: var(--text-subdued);
- font-size: 10px;
-}
-
-.youtube-step-list {
- display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr));
- gap: 4px;
- margin-top: 9px;
-}
-
-.youtube-step {
- min-width: 0;
- display: flex;
- align-items: center;
- gap: 5px;
- color: var(--text-muted);
- font-size: 9px;
- text-transform: uppercase;
-}
-
-.youtube-step i {
- width: 7px;
- height: 7px;
- flex: 0 0 7px;
- border-radius: 50%;
- border: 1px solid var(--border-color);
- background: var(--bg-secondary);
-}
-
-.youtube-step b {
- min-width: 0;
- overflow: hidden;
- font: inherit;
- font-weight: 800;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.youtube-step.done { color: #9ff0b9; }
-.youtube-step.done i { border-color: var(--accent); background: var(--accent); }
-.youtube-step.active { color: #ffd78a; }
-.youtube-step.active i {
- border-color: #f0b84d;
- background: #f0b84d;
- box-shadow: 0 0 0 3px rgba(240,184,77,0.13);
-}
-.youtube-step.failed { color: #ffb9b9; }
-.youtube-step.failed i { border-color: #e56060; background: #e56060; }
-.youtube-step.cancelled { color: #ffd78a; }
-.youtube-step.cancelled i { border-color: #f0b84d; background: #f0b84d; }
-
-.youtube-job-actions {
- display: flex;
- justify-content: flex-end;
- flex-wrap: wrap;
- gap: 7px;
- margin-top: 10px;
-}
-
-.torrent-manager-layout {
- display: grid;
- grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
- gap: 14px;
- min-height: 0;
- flex: 1 1 auto;
-}
-
-.torrent-manager-sidebar,
-.torrent-workspace {
- min-width: 0;
- min-height: 0;
- display: flex;
- flex-direction: column;
-}
-
-.torrent-manager-sidebar {
- border: 1px solid var(--border-color);
- border-radius: 8px;
- background: var(--bg-primary);
- overflow: hidden;
-}
-
-.torrent-manager-title {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 8px;
- padding: 10px 12px;
- border-bottom: 1px solid var(--border-color);
- color: var(--text-secondary);
- font-size: 12px;
- font-weight: 800;
- text-transform: uppercase;
-}
-
-.torrent-session-list {
- overflow-y: auto;
- min-height: 0;
- max-height: none;
- flex: 1 1 auto;
-}
-
-.torrent-session-row {
- display: grid;
- grid-template-columns: minmax(0, 1fr);
- gap: 8px;
- padding: 10px 12px;
- border-bottom: 1px solid var(--border-color);
- cursor: pointer;
-}
-
-.torrent-session-add {
- width: 100%;
- grid-template-columns: auto minmax(0, 1fr);
- align-items: center;
- border: 0;
- border-bottom: 1px solid var(--border-color);
- background: transparent;
- color: var(--text-secondary);
- text-align: left;
- font: inherit;
- font-size: 13px;
- font-weight: 800;
-}
-
-.torrent-session-add:disabled {
- cursor: default;
- opacity: 0.6;
-}
-
-.torrent-session-add-icon {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 22px;
- height: 22px;
- border-radius: 999px;
- border: 1px solid rgba(29,185,84,0.38);
- color: #9ff0b9;
- font-size: 16px;
- line-height: 1;
-}
-
-.torrent-session-row:last-child { border-bottom: 0; }
-.torrent-session-row:hover,
-.torrent-session-row.active { background: var(--bg-hover); }
-
-.torrent-session-main {
- min-width: 0;
-}
-
-.torrent-session-topline {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- gap: 8px;
- align-items: center;
-}
-
-.torrent-session-name {
- min-width: 0;
- color: var(--text-primary);
- font-size: 13px;
- font-weight: 800;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
.torrent-status-badge {
display: inline-flex;
align-items: center;
@@ -4351,173 +3511,7 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
color: #ffb9b9;
}
-.torrent-session-meta {
- margin-top: 4px;
- color: var(--text-subdued);
- font-size: 11px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.torrent-session-progress {
- height: 5px;
- margin-top: 7px;
- overflow: hidden;
- border-radius: 999px;
- background: var(--bg-secondary);
-}
-
-.torrent-session-progress-bar {
- height: 100%;
- width: 0%;
- border-radius: inherit;
- background: linear-gradient(90deg, var(--accent), #7ee4a2);
- transition: width 0.25s ease;
-}
-
-.torrent-progress-card {
- margin-top: 10px;
- padding: 10px 12px;
- border-radius: 8px;
- border: 1px solid var(--border-color);
- background: var(--bg-primary);
-}
-
-.torrent-progress-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 10px;
- color: var(--text-secondary);
- font-size: 12px;
- font-weight: 700;
-}
-
-.torrent-progress-track {
- height: 8px;
- margin-top: 8px;
- overflow: hidden;
- border-radius: 999px;
- background: var(--bg-secondary);
-}
-
-.torrent-progress-bar {
- height: 100%;
- width: 0%;
- border-radius: inherit;
- background: linear-gradient(90deg, var(--accent), #7ee4a2);
- transition: width 0.25s ease;
-}
-
-.torrent-progress-details {
- display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr));
- gap: 8px;
- margin-top: 8px;
- color: var(--text-subdued);
- min-height: 38px;
-}
-
-.torrent-progress-details.completed {
- grid-template-columns: minmax(0, 1fr);
-}
-
-.torrent-progress-metric {
- min-width: 0;
- min-height: 38px;
- padding: 5px 7px;
- border-radius: 6px;
- background: var(--bg-secondary);
- display: flex;
- flex-direction: column;
- justify-content: center;
- gap: 2px;
-}
-
-.torrent-progress-label {
- color: var(--text-muted);
- font-size: 10px;
- line-height: 12px;
- text-transform: uppercase;
- font-weight: 800;
-}
-
-.torrent-progress-value {
- color: var(--text-secondary);
- font-size: 12px;
- line-height: 14px;
- font-weight: 700;
- overflow-wrap: anywhere;
-}
-
-
-.torrent-modal-grid {
- display: grid;
- grid-template-columns: minmax(0, 360px);
- gap: 10px;
- max-width: 360px;
-}
-
-.torrent-import-panel,
-.torrent-workspace-empty {
- min-height: 150px;
-}
-
-.torrent-upload-summary {
- min-height: 16px;
- margin-top: 5px;
- color: var(--text-subdued);
- font-size: 11px;
-}
-
-.torrent-upload-progress {
- margin-top: 10px;
- padding: 10px 12px;
- border: 1px solid var(--border-color);
- border-radius: 8px;
- background: var(--bg-primary);
-}
-
-.torrent-modal label {
- display: block;
- margin-bottom: 6px;
- color: var(--text-secondary);
- font-size: 12px;
- font-weight: 700;
-}
-
-.torrent-modal input[type="file"],
-.torrent-modal input[type="text"],
-.torrent-modal input[type="number"],
-.torrent-modal select,
-.torrent-modal textarea {
- width: 100%;
- padding: 10px 12px;
- background: var(--bg-primary);
- border: 1px solid var(--border-color);
- border-radius: 6px;
- color: var(--text-primary);
- font: inherit;
- outline: none;
-}
-
-.torrent-modal input[type="file"]:focus,
-.torrent-modal input[type="text"]:focus,
-.torrent-modal input[type="number"]:focus,
-.torrent-modal select:focus,
-.torrent-modal textarea:focus {
- border-color: var(--text-secondary);
-}
-
-.torrent-message {
- margin: 10px 0 0;
- min-height: 18px;
- color: var(--text-subdued);
- font-size: 12px;
-}
-
-.torrent-message.error { color: #ff8b8b; }
+.torrent-workspace-empty { min-height: 150px; }
.upload-manager-panel {
min-height: 0;
@@ -5108,96 +4102,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
gap: 8px;
}
-.torrent-preview-head {
- display: flex;
- justify-content: space-between;
- gap: 12px;
- align-items: center;
- margin-top: 16px;
-}
-
-.torrent-preview-actions {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-end;
- gap: 8px;
-}
-
-.torrent-preview-title {
- min-width: 0;
- font-size: 14px;
- font-weight: 800;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.torrent-preview-meta {
- margin-top: 3px;
- color: var(--text-subdued);
- font-size: 12px;
-}
-
-.torrent-preview-panel {
- display: flex;
- flex: 1 1 auto;
- flex-direction: column;
- min-height: 0;
-}
-
-.torrent-actions {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-start;
- gap: 8px;
- margin-top: 12px;
-}
-
-.torrent-tree-toolbar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
- margin-top: 12px;
- padding: 10px 12px;
- background: var(--bg-primary);
- border: 1px solid var(--border-color);
- border-radius: 8px;
-}
-
-.torrent-selected-summary {
- min-width: 0;
- color: var(--text-secondary);
- font-size: 12px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.torrent-file-tree {
- flex: 1 1 auto;
- margin-top: 10px;
- overflow-y: auto;
- min-height: 140px;
- max-height: none;
- border: 1px solid var(--border-color);
- border-radius: 8px;
- background: var(--bg-primary);
-}
-
-.torrent-tree-row {
- display: grid;
- grid-template-columns: 28px 24px minmax(0, 1fr) 92px;
- gap: 8px;
- align-items: center;
- min-height: 38px;
- padding: 7px 10px 7px var(--indent, 10px);
- border-bottom: 1px solid var(--border-color);
-}
-
-.torrent-tree-row:last-child { border-bottom: 0; }
-.torrent-tree-row:hover { background: var(--bg-hover); }
-
.torrent-tree-toggle,
.torrent-tree-check {
width: 24px;
@@ -5244,35 +4148,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
height: 15px;
}
-.torrent-tree-label {
- min-width: 0;
- display: flex;
- align-items: center;
- gap: 8px;
-}
-
-.torrent-tree-label svg {
- flex: 0 0 auto;
- width: 17px;
- height: 17px;
- color: var(--text-subdued);
-}
-
-.torrent-file-name {
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: 13px;
-}
-
-.torrent-file-size {
- color: var(--text-subdued);
- font-size: 12px;
- text-align: right;
- font-variant-numeric: tabular-nums;
-}
-
/* Sidebar playlist actions */
.playlist-item-row {
display: flex;
@@ -5387,10 +4262,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
display: block;
}
- .torrent-modal {
- width: min(1180px, calc(100vw - 32px));
- }
-
.card-grid {
grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
gap: 14px;
@@ -6101,142 +4972,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
padding-top: 0;
}
- .torrent-modal {
- width: 100vw;
- max-width: none;
- height: 100dvh;
- max-height: none;
- border-radius: 0;
- padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
- overflow: hidden;
- }
-
- .torrent-modal.youtube-mode {
- width: 100vw;
- max-width: none;
- }
-
- .torrent-modal-head {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- gap: 8px;
- align-items: start;
- }
-
- .torrent-client-status {
- grid-column: 1 / -1;
- justify-content: flex-start;
- }
-
- .torrent-modal-close {
- display: inline-flex;
- }
-
- .torrent-manager-layout {
- grid-template-columns: 1fr;
- gap: 10px;
- }
-
- .torrent-session-list {
- max-height: none;
- min-height: 0;
- }
-
- .torrent-manager-sidebar {
- flex: 0 0 178px;
- }
-
- .torrent-tabs {
- overflow-x: auto;
- padding-bottom: 2px;
- }
-
- .youtube-manager-panel {
- overflow-y: auto;
- }
-
- .file-upload-panel {
- overflow-y: auto;
- }
-
- .file-upload-history {
- overflow: visible;
- }
-
- .file-upload-history-row {
- grid-template-columns: minmax(0, 1fr) auto;
- }
-
- .file-upload-history-row .modal-btn-danger {
- grid-column: 1 / -1;
- justify-self: start;
- }
-
- .file-upload-selection {
- align-items: flex-start;
- flex-direction: column;
- }
-
- .youtube-download-form-row {
- grid-template-columns: 1fr;
- }
-
- .youtube-download-form-row .modal-btn {
- justify-self: start;
- }
-
- .youtube-preview-card {
- flex-basis: auto;
- min-height: 420px;
- max-height: none;
- }
-
- .youtube-preview-head,
- .youtube-preview-footer {
- align-items: flex-start;
- flex-direction: column;
- }
-
- .youtube-preview-controls {
- flex-wrap: wrap;
- }
-
- .youtube-preview-destination-fields,
- .youtube-preview-destination-fields.creating {
- grid-column: auto;
- grid-row: auto;
- grid-template-columns: 1fr;
- }
-
- .youtube-preview-destination {
- display: block;
- }
-
- .youtube-preview-destination > label {
- margin-bottom: 7px;
- }
-
- .youtube-preview-destination p {
- margin-top: 7px;
- }
-
- .youtube-job-summary {
- grid-template-columns: 16px minmax(0, 1fr) auto;
- }
-
- .youtube-job-summary .youtube-job-compact-progress {
- display: none;
- }
-
- .youtube-download-list {
- overflow: visible;
- }
-
- .youtube-step-list {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- row-gap: 7px;
- }
-
.upload-manager-panel {
overflow-y: auto;
}
@@ -6341,72 +5076,6 @@ img[x-artwork]:not(.artwork-loaded) { visibility: hidden; }
padding-top: 0;
}
- .torrent-progress-head {
- align-items: flex-start;
- flex-direction: column;
- gap: 4px;
- }
-
- .torrent-progress-details {
- grid-template-columns: repeat(2, minmax(0, 1fr));
- }
-
- .torrent-progress-details.completed {
- grid-template-columns: minmax(0, 1fr);
- }
-
- .torrent-modal h3 {
- margin-bottom: 12px;
- }
-
- .torrent-modal-head h3 {
- margin: 0;
- }
-
- .torrent-modal-grid {
- grid-template-columns: 1fr;
- gap: 10px;
- }
-
- .torrent-message {
- margin-top: 8px;
- }
-
- .torrent-actions {
- margin-top: 8px;
- }
-
- .torrent-preview-head {
- align-items: flex-start;
- flex-direction: column;
- gap: 8px;
- margin-top: 10px;
- }
-
- .torrent-tree-toolbar {
- align-items: flex-start;
- flex-direction: column;
- gap: 8px;
- margin-top: 8px;
- padding: 8px 10px;
- }
-
- .torrent-file-tree {
- min-height: 0;
- max-height: none;
- }
-
- .torrent-tree-row {
- grid-template-columns: 24px 22px minmax(0, 1fr) 74px;
- gap: 6px;
- }
-
- .torrent-file-size {
- grid-column: 4;
- text-align: right;
- white-space: nowrap;
- }
-
.queue-panel {
left: 8px;
right: 8px;
diff --git a/tests/browser-downloads.cjs b/tests/browser-downloads.cjs
new file mode 100644
index 0000000..aecd133
--- /dev/null
+++ b/tests/browser-downloads.cjs
@@ -0,0 +1,115 @@
+// Render the player with FURU_PODCAST_RENDER_FIXTURE=1 cargo test renders_podcast_navigation_and_views.
+const assert = require('node:assert/strict');
+const {readFileSync} = require('node:fs');
+const {chromium} = require(process.env.PLAYWRIGHT_MODULE || 'playwright');
+
+const html = readFileSync('target/podcast-player-fixture.html', 'utf8');
+const files = Array.from({length: 40}, (_, index) => {
+ const name = `Track ${index + 1}.flac`;
+ return {index, name, components: [name], length: 4000000, selected: true};
+});
+const preview = {id: 'tour', name: 'Tour recordings', total_size: 160000000, files};
+const job = {id: preview.id, name: preview.name, status: 'preview'};
+
+async function checkManager(browser, width, height) {
+ const page = await browser.newPage({viewport: {width, height}});
+ page.setDefaultTimeout(5000);
+ const errors = [];
+ page.on('pageerror', error => errors.push(error.message));
+ let session, started;
+ await page.route('**/*', route => {
+ const {pathname} = new URL(route.request().url());
+ if (pathname === '/') return route.fulfill({contentType: 'text/html', body: html});
+ if (pathname === '/api/player/torrents/preview') {
+ session = job;
+ return route.fulfill({json: {preview, job}});
+ }
+ if (pathname === '/api/player/torrents/tour/start') {
+ started = route.request().postDataJSON();
+ session = {...job, status: 'downloading', active: true};
+ return route.fulfill({json: session});
+ }
+ const responses = {
+ '/api/player/artists': {items: [], total: 0, has_more: false},
+ '/api/player/me': {id: 1, name: 'Listener'},
+ '/api/player/playlists': [{id: 7, kind: 'user', is_own: true, title: 'On tour'}],
+ '/api/player/uploads/local/history': [{id: 'encore', filename: 'Encore.wav', status: 'complete', created_at: '2026-11-23T12:00:00Z'}],
+ '/api/player/uploads/tracks': {queued_total: 1, queued: [{id: 9, filename: 'Soundcheck.flac', status: 'queued'}]},
+ '/api/player/torrents': session ? [session] : [],
+ '/api/player/youtube/preview': {title: 'Video playlist', items: [{source_id: 'clip', title: 'Live in concert', selected_by_default: true}]},
+ };
+ return route.fulfill({json: responses[pathname] || []});
+ });
+ await page.goto('https://downloads.test/');
+ await page.locator('.torrent-import-btn').click();
+ const dialog = page.locator('.downloads-dialog');
+ const tab = source => dialog.locator('#downloads-tab-' + source);
+ const overview = dialog.locator('#downloads-overview');
+ await overview.getByText('Encore.wav', {exact:true}).waitFor();
+ await overview.getByRole('combobox').selectOption('active');
+ assert.equal(await overview.getByText('Encore.wav', {exact:true}).count(), 0);
+ await overview.getByRole('combobox').selectOption('history');
+ await overview.getByText('Encore.wav', {exact:true}).waitFor();
+ if (process.env.DOWNLOADS_SCREENSHOTS) {
+ await page.screenshot({path:`target/downloads-overview-${width}x${height}.png`, animations:'disabled'});
+ }
+ await overview.getByRole('button', {name: /Encore\.wav/}).click();
+ await dialog.locator('#download-file-job-encore').waitFor();
+ await page.waitForFunction(() => document.activeElement?.id === 'download-file-job-encore');
+ await tab('overview').click();
+ await dialog.locator('button[aria-controls="download-add-list"]').click();
+ await dialog.locator('#download-add-list').getByRole('button', {name: 'YouTube'}).click();
+ const youtube = dialog.locator('#youtube-download-url');
+ await youtube.fill('https://www.youtube.com/watch?v=demo');
+ await youtube.press('Enter');
+ await dialog.getByText('Live in concert', {exact: true}).waitFor();
+ await tab('files').click();
+ await dialog.locator('#direct-audio-file-input').setInputFiles({
+ name: 'live.wav', mimeType: 'audio/wav', buffer: Buffer.from('audio'),
+ });
+ await dialog.locator('#local-target-playlist').selectOption('7');
+ assert.ok(await dialog.getByRole('button', {name:'Upload selected files'}).isEnabled());
+ await tab('uploads').click();
+ await dialog.getByText('Soundcheck.flac', {exact:true}).waitFor();
+ await tab('torrents').click();
+ await dialog.locator('.torrent-add').click();
+ const magnet = dialog.locator('#torrent-magnet-input');
+ await magnet.fill('magnet:?xt=urn:btih:0123456789012345678901234567890123456789');
+ await dialog.locator('.torrent-preview-submit').click();
+ const tree = dialog.locator('.torrent-file-tree');
+ await tree.getByText(files[0].name, {exact: true}).waitFor();
+ const metrics = await tree.evaluate(el => {
+ const box = el.getBoundingClientRect();
+ const row = el.querySelector('.torrent-tree-row').getBoundingClientRect();
+ return {y: box.y, bottom: box.bottom, view: el.clientHeight, row: row.height, full: el.scrollHeight};
+ });
+ assert.ok(metrics.view >= 5 * metrics.row - 2, 'at least five files should fit in the preview ' + JSON.stringify(metrics));
+ assert.ok(metrics.y >= 0 && metrics.bottom <= height + 1 && metrics.full > metrics.view, 'tree should scroll inside the screen');
+ assert.ok(await dialog.evaluate(el => el.scrollWidth <= el.clientWidth + 1), 'no horizontal dialog overflow');
+ await tree.getByRole('checkbox').last().uncheck();
+ await dialog.locator('#torrent-target-playlist').selectOption('7');
+ if (process.env.DOWNLOADS_SCREENSHOTS) {
+ await tree.evaluate(el => {el.scrollTop = 0;});
+ await page.screenshot({path: `target/downloads-${width}x${height}.png`, animations:'disabled'});
+ }
+ await Promise.all([
+ page.waitForResponse(res => new URL(res.url()).pathname === '/api/player/torrents/tour/start'),
+ dialog.locator('.torrent-start').click(),
+ ]);
+ assert.equal(started?.target_playlist_id, 7);
+ assert.deepEqual(started?.selected_files, files.slice(0, -1).map(file => file.index));
+ await page.keyboard.press('Escape');
+ await dialog.waitFor({state: 'hidden'});
+ assert.deepEqual(errors, []);
+ console.log(`${width}×${height}: torrent preview ${metrics.view}px; ${Math.floor(metrics.view / metrics.row)} complete rows`);
+ await page.close();
+}
+
+(async () => {
+ const browser = await chromium.launch({headless:true, ...(process.env.CHROME_PATH ? {executablePath:process.env.CHROME_PATH} : {})});
+ try {
+ for (const [width, height] of [[1280, 800], [390, 844], [320, 568]]) await checkManager(browser, width, height);
+ } finally {
+ await browser.close();
+ }
+})().catch(error => {console.error(error); process.exitCode = 1;});