From d4a44a05a40912faf70873d46ad8b9c32eff0684 Mon Sep 17 00:00:00 2001 From: andis Date: Sat, 17 Oct 2020 11:00:30 +0000 Subject: [PATCH 1/4] Etherpadfix Teil1 --- fet2020/documents/etherpadlib.py | 7 ++++++- fet2020/fet2020/settings.py | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/fet2020/documents/etherpadlib.py b/fet2020/documents/etherpadlib.py index 3e83ef7f..520fa5ea 100644 --- a/fet2020/documents/etherpadlib.py +++ b/fet2020/documents/etherpadlib.py @@ -38,7 +38,12 @@ def add_ep_cookie(request, response): domain=".2020.fet.at", path="/" ) - + response.set_cookie( + "sessionID", + ep_sessid, + expires=expires, + path="/etherpad" + ) return response diff --git a/fet2020/fet2020/settings.py b/fet2020/fet2020/settings.py index 96501bab..878dffa9 100644 --- a/fet2020/fet2020/settings.py +++ b/fet2020/fet2020/settings.py @@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ import os import environ +from urllib.parse import urljoin + env = environ.Env( # set casting, default value DEBUG=(bool, True), @@ -186,10 +188,9 @@ USE_TZ = True STATIC_URL = '/assets/' STATICFILES_DIRS = [ - os.path.join(BASE_DIR, "static"), - os.path.join(BASE_DIR, "static_design1"), + os.path.join(BASE_DIR, "static") ] - +STATIC_ROOT = 'assets/' MEDIA_ROOT = os.path.join(BASE_DIR, 'files/') MEDIA_URL = '/files/' @@ -219,9 +220,22 @@ THUMBNAIL_ALIASES = { }, } -ETHERPAD_CLIENT = { - 'url': "http://localhost:9003", - 'exturl': "https://etherpad2.2020.fet.at/", - 'apikey': "/srv/andis_test/etherpad_test2/etherpad-lite/APIKEY.txt" -} +if DEBUG: + ETHERPAD_CLIENT = { + 'url': "http://localhost:9001", + 'exturl': "https://etherpad2.2020.fet.at/", + 'apikey': "/srv/etherpad/APIKEY.txt" + } +else: + ETHERPAD_CLIENT = { + 'url': "http://etherpad", + 'exturl': urljoin(env('HOST_NAME'),"etherpad"), + 'apikey': "/app/etherpad/APIKEY.txt" + } + +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES': [ + 'rest_framework.permissions.AllowAny', + ] +} \ No newline at end of file From bb48cee6afd49f91ebff4250bf55e766cedbbc61 Mon Sep 17 00:00:00 2001 From: andis Date: Sat, 17 Oct 2020 20:25:11 +0000 Subject: [PATCH 2/4] fix ettherpad docker --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 88531d5b..a6dbe267 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,8 @@ services: DB_NAME: etherpaddb DB_USER: user DB_PASS: hgu + TRUST_PROXY: "true" + REQUIRE_SESSION: "true" depends_on: - etherpadsql fet2020: From ac80104b5f6f834ad40c95f4736f661ce9d12195 Mon Sep 17 00:00:00 2001 From: andis Date: Sat, 17 Oct 2020 20:25:41 +0000 Subject: [PATCH 3/4] etherpad host setting --- fet2020/fet2020/settings.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fet2020/fet2020/settings.py b/fet2020/fet2020/settings.py index d993a93a..cb3c9ce9 100644 --- a/fet2020/fet2020/settings.py +++ b/fet2020/fet2020/settings.py @@ -1,3 +1,4 @@ + """ Django settings for fet2020 project. @@ -22,7 +23,9 @@ env = environ.Env( MYSQL_DATABASE=(str, "fet2020db"), MYSQL_USER=(str), MYSQL_PASSWORD=(str), - HOST_NAME=(str, "localhost") + HOST_NAME=(str, "localhost"), + ETHERPAD_PORT=(str,"9001"), + ETHERPAD_HOST=(str,"etherpad2.2020.fet.at") ) # Prints and logs are written to console @@ -227,13 +230,13 @@ THUMBNAIL_ALIASES = { if DEBUG: ETHERPAD_CLIENT = { - 'url': "http://localhost:9001", - 'exturl': "https://etherpad2.2020.fet.at/", + 'url': "http://etherpad:"+env('ETHERPAD_PORT'), + 'exturl': env('ETHERPAD_HOST'), 'apikey': "/srv/etherpad/APIKEY.txt" } else: ETHERPAD_CLIENT = { - 'url': "http://etherpad", + 'url': "http://etherpad:"+env('ETHERPAD_PORT'), 'exturl': urljoin(env('HOST_NAME'),"etherpad"), 'apikey': "/app/etherpad/APIKEY.txt" } @@ -244,7 +247,6 @@ REST_FRAMEWORK = { ] } -# ETHERPAD SETTINGS # DJANGO MAIL @@ -257,4 +259,3 @@ EMAIL_USE_TLS = True CRONJOBS = [ ('0 16 * * *', 'posts.cronjobs.check_to_send_agenda_mail'), ] ->>>>>>> b9c1517be5fca7a97ca270bfaa0624b5a7ef7148 From 7ff28611ab29f5d7ba370dcd4f12bc3fa8d0197e Mon Sep 17 00:00:00 2001 From: andis Date: Sat, 17 Oct 2020 20:25:53 +0000 Subject: [PATCH 4/4] fix none link for agenda --- fet2020/posts/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index 59c75942..80f67905 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -78,8 +78,8 @@ def show(request, id=None): if post_author: author_image = post_author.image['avatar'].url - ep_agenda_link = None - ep_protocol_link = None + ep_agenda_link = "#" + ep_protocol_link = "#" if p.has_agenda and p.agenda_key: ep_agenda_link = get_pad_link(p.agenda_key)