From 055f91e280e6a80f7b40b1f50c1ca557021d88d2 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 22 2015 07:37:45 +0000 Subject: [PATCH 1/5] Fix the systemd init file The description file must be on one line otherwise it breaks starting the service --- diff --git a/ev-server/pagure_ev.service b/ev-server/pagure_ev.service index b202a0e..d980441 100644 --- a/ev-server/pagure_ev.service +++ b/ev-server/pagure_ev.service @@ -1,6 +1,5 @@ [Unit] -Description=Pagure EventSource server (Allowing live refresh of the pages -supporting it) +Description=Pagure EventSource server (Allowing live refresh of the pages supporting it) After=redis.target Documentation=https://pagure.io/pagure From 048e58e795a37f3bed0b0d38f0fea28e821ca607 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 22 2015 07:37:45 +0000 Subject: [PATCH 2/5] Be more careful about the URL specified, it may be of the wrong format --- diff --git a/ev-server/pagure-stream-server.py b/ev-server/pagure-stream-server.py index 3b2d206..818f701 100644 --- a/ev-server/pagure-stream-server.py +++ b/ev-server/pagure-stream-server.py @@ -48,10 +48,13 @@ def get_obj_from_path(path): """ Return the Ticket or Request object based on the path provided. """ username = None - if path.startswith('/fork'): - username, repo, obj, objid = path.split('/')[2:6] - else: - repo, obj, objid = path.split('/')[1:4] + try: + if path.startswith('/fork'): + username, repo, obj, objid = path.split('/')[2:6] + else: + repo, obj, objid = path.split('/')[1:4] + except: + raise PagureEvException("Invalid URL: %s" % path) repo = pagure.lib.get_project(pagure.SESSION, repo, user=username) From 8d33027118a4f06240147cf67e5aaafd4f8c5a2a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 22 2015 07:37:45 +0000 Subject: [PATCH 3/5] Allow configuring the port where the event source server runs in the configuration --- diff --git a/ev-server/pagure-stream-server.py b/ev-server/pagure-stream-server.py index 818f701..811fcc0 100644 --- a/ev-server/pagure-stream-server.py +++ b/ev-server/pagure-stream-server.py @@ -164,7 +164,10 @@ def main(): try: loop = trollius.get_event_loop() coro = trollius.start_server( - handle_client, host=None, port=8080, loop=loop) + handle_client, + host=None, + port=pagure.APP.config['EVENTSOURCE_PORT'], + loop=loop) server = loop.run_until_complete(coro) print('Serving on {}'.format(server.sockets[0].getsockname())) loop.run_forever() diff --git a/pagure/default_config.py b/pagure/default_config.py index d426f68..8314098 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -52,6 +52,7 @@ EVENTSOURCE_SOURCE = None REDIS_HOST = '0.0.0.0' REDIS_PORT = 6379 REDIS_DB = 0 +EVENTSOURCE_PORT = 8080 # Folder containing to the git repos GIT_FOLDER = os.path.join( From bbab7a41188b5dbefd9a309bb9ee0604bc674043 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 22 2015 07:37:45 +0000 Subject: [PATCH 4/5] Document the EVENTSOURCE_PORT configuration option in the sample configuration file --- diff --git a/files/pagure.cfg.sample b/files/pagure.cfg.sample index ac2045a..263dc78 100644 --- a/files/pagure.cfg.sample +++ b/files/pagure.cfg.sample @@ -129,6 +129,10 @@ EVENTSOURCE_SOURCE = None REDIS_HOST = '0.0.0.0' REDIS_PORT = 6379 REDIS_DB = 0 +# Port where the event source server is running (maybe be the same port +# as the one specified in EVENTSOURCE_SOURCE or a different one if you +# have something running in front of the server such as apache or stunnel). +EVENTSOURCE_PORT = 8080 # Authentication related configuration option From 88a560b8c838ea15ce1bd55cac64514e21100bc7 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 22 2015 07:37:45 +0000 Subject: [PATCH 5/5] Fix bug in filter_img_src introduced with its moved to the backend library --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index f094e9e..8843f05 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -2285,8 +2285,8 @@ def filter_img_src(name, value): return True if name == 'src': p = urlparse.urlparse(value) - return (not p.netloc) \ - or p.netloc == urlparse.urlparse(APP.config['APP_URL']).netloc + return (not p.netloc) or p.netloc == urlparse.urlparse( + pagure.APP.config['APP_URL']).netloc return False