Commit graph

8225 commits

Author SHA1 Message Date
Christof Dorner bc0b291d36 Show notification banner on top of form when book failed to update 2023-03-07 21:58:12 +01:00
Wesley Aptekar-Cassels 26e34ddffa Add env vars for celery concurrency and time limit 2023-03-07 13:52:02 -05:00
Wesley Aptekar-Cassels abb5dc857e Use more portable shebang for dev scripts
/bin/bash, while common, is not part of the unix standard, and does not
exist on some operating systems (such as NixOS). /usr/bin/env, on the
other hand, is standardized, and thus should exist on all systems.
2023-03-07 13:39:18 -05:00
Wesley Aptekar-Cassels 43ad3d0c15 Improve polling algorithm
The existing polling code had a few problems:

* It started the timer for a new request when the first request was
  sent, rather than when a response was received.
* It increased the delay regardless of whether the response was a
  success or a failure.

This commit changes it to a more standard exponential backoff system,
where it starts with a 5 minute ± 30 second delay, and uses that same
delay until it hits an error, at which point the delay is increased by
10%. Once it receives a successful response again, the delay is reset to
the default.

I suspect this should be nicer on the server, since it avoids the
initial sending of many requests. After about half an hour of leaving
the page open, the request rate for this new code will be higher than
that of the old code, so it's possible that this may cause problems, but
I think that a five-minute request frequency should be pretty reasonable.
2023-03-07 13:15:52 -05:00
Mouse Reeve 05a303ea18
Merge pull request #2690 from bookwyrm-social/link-domain-notifications
Create notifications for link domains that need approval
2023-03-07 08:43:14 -08:00
Mouse Reeve 1612217eaa
Merge pull request #2696 from bookwyrm-social/chronological-pagination
Only use chronological pagination sometimes
2023-03-07 08:42:43 -08:00
Christof Dorner 9ca9883e0b Enable finding existing hashtags case-insensitive
We should store hashtags case-sensitive, but ensures that an existing
hashtag with different case are found and re-used. for example,
an existing #BookWyrm hashtag will be found and used even if the
status content is using #bookwyrm.
2023-03-07 13:16:45 +01:00
Christof Dorner f3334b1550 Render hashtag links with data-mention="hashtag" attribute 2023-03-07 13:16:45 +01:00
Christof Dorner 276b255f32 Post-process status.content field to change hashtag URLs
Since the status content already contains rendered HTML when we receive an
ActivityPub inbox message it contains links to the mentioned hashtags on the
originating instance.

To fix this on the receiving instance we need to post-process the status content
after successfully storing the status and its many-to-many fields (the one we're
is the `mention_hashtags`). Post-processing means that we run a regex against the
content to find the anchor tags linking to the originating hashtag and replace the
`href` attribute with the URL to the hashtag page on the receiving (local) instance.
2023-03-07 13:16:45 +01:00
Christof Dorner 0fd49d2aea Mark Hashtag.name field as deduplication field
This ensures that when an existing hashtag comes in through ActivityPub federation,
it correctly finds the local one, instead of creating duplicate hashtags.
2023-03-07 13:11:27 +01:00
Christof Dorner e8a306437f Reorder migrations to add hashtag one at the end 2023-03-07 13:11:27 +01:00
Christof Dorner 824d4207dc Try and fix a flaky test
Same case as with #2496, for some reason the URL to the cover just ends with `test.jpg`
2023-03-07 12:59:32 +01:00
Christof Dorner 499aace9fb Add basic view listing activities from a given hashtag 2023-03-07 12:59:32 +01:00
Christof Dorner 11640f986e Import hashtags from activitypub statuses 2023-03-07 12:59:31 +01:00
Christof Dorner ba0fcccfc5 Link hashtags in status content 2023-03-07 12:55:36 +01:00
Christof Dorner c68304a99b Parse hashtags and store them in CreateStatus view 2023-03-07 12:55:36 +01:00
Mouse Reeve c402433587
Merge pull request #2683 from bookwyrm-social/resolve-local-tasks-synchronously
Attempt to complete inbox requests synchronously
2023-03-06 19:20:16 -08:00
Chris Moultrie f8e60f4a89
Enable Azure BlobStorage as an alternative to AWS S3
This adds a new storage backend for Azure BlobStorage, I'm running this patch in Azure Kubernetes
hosting all my assets in Azure BlobStorage and it's been stable enough I thought I should commit
this back upstream.
2023-03-05 12:08:16 -05:00
André Jaenisch 9c92ba1698
Add attributes to images to hint async load
This was suggested on Matrix a while ago but I only found the time now to move forward with it.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
2023-03-01 14:14:42 +01:00
Hugh Rundle 66ce298001
Merge pull request #2657 from chris-y/totp-window
Expand TOTP validity window

This changes the default window to allow 2 codes (60 seconds) on either side. Admins can change this by setting a different `TWO_FACTOR_LOGIN_VALIDITY_WINDOW` value in `.env`
2023-02-27 18:46:53 +11:00
Hugh Rundle bba0d09fa4
Merge branch 'main' into totp-window 2023-02-27 18:21:39 +11:00
Hugh Rundle 3a67727a9a
Merge pull request #2638 from Giebisch/page-range
Page Range
2023-02-27 17:39:42 +11:00
Christof Dorner d1110630db Use chronological pagination on user profile activity lists 2023-02-26 11:24:00 +01:00
Mouse Reeve 99fc2b7a36 Only use chronological pagination sometimes
The timeline uses chronological buttons, but other paginated pages do
not (by default). This also reversed the chronology.
2023-02-25 15:56:58 -08:00
Christof Dorner 233cf809dd
Merge pull request #2694 from kangangi/replace_next_previous
Replace Next and Previous with Older and Newer
2023-02-25 22:34:05 +01:00
wanjiku b4e388a975 Replace Next and Previous with Older and Newer 2023-02-24 11:11:55 +03:00
Giebisch 43fe433133 Quotation same start and endposition 2023-02-23 18:40:20 +01:00
Mouse Reeve 268946a77c Adds missing template and migration files 2023-02-22 10:46:01 -08:00
Mouse Reeve 2470a0fd1c Create notifications for link domains that need approval 2023-02-22 10:20:07 -08:00
Mouse Reeve e59b650ff9
Merge pull request #2689 from bookwyrm-social/discover-page-test
Improves discover page test so it catches errors
2023-02-22 09:39:15 -08:00
Mouse Reeve 46fe65c3bb
Merge branch 'main' into discover-page-test 2023-02-22 09:19:20 -08:00
Mouse Reeve fad8e8bdb8
Merge pull request #2687 from chdorner/configurable-csp
Add config variable for additional CSP hosts
2023-02-22 08:57:56 -08:00
Mouse Reeve d57ebe43af
Merge pull request #2688 from 0x29a/fix-discovery-page
fix: missing expand variable
2023-02-22 08:53:36 -08:00
Mouse Reeve 0a07607240 Improves discover page test so it catches errors
Without `select_subclasses` in the mock, it wasn't actually collecting
any statuses to display, so errors on that view weren't caught in this
test.
2023-02-22 08:43:13 -08:00
0x29a 9b94c1c288 fix: missing expand variable 2023-02-22 17:25:11 +01:00
Mouse Reeve d2e590a3c2
Merge pull request #2685 from bookwyrm-social/broadcast-queue
Use a separate queue for broadcasts
2023-02-22 08:20:33 -08:00
Christof Dorner 3814cb5b58 Add config variable for additional CSP hosts 2023-02-21 22:02:52 +01:00
Christof Dorner 5df0ead776
Merge pull request #1753 from nycterent/security/key-size
increasing rsa key size
2023-02-20 22:37:02 +01:00
Mouse Reeve b167364c5c Use a separate queue for broadcasts
I think this will go a long way to solve the federation delay problems
we're seeing on b.s. I'm not sure at what point adding more queues will
create more problems than it solves, but I do think in this case the
queues are out of balance and moving broadcasts (which are the most
common type of `medium_priority` task at the moment) to their own queue
will be an improvement.
2023-02-20 12:58:41 -08:00
Martynas Sklizmantas 2093c4760b increasing rsa key size 2023-02-20 21:51:50 +01:00
Mouse Reeve 216be2aeea Fixes pylint complaints
"fixes" as in silences, sorry
2023-02-20 12:24:53 -08:00
Mouse Reeve 12ed0f46f3 Fixes mocks for tests 2023-02-20 12:23:18 -08:00
Mouse Reeve 0211dee0ff Avoid unnecessary errors when a remote re-sends an Accept 2023-02-20 11:09:42 -08:00
Mouse Reeve 779d2b0694 Attempt to complete inbox requests synchronously
When an inbox activity comes in from another fediverse instance, the
behavior prior to this commit was always to immediately give a 200
response to the external server and then create a celery activity
(usually in the MEDIUM_PRIORITY queue) to complete it.

Instead, this would receive a request and try to complete it without
making any http requests (which would make the request take too long to
process). If an external request is required to complete the activity, a
task is created and added to the queue.

Ideally, this will cause some tasks to happen very promptly, and reduce
the load on celery, which would help queued tasks happen more quickly as
well.

One downside is that this will make completing http requests from
external servers slowing (since it's doing a bunch of thinking before
responding).
2023-02-20 11:05:18 -08:00
Mouse Reeve db207065ce Update version number 2023-02-20 09:15:38 -08:00
Christof Dorner 4b3849e4e0
Merge pull request #2681 from chdorner/fix/sitesettings-ondelete 2023-02-18 20:24:41 +01:00
Christof Dorner dc5b797796 Fix SiteSettings.default_user_auth_group FK on_delete value
The migration uses `RESTRICT` instead of `PROTECT`, which is both more
correct, but also those values need to be identical, otherwise Django
thinks that there's a migration missing and will refuse to apply any
new migrations.
2023-02-18 19:33:25 +01:00
Chris Young d123cc6b0c Add default values if not in .env 2023-02-17 11:36:21 +00:00
Chris Young 9460553086 Read TOTP variables from .env 2023-02-17 09:40:31 +00:00
Hugh Rundle 702c79496b
Merge pull request #2652 from chdorner/fix/status-get-no-trim
Always expand content status on single status view
2023-02-17 15:18:05 +11:00