1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-26 09:48:37 +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;
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;
}
*/
}
}
}

View file

@ -30,7 +30,7 @@
<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-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="../animate.css?changed=2017083001">
@ -189,7 +189,7 @@
<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>
<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>
</script>
<script id="setup-item" type="text/x-handlebars-template">
@ -659,6 +659,6 @@
</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>
</html>