summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2021-12-07 04:55:14 +0100
committerSamantaz Fox <coding@samantaz.fr>2022-01-05 03:32:54 +0100
commit1769b0fdcebbbd6a42deb49d5e8ee7150d8b2d25 (patch)
tree2ee6db6c528cc21c78ae5bfddb0b4cdc1fae7a8a
parent68cbc11810fd746a776f6b8fefd61cec89ac9b55 (diff)
downloadinvidious-1769b0fdcebbbd6a42deb49d5e8ee7150d8b2d25.tar.gz
invidious-1769b0fdcebbbd6a42deb49d5e8ee7150d8b2d25.tar.bz2
invidious-1769b0fdcebbbd6a42deb49d5e8ee7150d8b2d25.zip
Fix "video can't be added to playlist without JS"
Fixes #2686
-rw-r--r--src/invidious/views/watch.ecr5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index b85ea59d..52262df7 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -140,7 +140,7 @@ we're going to need to do it here in order to allow for translations.
<% if user %>
<% playlists = PG_DB.query_all("SELECT id,title FROM playlists WHERE author = $1 AND id LIKE 'IV%'", user.email, as: {String, String}) %>
<% if !playlists.empty? %>
- <form data-onsubmit="return_false" class="pure-form pure-form-stacked" action="/playlist_ajax" method="post">
+ <form data-onsubmit="return_false" class="pure-form pure-form-stacked" action="/playlist_ajax" method="post" target="_blank">
<div class="pure-control-group">
<label for="playlist_id"><%= translate(locale, "Add to playlist: ") %></label>
<select style="width:100%" name="playlist_id" id="playlist_id">
@@ -150,6 +150,9 @@ we're going to need to do it here in order to allow for translations.
</select>
</div>
+ <input type="hidden" name="csrf_token" value="<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>">
+ <input type="hidden" name="action_add_video" value="1">
+ <input type="hidden" name="video_id" value="<%= video.id %>">
<button data-onclick="add_playlist_video" data-id="<%= video.id %>" type="submit" class="pure-button pure-button-primary">
<b><%= translate(locale, "Add to playlist") %></b>
</button>