From e96ad42c5da8588de3f232654e94e7ef14ee701d Mon Sep 17 00:00:00 2001 From: Alexandre Beloin Date: Fri, 23 Jan 2015 21:45:22 -0500 Subject: [PATCH 1/2] Fix access to webcal without password. --- sickbeard/webserve.py | 12 ++++++++++++ sickbeard/webserveInit.py | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index b6f023f2..90be1c64 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -521,6 +521,18 @@ class WebRoot(WebHandler): return t.respond() + +class CalendarHandler(BaseHandler): + def get(self, *args, **kwargs): + if sickbeard.CALENDAR_UNPROTECTED: + self.write(self.calendar()) + else: + self.calendar_auth() + + @authenticated + def calendar_auth(self): + self.write(self.calendar()) + # Raw iCalendar implementation by Pedro Jose Pereira Vieito (@pvieito). # # iCalendar (iCal) - Standard RFC 5545 diff --git a/sickbeard/webserveInit.py b/sickbeard/webserveInit.py index 2192233a..713e6a7d 100644 --- a/sickbeard/webserveInit.py +++ b/sickbeard/webserveInit.py @@ -3,7 +3,7 @@ import threading import sys import sickbeard -from sickbeard.webserve import LoginHandler, LogoutHandler, KeyHandler +from sickbeard.webserve import LoginHandler, LogoutHandler, KeyHandler, CalendarHandler from sickbeard.webapi import ApiHandler from sickbeard import logger from sickbeard.helpers import create_https_certificates, generateApiKey @@ -93,6 +93,11 @@ class SRWebServer(threading.Thread): # webui handlers ] + route.get_routes(self.options['web_root'])) + # Web calendar handler (Needed because option Unprotected calendar) + self.app.add_handlers('.*$', [ + (r'%s/calendar(/?.*)' % self.options['web_root'], CalendarHandler), + ]) + # Static File Handlers self.app.add_handlers(".*$", [ # favicon From 0888942820ce1a4131528f545d4ee8702cdf5f5e Mon Sep 17 00:00:00 2001 From: Alexandre Beloin Date: Fri, 23 Jan 2015 22:11:54 -0500 Subject: [PATCH 2/2] Fix wrong url handler --- sickbeard/webserveInit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sickbeard/webserveInit.py b/sickbeard/webserveInit.py index 713e6a7d..6ddb53a5 100644 --- a/sickbeard/webserveInit.py +++ b/sickbeard/webserveInit.py @@ -95,7 +95,7 @@ class SRWebServer(threading.Thread): # Web calendar handler (Needed because option Unprotected calendar) self.app.add_handlers('.*$', [ - (r'%s/calendar(/?.*)' % self.options['web_root'], CalendarHandler), + (r'%s/calendar' % self.options['web_root'], CalendarHandler), ]) # Static File Handlers