diff --git a/docker-compose.yml b/docker-compose.yml index e821e775..3ee58fba 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 ports: diff --git a/fet2020/documents/etherpadlib.py b/fet2020/documents/etherpadlib.py index 5ae69c66..9014d8b6 100644 --- a/fet2020/documents/etherpadlib.py +++ b/fet2020/documents/etherpadlib.py @@ -40,7 +40,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 0ec99b63..1d463ce7 100644 --- a/fet2020/fet2020/settings.py +++ b/fet2020/fet2020/settings.py @@ -1,3 +1,4 @@ + """ Django settings for fet2020 project. @@ -12,6 +13,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), @@ -20,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 @@ -191,7 +196,7 @@ STATIC_URL = '/assets/' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static") ] - +STATIC_ROOT = 'assets/' MEDIA_ROOT = os.path.join(BASE_DIR, 'files/') MEDIA_URL = '/files/' @@ -222,13 +227,28 @@ THUMBNAIL_ALIASES = { }, } -# ETHERPAD SETTINGS -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://etherpad:"+env('ETHERPAD_PORT'), + 'exturl': env('ETHERPAD_HOST'), + 'apikey': "/srv/etherpad/APIKEY.txt" + } +else: + ETHERPAD_CLIENT = { + 'url': "http://etherpad:"+env('ETHERPAD_PORT'), + 'exturl': urljoin(env('HOST_NAME'),"etherpad"), + 'apikey': "/app/etherpad/APIKEY.txt" + } + +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES': [ + 'rest_framework.permissions.AllowAny', + ] } + + # DJANGO MAIL EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'buran.htu.tuwien.ac.at' 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)