From 641a456c4c8fa3120cb0c2f4caf74c4be387a41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Sun, 23 Apr 2023 00:38:27 +0200 Subject: [PATCH] feat: project RSS feed. --- MANIFEST.in | 2 +- ihatemoney/models.py | 6 +- ihatemoney/templates/edit_project.html | 4 + ihatemoney/templates/layout.html | 1 + ihatemoney/templates/list_bills.html | 3 + ihatemoney/templates/project_feed.xml | 22 ++ ihatemoney/tests/budget_test.py | 372 ++++++++++++++++++ .../tests/common/ihatemoney_testcase.py | 2 + ihatemoney/web.py | 52 ++- setup.cfg | 1 + tox.ini | 2 +- 11 files changed, 462 insertions(+), 5 deletions(-) create mode 100644 ihatemoney/templates/project_feed.xml diff --git a/MANIFEST.in b/MANIFEST.in index ff5fdcbad..80b2334ea 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include *.rst -recursive-include ihatemoney *.rst *.py *.yaml *.po *.mo *.html *.css *.js *.eot *.svg *.woff *.txt *.png *.webp *.ini *.cfg *.j2 *.jpg *.gif *.ico +recursive-include ihatemoney *.rst *.py *.yaml *.po *.mo *.html *.css *.js *.eot *.svg *.woff *.txt *.png *.webp *.ini *.cfg *.j2 *.jpg *.gif *.ico *.xml include LICENSE CONTRIBUTORS CHANGELOG.rst diff --git a/ihatemoney/models.py b/ihatemoney/models.py index 80732529c..c3d72dc88 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -453,7 +453,8 @@ def generate_token(self, token_type="auth"): """Generate a timed and serialized JsonWebToken :param token_type: Either "auth" for authentication (invalidated when project code changed), - or "reset" for password reset (invalidated after expiration) + or "reset" for password reset (invalidated after expiration), + or "feed" for project feeds (invalidated when project code changed) """ if token_type == "reset": @@ -476,7 +477,8 @@ def verify_token(token, token_type="auth", project_id=None, max_age=3600): :param token: Serialized TimedJsonWebToken :param token_type: Either "auth" for authentication (invalidated when project code changed), - or "reset" for password reset (invalidated after expiration) + or "reset" for password reset (invalidated after expiration), + or "feed" for project feeds (invalidated when project code changed) :param project_id: Project ID. Used for token_type "auth" to use the password as serializer secret key. :param max_age: Token expiration time (in seconds). Only used with token_type "reset" diff --git a/ihatemoney/templates/edit_project.html b/ihatemoney/templates/edit_project.html index 1834b3755..f4e108034 100644 --- a/ihatemoney/templates/edit_project.html +++ b/ihatemoney/templates/edit_project.html @@ -36,6 +36,10 @@

{{ _("Download project's data") }}

{{ _('Bill items') }} + + {{ static_include("images/globe.svg") | safe }} + RSS + {{ static_include("images/file-alt.svg") | safe }} JSON diff --git a/ihatemoney/templates/layout.html b/ihatemoney/templates/layout.html index c99960eb0..9cfd2ceff 100644 --- a/ihatemoney/templates/layout.html +++ b/ihatemoney/templates/layout.html @@ -103,6 +103,7 @@ {% if g.project %}
  • {{ _("History") }}
  • {{ _("Settings") }}
  • +
  • {{ _("RSS Feed") }}
  • {% endif %} {% if session['projects'] and not ((session['projects'] | length) == 1 and g.project and g.project.id in session['projects']) %} diff --git a/ihatemoney/templates/list_bills.html b/ihatemoney/templates/list_bills.html index 947e97786..78d0b952e 100644 --- a/ihatemoney/templates/list_bills.html +++ b/ihatemoney/templates/list_bills.html @@ -44,6 +44,9 @@ {% endblock %} +{% block head %} + +{% endblock %} {% block sidebar %}