From 5c32fcb1d133381e279125e7836c07cec6fbed00 Mon Sep 17 00:00:00 2001 From: Kees van Kempen Date: Wed, 28 Feb 2024 00:20:06 +0100 Subject: [PATCH 1/6] fix(songs): handle HTTP 413 and remove redundant .json() calls Closes #76 --- marietje/songs/templates/songs/upload.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/marietje/songs/templates/songs/upload.html b/marietje/songs/templates/songs/upload.html index b28f8e7..c2d734e 100644 --- a/marietje/songs/templates/songs/upload.html +++ b/marietje/songs/templates/songs/upload.html @@ -179,13 +179,14 @@ }).catch(e => { console.log(e); if (e instanceof Response) { - try { - e.json().then(data => { - this.fileObjects[i].error_message = data.errorMessage; - this.fileObjects[i].success = false; - }); - } catch { - this.fileObjects[i].error_message = "An exception occurred while uploading this file, please try again."; + // Intercept an HTTP 413 error (entity too large), as this might + // be thrown by a (reverse) proxy server and its payload is not + // nicely formatted as the code below expects. + if (e.status === 413) { + this.fileObjects[i].error_message = "The song you tried to upload is too large in size. (HTTP 413 error)"; + this.fileObjects[i].success = false; + } else { + this.fileObjects[i].error_message = `${e.statusText} (${e.status})`; this.fileObjects[i].success = false; } } else { From 311e13f696363d995325bd1fad8c040b5400d728 Mon Sep 17 00:00:00 2001 From: William Kuijltjes Date: Mon, 18 Mar 2024 12:45:15 +0100 Subject: [PATCH 2/6] Fix toggling of Plays In/Plays At in mobile view --- marietje/queues/templates/queues/queue.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/marietje/queues/templates/queues/queue.html b/marietje/queues/templates/queues/queue.html index e38035e..98fa5b6 100644 --- a/marietje/queues/templates/queues/queue.html +++ b/marietje/queues/templates/queues/queue.html @@ -78,13 +78,13 @@ Title Requested By - Plays In - Plays At + Plays In + Plays At Control - (Plays in) - (Plays At) + (Plays In) + (Plays At) From 2b2e0a0275cf561e1fea786f7cf144666dd79bc8 Mon Sep 17 00:00:00 2001 From: William Kuijltjes Date: Mon, 18 Mar 2024 16:51:34 +0100 Subject: [PATCH 3/6] Fix dynamic times that should be static and vice versa if logged in user has queued --- marietje/queues/templates/queues/queue.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/marietje/queues/templates/queues/queue.html b/marietje/queues/templates/queues/queue.html index e38035e..dc76cd0 100644 --- a/marietje/queues/templates/queues/queue.html +++ b/marietje/queues/templates/queues/queue.html @@ -365,7 +365,9 @@ const current_song = this.queue[i]; if (i === 0) { const current_song_remaining_seconds = current_song.song.duration - this.queue[1].time_until_song_seconds; - infoBar['length_personal_queue'] -= current_song_remaining_seconds; + if (current_song.user !== null && current_song.user.id === this.user_data.id) { + infoBar['length_personal_queue'] -= current_song_remaining_seconds; + } infoBar['length_total_queue'] -= current_song_remaining_seconds; } infoBar['length_total_queue'] += current_song.song.duration; @@ -373,7 +375,7 @@ infoBar['length_personal_queue'] += current_song.song.duration; infoBar['end_personal_queue'] = infoBar['length_total_queue']; if (infoBar['start_personal_queue'] === null) { - infoBar['start_personal_queue'] = infoBar['length_total_queue'] - current_song.song.duration - this.queue[1].time_until_song_seconds; + infoBar['start_personal_queue'] = infoBar['length_total_queue'] - current_song.song.duration; } } } From 0f85727c5d1edb4bf672d35945973a637897eb24 Mon Sep 17 00:00:00 2001 From: William Kuijltjes Date: Mon, 18 Mar 2024 18:02:25 +0100 Subject: [PATCH 4/6] Brush up some details: reduce breakpoints on small screens, Requested by --> Requested By --- marietje/queues/templates/queues/queue.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/marietje/queues/templates/queues/queue.html b/marietje/queues/templates/queues/queue.html index e38035e..975b6cc 100644 --- a/marietje/queues/templates/queues/queue.html +++ b/marietje/queues/templates/queues/queue.html @@ -58,14 +58,16 @@

-

+

@@ -99,7 +101,7 @@ ${ song.song.artist }$ - Requested by:
+ Requested By:
From 3c2df2adfd0d04fe666216a2f620a512f89fc85d Mon Sep 17 00:00:00 2001 From: Kees van Kempen Date: Tue, 23 Apr 2024 17:56:58 +0200 Subject: [PATCH 5/6] styling(queues): move no underline to css --- marietje/marietje/static/marietje/css/custom.css | 4 ++++ marietje/queues/templates/queues/queue.html | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/marietje/marietje/static/marietje/css/custom.css b/marietje/marietje/static/marietje/css/custom.css index e5e7055..e75d42a 100644 --- a/marietje/marietje/static/marietje/css/custom.css +++ b/marietje/marietje/static/marietje/css/custom.css @@ -105,6 +105,10 @@ footer { transition: 1s transform ease-in-out; } +.btn-link { + text-decoration: none; +} + .navbar-text { color: var(--text-color); } diff --git a/marietje/queues/templates/queues/queue.html b/marietje/queues/templates/queues/queue.html index 98fa5b6..abe5e9d 100644 --- a/marietje/queues/templates/queues/queue.html +++ b/marietje/queues/templates/queues/queue.html @@ -78,13 +78,13 @@ Title Requested By - Plays In - Plays At + Plays In + Plays At Control - (Plays In) - (Plays At) + (Plays In) + (Plays At) @@ -224,7 +224,7 @@ ${ song.artist }$ - +