From 61f3e0ccc3617461585517e583824b11435eac62 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Jan 2025 14:49:10 -0500 Subject: [PATCH 1/2] FEP-67ff --- FEDERATION.md | 3 +++ catalog/common/jsondata.py | 2 +- common/models/index.py | 1 - docs/internals/federation.md | 19 +++++++++++++++---- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 FEDERATION.md diff --git a/FEDERATION.md b/FEDERATION.md new file mode 100644 index 00000000..8f93139f --- /dev/null +++ b/FEDERATION.md @@ -0,0 +1,3 @@ +# Federation + +see [doc](docs/internals/federation.md) for FEP-67ff related information. diff --git a/catalog/common/jsondata.py b/catalog/common/jsondata.py index 8287eeea..4765f9b3 100644 --- a/catalog/common/jsondata.py +++ b/catalog/common/jsondata.py @@ -313,7 +313,7 @@ def from_json(self: "fields.Field", value): # type:ignore if isinstance(value, list): return value else: # backward compatible with dirty legacy data - logger.error(f"ArrayField has irregular value: {self.name}: {value}") + # logger.error(f"ArrayField has irregular value: {self.name}: {value}") return [value] return [] diff --git a/common/models/index.py b/common/models/index.py index 3e0a0e84..784a6e4c 100644 --- a/common/models/index.py +++ b/common/models/index.py @@ -51,7 +51,6 @@ def __init__(self, query: str, page: int = 1, page_size: int = 0): def is_valid(self): """Check if the parsed query is valid""" - print(self.page, self.max_pages, self.q, self.filter_by) return ( self.page > 0 and self.page <= self.max_pages diff --git a/docs/internals/federation.md b/docs/internals/federation.md index 58997f10..496019cb 100644 --- a/docs/internals/federation.md +++ b/docs/internals/federation.md @@ -1,12 +1,19 @@ # Federation -## ActivityPub +## Supported federation protocols and standards -NeoDB's ActivityPub implementation is based on [Takahē](https://jointakahe.org), with some change to enable interchange of additional information between NeoDB instances. +- [ActivityPub](https://www.w3.org/TR/activitypub/) (Server-to-Server) +- [WebFinger](https://webfinger.net/) +- [Http Signatures](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures) +- [NodeInfo](https://nodeinfo.diaspora.software/) + +## Supported FEPs + +- [FEP-f1d5: NodeInfo in Fediverse Software](https://codeberg.org/fediverse/fep/src/branch/main/fep/f1d5/fep-f1d5.md) -### NodeInfo +## NodeInfo -NeoDB instances can be identified from user agent string (`NeoDB/x.x (+https://example.org)`) and its nodeinfo, e.g. https://neodb.social/nodeinfo/2.0/ : +NeoDB instances can be identified from user agent string (`NeoDB/x.x (+https://example.org)`) and `protocols` in its nodeinfo, e.g. https://neodb.social/nodeinfo/2.0/ : ```json { "version": "2.0", @@ -21,6 +28,10 @@ NeoDB instances can be identified from user agent string (`NeoDB/x.x (+https://e ``` +## ActivityPub + +NeoDB's ActivityPub implementation is based on [Takahē](https://jointakahe.org), with some change to enable interchange of additional information between NeoDB instances. + ### Activity NeoDB add additional fields to `Note` activity: From 2bfc772d22328ab4d1ff57ccaa6db7b858e67854 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Jan 2025 18:41:31 -0500 Subject: [PATCH 2/2] action bar in search result --- common/templates/_header.html | 10 ++++------ journal/templates/_list_item.html | 20 ++++++++++++-------- locale/zh_Hans/LC_MESSAGES/django.po | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/common/templates/_header.html b/common/templates/_header.html index 4c802381..7793149a 100644 --- a/common/templates/_header.html +++ b/common/templates/_header.html @@ -44,12 +44,10 @@ {% endif %} - {% if request.user.is_authenticated %} - - - {% endif %} + + diff --git a/journal/templates/_list_item.html b/journal/templates/_list_item.html index 9a087264..6bf8b373 100644 --- a/journal/templates/_list_item.html +++ b/journal/templates/_list_item.html @@ -46,8 +46,15 @@ {% if mark.shelf %}
+ {% include "action_open_post.html" with post=mark.shelfmember.latest_post %} {{ mark.created_time|date }}
+
+ {% comment %} {{ mark.owner.display_name }} {% endcomment %} + {{ mark.status_label }} + {% if mark.rating_grade %}{{ mark.rating_grade|rating_star }}{% endif %} + {{ mark.comment.html|safe }} +
{% for tag in mark.tags %} {% if forloop.counter <= 5 %} @@ -57,19 +64,15 @@ {% endif %} {% endfor %} -
- {% comment %} {{ mark.owner.display_name }} {% endcomment %} - {{ mark.status_label }} - {% if mark.rating_grade %}{{ mark.rating_grade|rating_star }}{% endif %} - {{ mark.comment.html|safe }} -
+ {% if mark.comment.latest_post %}
{% endif %}
{% endif %} {% if mark.review %}
- +
+ {% include "action_open_post.html" with post=mark.review.latest_post %} {{ mark.review.created_time|date }} - +
{% trans "Review" %} @@ -78,6 +81,7 @@ - {{ mark.review.plain_content }}
+ {% if mark.review.latest_post %}
{% endif %}
{% endif %} {% endif %} diff --git a/locale/zh_Hans/LC_MESSAGES/django.po b/locale/zh_Hans/LC_MESSAGES/django.po index d6bf131d..bcc89cf8 100644 --- a/locale/zh_Hans/LC_MESSAGES/django.po +++ b/locale/zh_Hans/LC_MESSAGES/django.po @@ -2517,7 +2517,7 @@ msgstr "" "   %(site_name)s 致力于提供一个涵盖书籍、影视、音乐、游戏、播客的自由开放互联的收藏评论空间。 你可以在这里记录你的收藏和想法,以及发现新的内容和朋友。\n" "

\n" "

\n" -"   登录%(site_name)s的最佳方式通过联邦宇宙(Fediverse,有时也被称为长毛象,一种分布式社交网络)实例账号,如果你还没有注册过,可先选择实例并注册。\n" +"   登录%(site_name)s的最佳方式通过联邦宇宙(Fediverse,一种分布式社交网络)实例账号,如果你还没有注册过,可先选择实例并注册。\n" "

\n" "

\n" "   如果还没准备好注册联邦宇宙也没问题,你可以在登录页面选择电子邮件注册,未来再连接到联邦宇宙。\n" @@ -4256,7 +4256,7 @@ msgstr "推荐输入电子邮件地址作为备用登录方式。" #: users/templates/users/account.html:73 users/templates/users/login.html:69 msgid "Fediverse (Mastodon)" -msgstr "联邦宇宙(有时也被称为长毛象)" +msgstr "联邦宇宙(Mastodon API)" #: users/templates/users/account.html:79 msgid "Verified Identity"