diff --git a/tubearchivist/home/templates/home/settings.html b/tubearchivist/home/templates/home/settings.html index 522e488..7475171 100644 --- a/tubearchivist/home/templates/home/settings.html +++ b/tubearchivist/home/templates/home/settings.html @@ -119,7 +119,12 @@

Import YouTube cookie: {{ config.downloads.cookie_import }}

Place your cookie file named cookies.google.txt in /cache/import before enabling.
- {{ app_form.downloads_cookie_import }} + {{ app_form.downloads_cookie_import }}
+ {% if config.downloads.cookie_import %} +
+ +
+ {% endif %}
diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 69caac7..e20d31c 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -699,6 +699,24 @@ function postSponsorSegmentVote(videoId, uuid, vote) { apiRequest(apiEndpoint, "POST", data); } +function handleCookieValidate() { + document.getElementById("cookieButton").remove(); + var cookieMessageElement = document.getElementById("cookieMessage"); + cookieMessageElement.innerHTML = `Processing.`; + response = postCookieValidate(); + if (response.cookie_validated == true) { + cookieMessageElement.innerHTML = `The cookie file is valid.`; + } else { + cookieMessageElement.innerHTML = `Warning, the cookie file is invalid.`; + } +} + +// Check youtube cookie settings +function postCookieValidate() { + var apiEndpoint = "/api/cookie/"; + return apiRequest(apiEndpoint, "POST"); +} + // Makes api requests when passed an endpoint and method ("GET", "POST", "DELETE") function apiRequest(apiEndpoint, method, data) { const xhttp = new XMLHttpRequest();