From c1bc7500596d9628342961f661b1e46d38924344 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Thu, 26 Apr 2018 19:29:03 +0200 Subject: [PATCH] allow other options to be edited with in case of a recaptcha --- src/Jackett.Common/Content/custom.js | 26 +++++++++++++++++++++----- src/Jackett.Common/Content/index.html | 6 +++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/Jackett.Common/Content/custom.js b/src/Jackett.Common/Content/custom.js index 8ea65f4c7..9fb783403 100644 --- a/src/Jackett.Common/Content/custom.js +++ b/src/Jackett.Common/Content/custom.js @@ -497,10 +497,14 @@ function populateConfigItems(configForm, config) { hasReacaptcha = true; captchaItem = config[i]; } + else if (config[i].id === 'cookieheader' && hasReacaptcha) { // inject cookie into captcha item + captchaItem.cookieheader = config[i].value; + console.log(captchaItem); + } } var setupItemTemplate = Handlebars.compile($("#setup-item").html()); - if (hasReacaptcha && !window.jackettIsLocal) { + if (hasReacaptcha && !window.jackettIsLocal && false) { // disable this for now, use inline cookie (below) var setupValueTemplate = Handlebars.compile($("#setup-item-nonlocalrecaptcha").html()); captchaItem.value_element = setupValueTemplate(captchaItem); var template = setupItemTemplate(captchaItem); @@ -509,11 +513,22 @@ function populateConfigItems(configForm, config) { for (var i = 0; i < config.length; i++) { var item = config[i]; - var setupValueTemplate = Handlebars.compile($("#setup-item-" + item.type).html()); - item.value_element = setupValueTemplate(item); - var template = setupItemTemplate(item); - $formItemContainer.append(template); + if ((item.id === 'username' || item.id === 'password') && hasReacaptcha) { + continue; // skip username/password if there's a recaptcha + } + if (item.type != 'recaptcha') { + var setupValueTemplate = Handlebars.compile($("#setup-item-" + item.type).html()); + item.value_element = setupValueTemplate(item); + var template = setupItemTemplate(item); + $formItemContainer.append(template); + } if (item.type === 'recaptcha') { + // inject cookie dialog until recaptcha can be solved again + var setupValueTemplate = Handlebars.compile($("#setup-item-nonlocalrecaptcha").html()); + captchaItem.value_element = setupValueTemplate(captchaItem); + var template = setupItemTemplate(captchaItem); + $formItemContainer.append(template); + /* var jackettrecaptcha = $('.jackettrecaptcha'); jackettrecaptcha.data("version", item.version); switch (item.version) { @@ -543,6 +558,7 @@ function populateConfigItems(configForm, config) { }); break; } + */ } } } diff --git a/src/Jackett.Common/Content/index.html b/src/Jackett.Common/Content/index.html index aaa3320b4..46e4523a2 100644 --- a/src/Jackett.Common/Content/index.html +++ b/src/Jackett.Common/Content/index.html @@ -30,7 +30,7 @@ - + @@ -189,7 +189,7 @@

This site requires you to solve a ReCaptcha. It's no longer possible to solve the captcha in Jackett. Please enter the cookie for the site manually. See here on how get the cookies.

Full cookie header
- +
- +