1
0
Fork 0
Commit graph

1572 commits

Author SHA1 Message Date
b76da26c98 Fixes iteration over mentions dict 2023-03-29 10:13:44 -07:00
fe856bcf2c Updates regex on mentions and hashtags 2023-03-29 09:20:58 -07:00
8a0e88db83 Adds test for links with # symbols 2023-03-29 08:39:41 -07:00
42dd199084 Unit test that identifies clashes between links and mentions 2023-03-29 08:28:45 -07:00
30a3096b25
Merge pull request #2749 from bookwyrm-social/redirects
Add helper to refer views back to http referers safely
2023-03-27 06:20:26 -07:00
05e154f93e Uses referer redirect for some admin views 2023-03-20 13:58:20 -07:00
219f78755f Fixes args in list view redirect 2023-03-20 11:15:27 -07:00
4e9fad2091 Updates views that currently use the validator to use the redirect
helper
2023-03-20 10:27:52 -07:00
2de115fc1e Add helper to refer views back to http referers safely
In most cases, we want to return back to where we came from after
performing an action. It's not safe to return to an arbitrary referer,
so this streamlines using the util validator to verify the redirect and
fall back on regular redirect params if the referer is outside our
domain.
2023-03-20 10:25:38 -07:00
60fee54da9 Optimize CSV export query
Splitting this into five separate queries avoids the large join that
prevents us from using indexes, and requires materializing to disk.

Fixes: #2157 (hopefully)
2023-03-13 15:45:21 -04:00
0b9e4d617e Use context processor for 500 page
By default, Django doesn't run any context processors for server errors,
to make the error path as simple as possible. However, this has the
downside that our template does not load correctly. To fix this, I added
a custom 500 error handler, which will run the context processor.

Fixes: #2736
2023-03-13 03:47:23 -04:00
12af5992a3
Merge pull request #2524 from chdorner/feature/tag-support
Initial hashtag support
2023-03-12 16:37:39 -07:00
6345beb90d
Merge pull request #2714 from WesleyAC/celery-ignore-results
Ignore Celery task results
2023-03-12 16:26:20 -07:00
84b8a5c433
Merge pull request #2713 from WesleyAC/buffer-csv-export
Change CSV export to buffer instead of streaming
2023-03-12 16:17:53 -07:00
50a81bdfdd Change CSV export to buffer instead of streaming
The idea behind a streaming CSV export was to reduce the amount of
memory used, by avoiding building the entire CSV file in memory before
sending it to the client. However, it didn't work out this way in
practice: the query objects that were created to represent each line
caused Postgres to generate a very large (~200MB on bookwyrm.social)
temp file, not to mention the memory being used by the Query object
likely being similar to, if not larger than that used by the finalized
CSV row.

While we should in the long term run our CSV exports as a Celery task,
this change should allow CSV exports to work on large servers without
causing disk-space problems.

Fixes: #2157
2023-03-08 21:37:56 -05:00
4af4f30cde Broaden except section for HTTP request in dashboard
get_data can return exceptions other than ConnectorException, and when
it does, we want to simply not show the update section, rather than
crashing.

Related: #2717
2023-03-08 21:32:41 -05:00
9cbff312a5 Ignore Celery task results
Since we don't use the results of our Celery tasks (all of them return
None implicitly), it's prudent to set the ignore_result flag, for a
potential performance improvement. See the Celery docs for details [1].

We could do this with the global CELERY_IGNORE_RESULT setting, but it
offers more flexibility if we want to use task results in the future to
set it on a per-task basis.

[1]: https://docs.celeryq.dev/en/stable/userguide/tasks.html#ignore-results-you-don-t-want
2023-03-08 02:12:13 -05: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
499aace9fb Add basic view listing activities from a given hashtag 2023-03-07 12:59:32 +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
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
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
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
2c2daf5fdf
Merge pull request #2644 from rrgeorge/rrgeorge/csp
Add Content-Security-Policy headers and secure cookies
2023-02-10 16:37:39 -08:00
Dustin Steiner
d1f85e4317 fix: books can have non-decimal series numbers 2023-02-07 12:05:20 +00:00
Dustin
b20b52af7f
Merge branch 'main' into book-series-v1 2023-02-07 11:57:39 +00:00
Robert George
b82231202c lint 2023-02-03 12:03:52 -08:00
Robert George
afe651cd6d Added img-src * csp exception to search 2023-02-03 11:53:41 -08:00
Christof Dorner
f9a916db09
Merge pull request #2639 from bookwyrm-social/celery-ping
Celery ping
2023-02-03 09:40:25 +01:00
fd59fea94e
Update bookwyrm/views/admin/celery_status.py
Co-authored-by: Christof Dorner <christof@chdorner.com>
2023-02-02 16:46:36 -08:00
Robert George
6b97702cc4 Fix long line 2023-02-01 13:19:57 -08:00
Robert George
36605efd20 Added support for secure cookies and django-csp 2023-02-01 12:59:10 -08:00
Dustin Steiner
90f996ac90
chore: multi line comment for linter 2023-01-31 10:16:44 +00:00
Dustin Steiner
c2a81d88bb
Merge branch 'main' into book-series-v1 2023-01-31 10:06:07 +00:00
006ff697b9
Merge pull request #2636 from 0x29a/redundant-db-queries
Remove redundant DB queries
2023-01-30 09:03:18 -08:00
c1090703e2 Adds a ping-able celery url
This will let admins set up a check to notify you if celery is not
running.
2023-01-30 08:27:40 -08:00
Dustin Steiner
e0505722e1
chore: formatting 2023-01-30 14:45:30 +00:00
0x29a
3c52426a1c Optimize get_suggested_books 2023-01-30 06:45:44 +01:00
Dustin Steiner
0628ccad41
chore: sort editions with series number before edition rank 2023-01-29 11:43:56 +00:00
Dustin
c0e541c7ed
Merge branch 'main' into admin-manually-activate-user 2023-01-29 11:21:31 +00:00
Dustin
23e04c2e62
Merge branch 'main' into book-series-v1 2023-01-29 09:36:52 +00:00
Dustin Steiner
4b64b70753
fix: sort series by float 2023-01-29 09:35:02 +00:00
Dustin Steiner
f2902e8de5
fix: sort series number as int 2023-01-28 08:38:57 +00:00
Dustin Steiner
952dd0dcdf
style: fix unused parameter linter error 2023-01-28 08:31:41 +00:00
0x29a
cbd75dc766 Minor performance improvements 2023-01-27 20:24:53 +01:00
Dustin Steiner
54aea0654a
style: run linter 2023-01-27 15:47:22 +00:00
Dustin Steiner
07f4300176
feat: button in admin view to manually activate pending user 2023-01-27 15:43:34 +00:00
Dustin Steiner
ba2ff7e7a5
Merge branch 'main' into book-series-v1 2023-01-26 16:40:32 +00:00