diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 5a5bd7c3..5cc9cf2a 100755 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -837,16 +837,16 @@
- +
- + ( monitor the NEW releases feed & your personal notifications )
-
+
@@ -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); diff --git a/mylar/auth32p.py b/mylar/auth32p.py index 8544288f..9dc409f1 100644 --- a/mylar/auth32p.py +++ b/mylar/auth32p.py @@ -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!'} diff --git a/mylar/rsscheck.py b/mylar/rsscheck.py index 3f5b38c3..d753ddb4 100755 --- a/mylar/rsscheck.py +++ b/mylar/rsscheck.py @@ -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) diff --git a/mylar/rsscheckit.py b/mylar/rsscheckit.py index 4bacd1ee..930e3115 100755 --- a/mylar/rsscheckit.py +++ b/mylar/rsscheckit.py @@ -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.') diff --git a/mylar/webserve.py b/mylar/webserve.py index 5d6ee7ca..8fd15317 100644 --- a/mylar/webserve.py +++ b/mylar/webserve.py @@ -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})