diff --git a/server.py b/server.py index b778cbfe3950a46fbecf20c96465f30558a2fe0a..55d76b1fa09fad4bd60fc3673a5b5934f38f7069 100644 --- a/server.py +++ b/server.py @@ -14,6 +14,7 @@ from socket import gethostname from ipaddress import ip_address, ip_network import math import locale +import base64 locale.setlocale(locale.LC_ALL, 'de_DE.utf8') @@ -28,6 +29,7 @@ app.add_template_global(gethostname, name='gethostname') app.add_template_global(min, name='min') app.add_template_global(max, name='max') + scheduler = sched.scheduler() def run_scheduler(): import time @@ -132,6 +134,10 @@ def evalperm(perms): return cperms return [{'type': 'public'}] +@app.template_filter() +def base64encode(str): + return base64.b64encode(str.encode('UTF-8')).decode('UTF-8') + @app.template_filter() def checkperm(perms, username=None, password=None): if ismod(): diff --git a/templates/changelog.html b/templates/changelog.html index ec76f038edc3d029c09f26a59bd09bdd8e1fe89f..87db02fbf6d8071905153c5ad486fb83fd37ebae 100644 --- a/templates/changelog.html +++ b/templates/changelog.html @@ -47,7 +47,7 @@ <td style="white-space: nowrap;">{{i.path}}</td> <td>"{{i.value_old}}"</td> <td>"{{i.value_new}}"</td> - <td><button onclick="moderator.api.set('{{i.path}}','{{i.value_old}}');alert('done');" class="btn btn-default">undo</button></td> + <td><button onclick="moderator.api.set('{{i.path}}',atob('{{i.value_old|base64encode }}'));alert('done');" class="btn btn-default">undo</button></td> </tr> {% endfor %} </table>