1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-27 02:09:24 +00:00

allow other options to be edited with in case of a recaptcha

This commit is contained in:
kaso17 2018-04-26 19:29:03 +02:00
parent 364061fde0
commit c1bc750059
2 changed files with 24 additions and 8 deletions

View file

@ -497,10 +497,14 @@ function populateConfigItems(configForm, config) {
hasReacaptcha = true; hasReacaptcha = true;
captchaItem = config[i]; 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()); 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()); var setupValueTemplate = Handlebars.compile($("#setup-item-nonlocalrecaptcha").html());
captchaItem.value_element = setupValueTemplate(captchaItem); captchaItem.value_element = setupValueTemplate(captchaItem);
var template = setupItemTemplate(captchaItem); var template = setupItemTemplate(captchaItem);
@ -509,11 +513,22 @@ function populateConfigItems(configForm, config) {
for (var i = 0; i < config.length; i++) { for (var i = 0; i < config.length; i++) {
var item = config[i]; var item = config[i];
var setupValueTemplate = Handlebars.compile($("#setup-item-" + item.type).html()); if ((item.id === 'username' || item.id === 'password') && hasReacaptcha) {
item.value_element = setupValueTemplate(item); continue; // skip username/password if there's a recaptcha
var template = setupItemTemplate(item); }
$formItemContainer.append(template); 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') { 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'); var jackettrecaptcha = $('.jackettrecaptcha');
jackettrecaptcha.data("version", item.version); jackettrecaptcha.data("version", item.version);
switch (item.version) { switch (item.version) {
@ -543,6 +558,7 @@ function populateConfigItems(configForm, config) {
}); });
break; break;
} }
*/
} }
} }
} }

View file

@ -30,7 +30,7 @@
<script type="text/javascript" src="../bootstrap/bootstrap.min.js?changed=2017083001"></script> <script type="text/javascript" src="../bootstrap/bootstrap.min.js?changed=2017083001"></script>
<script type="text/javascript" src="../libs/bootstrap-notify.js?changed=2017083001"></script> <script type="text/javascript" src="../libs/bootstrap-notify.js?changed=2017083001"></script>
<script type="text/javascript" src="../libs/bootstrap-multiselect.js?changed=2017083001"></script> <script type="text/javascript" src="../libs/bootstrap-multiselect.js?changed=2017083001"></script>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?render=explicit" async defer></script> <!--<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?render=explicit" async defer></script>-->
<link rel="stylesheet" type="text/css" href="../bootstrap/bootstrap.min.css?changed=2017083001"> <link rel="stylesheet" type="text/css" href="../bootstrap/bootstrap.min.css?changed=2017083001">
<link rel="stylesheet" type="text/css" href="../animate.css?changed=2017083001"> <link rel="stylesheet" type="text/css" href="../animate.css?changed=2017083001">
@ -189,7 +189,7 @@
<div class="setup-item-recaptcha"> <div class="setup-item-recaptcha">
<p>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. <a href="https://github.com/Jackett/Jackett/wiki/Finding-cookies" target="_blank">See here</a> on how get the cookies.</p> <p>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. <a href="https://github.com/Jackett/Jackett/wiki/Finding-cookies" target="_blank">See here</a> on how get the cookies.</p>
<div class="setup-item-label">Full cookie header</div> <div class="setup-item-label">Full cookie header</div>
<input class="form-control" type="text" value="" /> <input class="form-control" type="text" value="{{cookieheader}}" />
</div> </div>
</script> </script>
<script id="setup-item" type="text/x-handlebars-template"> <script id="setup-item" type="text/x-handlebars-template">
@ -659,6 +659,6 @@
</script> </script>
<script type="text/javascript" src="../libs/api.js?changed=2017083001"></script> <script type="text/javascript" src="../libs/api.js?changed=2017083001"></script>
<script type="text/javascript" src="../custom.js?changed=2017110602"></script> <script type="text/javascript" src="../custom.js?changed=2017110603"></script>
</body> </body>
</html> </html>