Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements #754

Merged
merged 3 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalog/book/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class BookFormat(models.TextChoices):
HARDCOVER = "hardcover", _("Hardcover")
EBOOK = "ebook", _("eBook")
AUDIOBOOK = "audiobook", _("Audiobook")
GRAPHICNOVEL = "graphicnovel", _("GraphicNovel")
# GRAPHICNOVEL = "graphicnovel", _("GraphicNovel")
WEB = "web", _("Web Fiction")
OTHER = "other", _("Other")

Expand Down
6 changes: 2 additions & 4 deletions locale/zh_Hans/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ msgstr "图像小说"

#: catalog/book/models.py:122
msgid "Web Fiction"
msgstr "网络小说"
msgstr "网络作品"

#: catalog/book/models.py:123 catalog/game/models.py:31
msgid "Other"
Expand All @@ -88,10 +88,8 @@ msgid "translator"
msgstr "译者"

#: catalog/book/models.py:186 catalog/templates/edition.html:27
#, fuzzy
#| msgid "books to read"
msgid "book format"
msgstr "想读的书"
msgstr "格式"

#: catalog/book/models.py:193 catalog/templates/edition.html:33
msgid "publishing house"
Expand Down
6 changes: 2 additions & 4 deletions locale/zh_Hant/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ msgstr "圖像小說"

#: catalog/book/models.py:122
msgid "Web Fiction"
msgstr "網絡小說"
msgstr "網絡作品"

#: catalog/book/models.py:123 catalog/game/models.py:31
msgid "Other"
Expand All @@ -88,10 +88,8 @@ msgid "translator"
msgstr "譯者"

#: catalog/book/models.py:186 catalog/templates/edition.html:27
#, fuzzy
#| msgid "books to read"
msgid "book format"
msgstr "想讀的書"
msgstr "格式"

#: catalog/book/models.py:193 catalog/templates/edition.html:33
msgid "publishing house"
Expand Down
7 changes: 6 additions & 1 deletion mastodon/models/mastodon.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ def _get_scopes(server_version: str) -> str:
)


def _force_recreate_app(server_version):
return re.match(r".+(Sharkey|Firefish).+", server_version or "")


def create_app(domain_name, server_version):
url = "https://" + domain_name + API_CREATE_APP
payload = {
Expand Down Expand Up @@ -442,7 +446,8 @@ def get_or_create_fediverse_application(login_domain):
if not app:
app = MastodonApplication.objects.filter(api_domain__iexact=domain).first()
if app:
if " Firefish " in app.server_version:
if _force_recreate_app(app.server_version):
logger.warning(f"Force recreate app for {login_domain}")
data = create_app(app.api_domain, app.server_version).json()
app.app_id = data["id"]
app.client_id = data["client_id"]
Expand Down