mirror of
https://github.com/evilhero/mylar
synced 2025-03-15 08:18:44 +00:00
FIX: Fix for 32P legacy mode not being able to download torrents via feeds, IMP: 32p Test Connection option will now use live values for testing instead of stored values
This commit is contained in:
parent
2f4c7a3d70
commit
f22140d705
5 changed files with 39 additions and 30 deletions
|
@ -837,16 +837,16 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<label> UserName</label>
|
||||
<input type="text" name="username_32p" value="${config['username_32p']}" size="36">
|
||||
<input type="text" name="username_32p" id="username_32p" value="${config['username_32p']}" size="36">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label> Password</label>
|
||||
<input type="password" name="password_32p" value="${config['password_32p']| h}" size="36">
|
||||
<input type="password" name="password_32p" id="password_32p" value="${config['password_32p']| h}" size="36">
|
||||
<small>( monitor the NEW releases feed & your personal notifications )</small>
|
||||
</div>
|
||||
<div align="center" class="row">
|
||||
<img name="test32p_statusicon" id="test32p_statusicon" src="interfaces/default/images/success.png" style="float:right;visibility:hidden;" height="20" width="20" />
|
||||
<input type="button" value="Test Connection" id="test_32p" style="float:center" /></br>
|
||||
<input type="button" value="Test Connection" id="test32p" style="float:center" /></br>
|
||||
<input type="text" name="status32p" style="text-align:center; font-size:11px;" id="status32p" size="50" DISABLED />
|
||||
</div>
|
||||
<div name="inkdrops32p" id="inkdrops32p" style="font-size:11px;" align="center">
|
||||
|
@ -1980,9 +1980,12 @@
|
|||
function numberWithDecimals(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
};
|
||||
$("#test_32p").click(function(){
|
||||
$("#test32p").click(function(){
|
||||
var imagechk = document.getElementById("test32p_statusicon");
|
||||
$.get('test_32p',
|
||||
var user32p = document.getElementById("username_32p").value;
|
||||
var pass32p = document.getElementById("password_32p").value;
|
||||
$.get("test_32p",
|
||||
{ username: user32p, password: pass32p },
|
||||
function(data){
|
||||
if (data.error != undefined) {
|
||||
alert(data.error);
|
||||
|
|
|
@ -41,35 +41,41 @@ class info32p(object):
|
|||
'Accept-Charset': 'utf-8',
|
||||
'User-Agent': 'Mozilla/5.0'}
|
||||
|
||||
if test is True:
|
||||
if test:
|
||||
self.username_32p = test['username']
|
||||
self.password_32p = test['password']
|
||||
self.test = True
|
||||
else:
|
||||
self.username_32p = mylar.CONFIG.USERNAME_32P
|
||||
self.password_32p = mylar.CONFIG.PASSWORD_32P
|
||||
self.test = False
|
||||
|
||||
self.error = None
|
||||
self.method = None
|
||||
|
||||
lses = self.LoginSession(mylar.CONFIG.USERNAME_32P, mylar.CONFIG.PASSWORD_32P)
|
||||
if not lses.login():
|
||||
if not self.test:
|
||||
logger.error('%s [LOGIN FAILED] Disabling 32P provider until login error(s) can be fixed in order to avoid temporary bans.' % self.module)
|
||||
return "disable"
|
||||
else:
|
||||
if self.error:
|
||||
return self.error #rtnmsg
|
||||
if any([mylar.CONFIG.MODE_32P is True, self.test is True]):
|
||||
lses = self.LoginSession(mylar.CONFIG.USERNAME_32P, mylar.CONFIG.PASSWORD_32P)
|
||||
if not lses.login():
|
||||
if not self.test:
|
||||
logger.error('%s [LOGIN FAILED] Disabling 32P provider until login error(s) can be fixed in order to avoid temporary bans.' % self.module)
|
||||
return "disable"
|
||||
else:
|
||||
return self.method
|
||||
if self.error:
|
||||
return self.error #rtnmsg
|
||||
else:
|
||||
return self.method
|
||||
else:
|
||||
logger.fdebug('%s [LOGIN SUCCESS] Now preparing for the use of 32P keyed authentication...' % self.module)
|
||||
self.authkey = lses.authkey
|
||||
self.passkey = lses.passkey
|
||||
self.session = lses.ses
|
||||
self.uid = lses.uid
|
||||
try:
|
||||
mylar.INKDROPS_32P = int(math.floor(float(lses.inkdrops['results'][0]['inkdrops'])))
|
||||
except:
|
||||
mylar.INKDROPS_32P = lses.inkdrops['results'][0]['inkdrops']
|
||||
else:
|
||||
logger.fdebug('%s [LOGIN SUCCESS] Now preparing for the use of 32P keyed authentication...' % self.module)
|
||||
self.authkey = lses.authkey
|
||||
self.passkey = lses.passkey
|
||||
self.session = lses.ses
|
||||
self.uid = lses.uid
|
||||
try:
|
||||
mylar.INKDROPS_32P = int(math.floor(float(lses.inkdrops['results'][0]['inkdrops'])))
|
||||
except:
|
||||
mylar.INKDROPS_32P = lses.inkdrops['results'][0]['inkdrops']
|
||||
|
||||
self.session = requests.Session()
|
||||
self.reauthenticate = reauthenticate
|
||||
self.searchterm = searchterm
|
||||
self.publisher_list = {'Entertainment', 'Press', 'Comics', 'Publishing', 'Comix', 'Studios!'}
|
||||
|
|
|
@ -115,7 +115,7 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None):
|
|||
logger.error('[RSS] Warning - you NEED to enter in your 32P Username and Password to use this option.')
|
||||
lp=+1
|
||||
continue
|
||||
if mylar.CONFIG.MODE_32P == 0:
|
||||
if mylar.CONFIG.MODE_32P is False:
|
||||
logger.warn('[32P] Searching is not available in 32p Legacy mode. Switch to Auth mode to use the search functionality.')
|
||||
lp=+1
|
||||
continue
|
||||
|
@ -886,7 +886,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site, pubhash=None):
|
|||
verify = False
|
||||
|
||||
logger.fdebug('[32P] Verify SSL set to : ' + str(verify))
|
||||
if mylar.CONFIG.MODE_32P == 0:
|
||||
if mylar.CONFIG.MODE_32P is False:
|
||||
if mylar.KEYS_32P is None or mylar.CONFIG.PASSKEY_32P is None:
|
||||
logger.warn('[32P] Unable to retrieve keys from provided RSS Feed. Make sure you have provided a CURRENT RSS Feed from 32P')
|
||||
mylar.KEYS_32P = helpers.parse_32pfeed(mylar.FEED_32P)
|
||||
|
|
|
@ -57,7 +57,7 @@ class tehMain():
|
|||
rsscheck.torrents(pickfeed='Public') #TPSE = DEM RSS Check + WWT RSS Check
|
||||
if mylar.CONFIG.ENABLE_32P is True:
|
||||
logger.info('[RSS-FEEDS] Initiating Torrent RSS Feed Check on 32P.')
|
||||
if mylar.CONFIG.MODE_32P == 0:
|
||||
if mylar.CONFIG.MODE_32P is False:
|
||||
logger.fdebug('[RSS-FEEDS] 32P mode set to Legacy mode. Monitoring New Releases feed only.')
|
||||
if any([mylar.CONFIG.PASSKEY_32P is None, mylar.CONFIG.PASSKEY_32P == '', mylar.CONFIG.RSSFEED_32P is None, mylar.CONFIG.RSSFEED_32P == '']):
|
||||
logger.error('[RSS-FEEDS] Unable to validate information from provided RSS Feed. Verify that the feed provided is a current one.')
|
||||
|
|
|
@ -5877,9 +5877,9 @@ class WebInterface(object):
|
|||
|
||||
download_0day.exposed = True
|
||||
|
||||
def test_32p(self):
|
||||
def test_32p(self, username, password):
|
||||
import auth32p
|
||||
tmp = auth32p.info32p(test=True)
|
||||
tmp = auth32p.info32p(test={'username': username, 'password': password})
|
||||
rtnvalues = tmp.authenticate()
|
||||
if rtnvalues['status'] is True:
|
||||
return json.dumps({"status": "Successfully Authenticated.", "inkdrops": mylar.INKDROPS_32P})
|
||||
|
|
Loading…
Add table
Reference in a new issue