aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-06-30 18:40:19 +0200
committerDaniel Schadt <kingdread@gmx.de>2022-06-30 18:40:19 +0200
commite224e1758e2bebeaa8ef0a2f04b607a169060b1d (patch)
treef1d5679f7a8e6ece65319be1931b5867e0c1c8b0
parent1cc3b2cc393954d5462e5cf96848dd164d35aa94 (diff)
downloadfietsboek-e224e1758e2bebeaa8ef0a2f04b607a169060b1d.tar.gz
fietsboek-e224e1758e2bebeaa8ef0a2f04b607a169060b1d.tar.bz2
fietsboek-e224e1758e2bebeaa8ef0a2f04b607a169060b1d.zip
add support for invalidating a share link
-rw-r--r--fietsboek/locale/en/LC_MESSAGES/messages.mobin4638 -> 4704 bytes
-rw-r--r--fietsboek/locale/en/LC_MESSAGES/messages.po66
-rw-r--r--fietsboek/locale/fietslog.pot62
-rw-r--r--fietsboek/routes.py1
-rw-r--r--fietsboek/templates/details.jinja23
-rw-r--r--fietsboek/views/detail.py12
6 files changed, 84 insertions, 60 deletions
diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.mo b/fietsboek/locale/en/LC_MESSAGES/messages.mo
index 420885d..75ae61f 100644
--- a/fietsboek/locale/en/LC_MESSAGES/messages.mo
+++ b/fietsboek/locale/en/LC_MESSAGES/messages.mo
Binary files differ
diff --git a/fietsboek/locale/en/LC_MESSAGES/messages.po b/fietsboek/locale/en/LC_MESSAGES/messages.po
index 2c56e7b..793c18b 100644
--- a/fietsboek/locale/en/LC_MESSAGES/messages.po
+++ b/fietsboek/locale/en/LC_MESSAGES/messages.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2022-06-30 00:47+0200\n"
+"POT-Creation-Date: 2022-06-30 18:24+0200\n"
"PO-Revision-Date: 2022-06-28 13:11+0200\n"
"Last-Translator: \n"
"Language: en\n"
@@ -66,31 +66,31 @@ msgstr "November"
msgid "month.december"
msgstr "December"
-#: fietsboek/models/track.py:248
+#: fietsboek/models/track.py:250
msgid "tooltip.table.length"
msgstr "Length"
-#: fietsboek/models/track.py:249
+#: fietsboek/models/track.py:251
msgid "tooltip.table.uphill"
msgstr "Uphill"
-#: fietsboek/models/track.py:250
+#: fietsboek/models/track.py:252
msgid "tooltip.table.downhill"
msgstr "Downhill"
-#: fietsboek/models/track.py:251
+#: fietsboek/models/track.py:253
msgid "tooltip.table.moving_time"
msgstr "Moving Time"
-#: fietsboek/models/track.py:252
+#: fietsboek/models/track.py:254
msgid "tooltip.table.stopped_time"
msgstr "Stopped Time"
-#: fietsboek/models/track.py:253
+#: fietsboek/models/track.py:255
msgid "tooltip.table.max_speed"
msgstr "Max Speed"
-#: fietsboek/models/track.py:254
+#: fietsboek/models/track.py:256
msgid "tooltip.table.avg_speed"
msgstr "Average Speed"
@@ -142,64 +142,68 @@ msgstr "Share Link"
msgid "page.details.sharelink.info"
msgstr "Everyone with access to this link can view the track!"
-#: fietsboek/templates/details.jinja2:25
+#: fietsboek/templates/details.jinja2:26
+msgid "page.details.sharelink.invalidate"
+msgstr "Invalidate link"
+
+#: fietsboek/templates/details.jinja2:28
msgid "page.details.sharelink.close"
msgstr "Close"
-#: fietsboek/templates/details.jinja2:41
+#: fietsboek/templates/details.jinja2:44
msgid "page.details.tags"
msgstr "Tagged as"
-#: fietsboek/templates/details.jinja2:50 fietsboek/templates/edit.jinja2:9
+#: fietsboek/templates/details.jinja2:53 fietsboek/templates/edit.jinja2:9
#: fietsboek/templates/finish_upload.jinja2:9
msgid "page.noscript"
msgstr "JavaScript is disabled, please enable JavaScript"
-#: fietsboek/templates/details.jinja2:55
+#: fietsboek/templates/details.jinja2:58
msgid "page.details.download"
msgstr "Download Tour"
-#: fietsboek/templates/details.jinja2:60
+#: fietsboek/templates/details.jinja2:63
msgid "page.details.date"
msgstr "Date"
-#: fietsboek/templates/details.jinja2:64
+#: fietsboek/templates/details.jinja2:67
msgid "page.details.start_time"
msgstr "Record Start"
-#: fietsboek/templates/details.jinja2:68
+#: fietsboek/templates/details.jinja2:71
msgid "page.details.end_time"
msgstr "Record End"
-#: fietsboek/templates/details.jinja2:72
+#: fietsboek/templates/details.jinja2:75
msgid "page.details.length"
msgstr "Length"
-#: fietsboek/templates/details.jinja2:76
+#: fietsboek/templates/details.jinja2:79
msgid "page.details.uphill"
msgstr "Uphill"
-#: fietsboek/templates/details.jinja2:80
+#: fietsboek/templates/details.jinja2:83
msgid "page.details.downhill"
msgstr "Downhill"
-#: fietsboek/templates/details.jinja2:84
+#: fietsboek/templates/details.jinja2:87
msgid "page.details.moving_time"
msgstr "Moving Time"
-#: fietsboek/templates/details.jinja2:88
+#: fietsboek/templates/details.jinja2:91
msgid "page.details.stopped_time"
msgstr "Stopped Time"
-#: fietsboek/templates/details.jinja2:92
+#: fietsboek/templates/details.jinja2:95
msgid "page.details.max_speed"
msgstr "Max Speed"
-#: fietsboek/templates/details.jinja2:96
+#: fietsboek/templates/details.jinja2:99
msgid "page.details.avg_speed"
msgstr "Average Speed"
-#: fietsboek/templates/details.jinja2:112
+#: fietsboek/templates/details.jinja2:115
msgid "page.details.comments"
msgstr "Comments"
@@ -241,7 +245,9 @@ msgstr "Public"
#: fietsboek/templates/edit_form.jinja2:18
msgid "page.track.form.visibility.info"
-msgstr "Note that tagged people and people with the share link can always view the track."
+msgstr ""
+"Note that tagged people and people with the share link can always view "
+"the track."
#: fietsboek/templates/edit_form.jinja2:22
msgid "page.track.form.tags"
@@ -281,27 +287,27 @@ msgstr "Home"
msgid "page.home.total"
msgstr "Total"
-#: fietsboek/templates/layout.jinja2:32
+#: fietsboek/templates/layout.jinja2:33
msgid "page.navbar.toggle"
msgstr "Toggle navigation"
-#: fietsboek/templates/layout.jinja2:38
+#: fietsboek/templates/layout.jinja2:39
msgid "page.navbar.home"
msgstr "Home"
-#: fietsboek/templates/layout.jinja2:42
+#: fietsboek/templates/layout.jinja2:43
msgid "page.navbar.login"
msgstr "Login"
-#: fietsboek/templates/layout.jinja2:46
+#: fietsboek/templates/layout.jinja2:47
msgid "page.navbar.logout"
msgstr "Logout"
-#: fietsboek/templates/layout.jinja2:49
+#: fietsboek/templates/layout.jinja2:50
msgid "page.navbar.upload"
msgstr "Upload"
-#: fietsboek/templates/layout.jinja2:53
+#: fietsboek/templates/layout.jinja2:54
msgid "page.navbar.admin"
msgstr "Admin"
diff --git a/fietsboek/locale/fietslog.pot b/fietsboek/locale/fietslog.pot
index 3ab494d..fcef4e2 100644
--- a/fietsboek/locale/fietslog.pot
+++ b/fietsboek/locale/fietslog.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2022-06-30 00:47+0200\n"
+"POT-Creation-Date: 2022-06-30 18:24+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -65,31 +65,31 @@ msgstr ""
msgid "month.december"
msgstr ""
-#: fietsboek/models/track.py:248
+#: fietsboek/models/track.py:250
msgid "tooltip.table.length"
msgstr ""
-#: fietsboek/models/track.py:249
+#: fietsboek/models/track.py:251
msgid "tooltip.table.uphill"
msgstr ""
-#: fietsboek/models/track.py:250
+#: fietsboek/models/track.py:252
msgid "tooltip.table.downhill"
msgstr ""
-#: fietsboek/models/track.py:251
+#: fietsboek/models/track.py:253
msgid "tooltip.table.moving_time"
msgstr ""
-#: fietsboek/models/track.py:252
+#: fietsboek/models/track.py:254
msgid "tooltip.table.stopped_time"
msgstr ""
-#: fietsboek/models/track.py:253
+#: fietsboek/models/track.py:255
msgid "tooltip.table.max_speed"
msgstr ""
-#: fietsboek/models/track.py:254
+#: fietsboek/models/track.py:256
msgid "tooltip.table.avg_speed"
msgstr ""
@@ -141,64 +141,68 @@ msgstr ""
msgid "page.details.sharelink.info"
msgstr ""
-#: fietsboek/templates/details.jinja2:25
+#: fietsboek/templates/details.jinja2:26
+msgid "page.details.sharelink.invalidate"
+msgstr ""
+
+#: fietsboek/templates/details.jinja2:28
msgid "page.details.sharelink.close"
msgstr ""
-#: fietsboek/templates/details.jinja2:41
+#: fietsboek/templates/details.jinja2:44
msgid "page.details.tags"
msgstr ""
-#: fietsboek/templates/details.jinja2:50 fietsboek/templates/edit.jinja2:9
+#: fietsboek/templates/details.jinja2:53 fietsboek/templates/edit.jinja2:9
#: fietsboek/templates/finish_upload.jinja2:9
msgid "page.noscript"
msgstr ""
-#: fietsboek/templates/details.jinja2:55
+#: fietsboek/templates/details.jinja2:58
msgid "page.details.download"
msgstr ""
-#: fietsboek/templates/details.jinja2:60
+#: fietsboek/templates/details.jinja2:63
msgid "page.details.date"
msgstr ""
-#: fietsboek/templates/details.jinja2:64
+#: fietsboek/templates/details.jinja2:67
msgid "page.details.start_time"
msgstr ""
-#: fietsboek/templates/details.jinja2:68
+#: fietsboek/templates/details.jinja2:71
msgid "page.details.end_time"
msgstr ""
-#: fietsboek/templates/details.jinja2:72
+#: fietsboek/templates/details.jinja2:75
msgid "page.details.length"
msgstr ""
-#: fietsboek/templates/details.jinja2:76
+#: fietsboek/templates/details.jinja2:79
msgid "page.details.uphill"
msgstr ""
-#: fietsboek/templates/details.jinja2:80
+#: fietsboek/templates/details.jinja2:83
msgid "page.details.downhill"
msgstr ""
-#: fietsboek/templates/details.jinja2:84
+#: fietsboek/templates/details.jinja2:87
msgid "page.details.moving_time"
msgstr ""
-#: fietsboek/templates/details.jinja2:88
+#: fietsboek/templates/details.jinja2:91
msgid "page.details.stopped_time"
msgstr ""
-#: fietsboek/templates/details.jinja2:92
+#: fietsboek/templates/details.jinja2:95
msgid "page.details.max_speed"
msgstr ""
-#: fietsboek/templates/details.jinja2:96
+#: fietsboek/templates/details.jinja2:99
msgid "page.details.avg_speed"
msgstr ""
-#: fietsboek/templates/details.jinja2:112
+#: fietsboek/templates/details.jinja2:115
msgid "page.details.comments"
msgstr ""
@@ -280,27 +284,27 @@ msgstr ""
msgid "page.home.total"
msgstr ""
-#: fietsboek/templates/layout.jinja2:32
+#: fietsboek/templates/layout.jinja2:33
msgid "page.navbar.toggle"
msgstr ""
-#: fietsboek/templates/layout.jinja2:38
+#: fietsboek/templates/layout.jinja2:39
msgid "page.navbar.home"
msgstr ""
-#: fietsboek/templates/layout.jinja2:42
+#: fietsboek/templates/layout.jinja2:43
msgid "page.navbar.login"
msgstr ""
-#: fietsboek/templates/layout.jinja2:46
+#: fietsboek/templates/layout.jinja2:47
msgid "page.navbar.logout"
msgstr ""
-#: fietsboek/templates/layout.jinja2:49
+#: fietsboek/templates/layout.jinja2:50
msgid "page.navbar.upload"
msgstr ""
-#: fietsboek/templates/layout.jinja2:53
+#: fietsboek/templates/layout.jinja2:54
msgid "page.navbar.admin"
msgstr ""
diff --git a/fietsboek/routes.py b/fietsboek/routes.py
index ef4fdd0..f9ee27e 100644
--- a/fietsboek/routes.py
+++ b/fietsboek/routes.py
@@ -10,6 +10,7 @@ def includeme(config):
config.add_route('details', '/track/{id}')
config.add_route('edit', '/edit/{id}')
config.add_route('gpx', '/gpx/{id}.gpx')
+ config.add_route('invalidate-share', '/track/{id}/invalidate-link')
config.add_route('badge', '/badge/{id}')
config.add_route('admin', '/admin')
config.add_route('admin-badge-add', '/admin/add-badge')
diff --git a/fietsboek/templates/details.jinja2 b/fietsboek/templates/details.jinja2
index e335880..ae07fef 100644
--- a/fietsboek/templates/details.jinja2
+++ b/fietsboek/templates/details.jinja2
@@ -22,6 +22,9 @@
<a href="{{ share_link }}">{{ share_link }}</a>
</div>
<div class="modal-footer">
+ <form method="POST" action="{{ request.route_url('invalidate-share', id=track.id) }}">
+ <button type="submit" class="btn btn-warning">{{ _("page.details.sharelink.invalidate") }}</button>
+ </form>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ _("page.details.sharelink.close") }}</button>
</div>
</div>
diff --git a/fietsboek/views/detail.py b/fietsboek/views/detail.py
index 9069826..f2b76af 100644
--- a/fietsboek/views/detail.py
+++ b/fietsboek/views/detail.py
@@ -1,6 +1,6 @@
from pyramid.view import view_config
from pyramid.response import Response
-from pyramid.httpexceptions import HTTPForbidden
+from pyramid.httpexceptions import HTTPForbidden, HTTPFound
from sqlalchemy import select
@@ -32,6 +32,16 @@ def gpx(request):
return Response(track.gpx_data, content_type="application/gpx+xml")
+@view_config(route_name='invalidate-share', request_method='POST')
+def invalidate_share(request):
+ query = select(models.Track).filter_by(id=request.matchdict["id"])
+ track = request.dbsession.execute(query).scalar_one()
+ if track.owner != request.identity:
+ return HTTPForbidden()
+ track.link_secret = util.random_alphanum_string()
+ return HTTPFound(request.route_url('details', id=track.id))
+
+
@view_config(route_name='badge')
def badge(request):
query = select(models.Badge).filter_by(id=request.matchdict["id"])