This commit is contained in:
Tim Bentley 2015-11-08 20:19:02 +00:00
parent 19a2deef30
commit 7299aae51c
2 changed files with 7 additions and 5 deletions

View File

@ -150,7 +150,7 @@ class HttpRouter(RegistryProperties):
self.routes = [ self.routes = [
('^/$', {'function': self.serve_file, 'secure': False}), ('^/$', {'function': self.serve_file, 'secure': False}),
('^/(stage)$', {'function': self.serve_file, 'secure': False}), ('^/(stage)$', {'function': self.serve_file, 'secure': False}),
('^/(stage)/(.*)$', {'function': self.stages, 'secure': False}), ('^/(stages)/(.*)$', {'function': self.stages, 'secure': False}),
('^/(main)$', {'function': self.serve_file, 'secure': False}), ('^/(main)$', {'function': self.serve_file, 'secure': False}),
(r'^/files/(.*)$', {'function': self.serve_file, 'secure': False}), (r'^/files/(.*)$', {'function': self.serve_file, 'secure': False}),
(r'^/(\w+)/thumbnails([^/]+)?/(.*)$', {'function': self.serve_thumbnail, 'secure': False}), (r'^/(\w+)/thumbnails([^/]+)?/(.*)$', {'function': self.serve_thumbnail, 'secure': False}),
@ -352,10 +352,12 @@ class HttpRouter(RegistryProperties):
""" """
log.debug('serve file request %s' % file_name) log.debug('serve file request %s' % file_name)
parts = file_name.split('/') parts = file_name.split('/')
if len(parts) == 3: if len(parts) == 1:
file_name = parts[0] + '/' + parts[2] file_name = parts[0] + '/stage.html'
elif len(parts) == 3:
print(parts)
file_name = parts[1] + '/' + parts[2]
path = os.path.normpath(os.path.join(self.config_dir, file_name)) path = os.path.normpath(os.path.join(self.config_dir, file_name))
print(path)
if not path.startswith(self.config_dir): if not path.startswith(self.config_dir):
return self.do_not_found() return self.do_not_found()
content = None content = None

View File

@ -167,7 +167,7 @@ class HTTPSServer(HTTPServer):
local_data = AppLocation.get_directory(AppLocation.DataDir) local_data = AppLocation.get_directory(AppLocation.DataDir)
self.socket = ssl.SSLSocket( self.socket = ssl.SSLSocket(
sock=socket.socket(self.address_family, self.socket_type), sock=socket.socket(self.address_family, self.socket_type),
ssl_version=ssl.PROTOCOL_TLSv1, ssl_version=ssl.PROTOCOL_TLSv1_2,
certfile=os.path.join(local_data, 'remotes', 'openlp.crt'), certfile=os.path.join(local_data, 'remotes', 'openlp.crt'),
keyfile=os.path.join(local_data, 'remotes', 'openlp.key'), keyfile=os.path.join(local_data, 'remotes', 'openlp.key'),
server_side=True) server_side=True)