Commit 1805fe68 authored by echel0n's avatar echel0n
Browse files

Merge branch 'release/9.3.97'

parents 95d2a78f 84de9fe2
# Changelog
- * a7a330f - 2018-10-17: Release v9.3.96
- * d7e782f - 2018-10-21: Release v9.3.97
- * a5f7b6a - 2018-10-21: Fixed issues with network timezones
- * af471d1 - 2018-10-21: Added API denied handling
- * f37d3db - 2018-10-17: Fixed typo for API notification retrieval
- * ed1b33e - 2018-10-17: Release v9.3.96
- * ecb1600 - 2018-10-17: Fixed setting caps issue when searching newznab providers
- * bbbc6cb - 2018-10-17: Fixed 'Notification' object has no attribute 'type' issue.
- * aad016d - 2018-10-16: Release v9.3.95
......
......@@ -345,7 +345,7 @@ class Core(object):
),
name=self.version_updater.name,
id=self.version_updater.name
)
).func()
# add network timezones updater job
self.scheduler.add_job(
......@@ -355,7 +355,7 @@ class Core(object):
),
name="TZUPDATER",
id="TZUPDATER"
)
).func()
# add show updater job
self.scheduler.add_job(
......
......@@ -29,7 +29,7 @@ from tornado.web import Application, RedirectHandler, StaticFileHandler
import sickrage
from sickrage.core.helpers import create_https_certificates, launch_browser
from sickrage.core.webserver.api import ApiHandler, KeyHandler
from sickrage.core.webserver.api import ApiHandler
from sickrage.core.webserver.routes import Route
from sickrage.core.webserver.views import CalendarHandler, LoginHandler, LogoutHandler
from sickrage.core.websocket import WebSocketUIHandler
......@@ -121,15 +121,12 @@ class WebServer(object):
# Static File Handlers
self.app.add_handlers('.*$', [
# api
(r'%s(/?.*)' % self.api_root, ApiHandler),
(r'%s/api/(\w{32})(/?.*)' % sickrage.app.config.web_root, ApiHandler),
# redirect to home
(r"(%s)" % sickrage.app.config.web_root, RedirectHandler,
{"url": "%s/home" % sickrage.app.config.web_root}),
# api key
(r'%s/getkey(/?.*)' % sickrage.app.config.web_root, KeyHandler),
# api builder
(r'%s/api/builder' % sickrage.app.config.web_root, RedirectHandler,
{"url": sickrage.app.config.web_root + '/apibuilder/'}),
......
......@@ -32,7 +32,6 @@ from tornado.escape import json_encode, recursive_unicode
from tornado.web import RequestHandler
import sickrage.subtitles
from sickrage.core import API
try:
from futures import ThreadPoolExecutor
......@@ -80,27 +79,6 @@ result_type_map = {
}
class KeyHandler(RequestHandler):
def __init__(self, *args, **kwargs):
super(KeyHandler, self).__init__(*args, **kwargs)
def prepare(self, *args, **kwargs):
api_key = None
try:
username = self.get_argument('u', None)
password = self.get_argument('p', None)
api_token = API(username, password).token
if api_token:
api_key = sickrage.app.config.api_key
self.finish({'success': api_key is not None, 'api_key': api_key})
except Exception:
sickrage.app.log.error('Failed doing key request: %s' % (traceback.format_exc()))
self.finish({'success': False, 'error': 'Failed returning results'})
# basically everything except RESULT_SUCCESS / success is bad
class ApiHandler(RequestHandler):
""" api class that returns json results """
......@@ -116,27 +94,34 @@ class ApiHandler(RequestHandler):
'image': self._out_as_image,
}
accessMsg = "IP:{} - ACCESS GRANTED".format(self.request.remote_ip)
sickrage.app.log.debug(accessMsg)
if sickrage.app.config.api_key == self.path_args[0]:
accessMsg = "IP:{} - ACCESS GRANTED".format(self.request.remote_ip)
sickrage.app.log.debug(accessMsg)
# set the original call_dispatcher as the local _call_dispatcher
_call_dispatcher = self.call_dispatcher
# set the original call_dispatcher as the local _call_dispatcher
_call_dispatcher = self.call_dispatcher
# if profile was set wrap "_call_dispatcher" in the profile function
if 'profile' in self.request.arguments:
from profilehooks import profile
# if profile was set wrap "_call_dispatcher" in the profile function
if 'profile' in self.request.arguments:
from profilehooks import profile
_call_dispatcher = profile(_call_dispatcher, immediate=True)
del self.request.arguments["profile"]
_call_dispatcher = profile(_call_dispatcher, immediate=True)
del self.request.arguments["profile"]
try:
outDict = self.route(_call_dispatcher, **self.request.arguments)
except Exception as e:
sickrage.app.log.error(str(e))
errorData = {"error_msg": e, "request arguments": self.request.arguments}
outDict = _responds(RESULT_FATAL,
errorData,
"SiCKRAGE encountered an internal error! Please report to the Devs")
try:
outDict = self.route(_call_dispatcher, **self.request.arguments)
except Exception as e:
sickrage.app.log.error(str(e))
errorData = {"error_msg": e, "request arguments": self.request.arguments}
outDict = _responds(RESULT_FATAL,
errorData,
"SiCKRAGE encountered an internal error! Please report to the Devs")
else:
accessMsg = "IP:{} - ACCESS DENIED".format(self.request.remote_ip)
sickrage.app.log.debug(accessMsg)
errorData = {"error_msg": accessMsg, "request arguments": self.request.arguments}
outDict = _responds(RESULT_DENIED, errorData, accessMsg)
outputCallback = outputCallbackDict['default']
if 'outputType' in outDict:
......@@ -1432,7 +1417,7 @@ class CMD_SiCKRAGEGetMessages(ApiCall):
messages = []
for cur_notification in sickrage.app.alerts.get_notifications(self.request.remote_ip):
messages.append({"title": cur_notification.data['title'],
"message": cur_notification.data['message'],
"message": cur_notification.data['body'],
"type": cur_notification.data['type']})
return _responds(RESULT_SUCCESS, messages)
......
......@@ -141,7 +141,7 @@ class Show(dict):
else:
# If it's not numeric, it must be an attribute name, which
# doesn't exist, so attribute error.
raise tvdb_attributenotfound("Cannot find attribute {}".format(repr(key)))
raise tvdb_attributenotfound("Cannot find show attribute {}".format(repr(key)))
def airedOn(self, date):
ret = self.search(str(date), 'firstaired')
......@@ -210,7 +210,7 @@ class Season(dict):
if key and (isinstance(key, int) or key.isdigit()):
raise tvdb_episodenotfound("Could not find episode {}".format(repr(key)))
else:
raise tvdb_attributenotfound("Cannot find attribute {}".format(repr(key)))
raise tvdb_attributenotfound("Cannot find season attribute {}".format(repr(key)))
def search(self, term=None, key=None):
"""Search all episodes in season, returns a list of matching Episode
......@@ -247,7 +247,7 @@ class Episode(dict):
try:
return dict.__getitem__(self, key)
except KeyError:
raise tvdb_attributenotfound("Cannot find attribute {}".format(repr(key)))
raise tvdb_attributenotfound("Cannot find episode attribute {}".format(repr(key)))
def search(self, term=None, key=None):
"""Search episode data for term, if it matches, return the Episode (self).
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:18\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:14\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Arabic\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "استخدام تخصيص عرض النطاق الترددي العال
msgid "Test Connection"
msgstr "اختبار الاتصال"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:18\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:14\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Catalan\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "Utilitzeu Alt amplada de banda assignació si prioritat és alt"
msgid "Test Connection"
msgstr "Connexió de prova"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:18\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:14\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Czech\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "s velkou šířkou pásma přiřazení použít, je-li prioritou je vyso
msgid "Test Connection"
msgstr "Testovat připojení"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:18\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:14\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Danish\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "bruge høj båndbredde tildeling, hvis prioritet er høj"
msgid "Test Connection"
msgstr "Prøvetilslutningen"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:19\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:14\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: German\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "Verwenden Sie hohe Bandbreitenzuordnung, wenn die Priorität hoch ist"
msgid "Test Connection"
msgstr "Testverbindung"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:19\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:14\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: Greek\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "χρησιμοποιεί υψηλού εύρους ζώνης εκχώρ
msgid "Test Connection"
msgstr "Δοκιμή σύνδεσης"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
......@@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sickragetv\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2018-10-17 07:17-0700\n"
"PO-Revision-Date: 2018-10-17 14:19\n"
"POT-Creation-Date: 2018-10-21 01:13-0700\n"
"PO-Revision-Date: 2018-10-21 08:15\n"
"Last-Translator: echel0n <[email protected]>\n"
"Language-Team: English\n"
"MIME-Version: 1.0\n"
......@@ -4350,7 +4350,7 @@ msgstr "use high bandwidth allocation if priority is high"
msgid "Test Connection"
msgstr "Test Connection"
#: sickrage/core/webserver/api.py:968
#: sickrage/core/webserver/api.py:953
#: sickrage/core/webserver/views/config/subtitles.mako:10
#: sickrage/core/webserver/views/config/subtitles.mako:26
#: sickrage/core/webserver/views/home/display_show.mako:710
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment