fixed etherpad links

This commit is contained in:
root (fetsite6)
2020-10-19 21:45:11 +02:00
parent c6fdd1c399
commit 47db0c2176
4 changed files with 6 additions and 9 deletions

View File

@@ -6,6 +6,8 @@ services:
FLASK_DEBUG: 1
FLASK_APP: main.py
pages_root: /app/data
volumes:
- /mnt/fotos/www:/app/data
mysql:
image: jbergstroem/mariadb-alpine
environment:

View File

@@ -19,7 +19,6 @@ def get_ep_client():
with open(os.path.abspath(settings.ETHERPAD_CLIENT["apikey"]), "r") as f:
apikey = f.read()
apikey = apikey.rstrip()
#logger.info(apikey)
epc = EtherpadLiteClient(
base_params={'apikey': apikey, },
base_url=urllib.parse.urljoin(settings.ETHERPAD_CLIENT["url"], "api"),
@@ -57,23 +56,18 @@ def __checkPadExists(padID=None):
def createPadifNotExists(padID):
epc, group = get_ep_client()
if not epc:
logger.info("meh, not EPC")
return None
# Pad doesn't exist
if not __checkPadExists(padID=padID):
try:
logger.info("trying creategrouppad")
epc.createGroupPad(groupID=group["groupID"], padName=padID, text="helloworld")
except EtherpadException as e:
# TODO: change it after Etherpad server is a better one than that because of http 500
logger.info("print e")
print(e)
return None
except Exception as e:
logger.info("raise e")
raise e
logger.info(padID)
return padID
@@ -95,6 +89,7 @@ def get_pad_link(padID):
epc, group = get_ep_client()
if epc:
return urllib.parse.urljoin(SERVER_URL, 'p/' + group["groupID"] + '$' + str(padID))
logger.info("PATRICK: "+settings.ETHERPAD_CLIENT["exturl"])
return urllib.parse.urljoin(settings.ETHERPAD_CLIENT["exturl"], 'p/' + group["groupID"] + '$' + str(padID))
return ""

View File

@@ -237,7 +237,7 @@ if DEBUG:
else:
ETHERPAD_CLIENT = {
'url': "http://etherpad:"+env('ETHERPAD_PORT'),
'exturl': urljoin(env('HOST_NAME'),"etherpad"),
'exturl': urljoin('https://' + env('HOST_NAME'),"etherpad/"),
'apikey': "/app/etherpad/APIKEY.txt"
}

View File

@@ -54,7 +54,7 @@ footer {
{% endif %}
<li class=""><a href="{% url 'posts.index' %}">Aktuelles</a></li>
<li class=""><a href="{%url 'members'%}">Fachschaft</a></li>
<li class=""><a href="/fotos">Fotos</a></li>
<li class=""><a href="/fotos/">Fotos</a></li>
<li class=""><a href="/blackboard">Blackboard</a></li>
{% if request.user.is_authenticated %}
<li class=""><a href="{%url 'logout'%}">Logout</a></li>