Commit graph

100 commits

Author SHA1 Message Date
Ell Bradshaw c9adb7ff12 Linting fixes 2022-11-14 01:04:20 -08:00
Ell Bradshaw b3603bc3f5 Merge branch 'main' into ignore-does-not-exist 2022-11-14 00:31:34 -08:00
Mouse Reeve 5c3bb2da13 Refactors how mentions are collected
This should be quicker, because it queries the users in one go instead
of jumping straight to iterating over them, and it checks if a user
blocks the poster before allowing them to be tagged.
2022-08-05 14:06:39 -07:00
Mouse Reeve 9d9b7f366a Use "strip" in bleach
This removes forbidden html, rather than leaving them in place but
unrendered.
2022-07-04 13:55:58 -07:00
Mouse Reeve 7f78140015 Uses library for html cleanup 2022-07-04 13:21:13 -07:00
Mouse Reeve 94a6675dc4 Pylint fixes 2022-07-02 12:07:22 -07:00
Joel Bradshaw 7014786fe0 Run formatters 2022-06-05 13:41:00 -07:00
Joel Bradshaw 7ae0db7f4a Ignore VariableDoesNotExist errors in debug logging
They're so noisy as to make debug logging useless otherwise
2022-05-30 12:15:50 -07:00
Vivianne Langdon b0d3eaeb40 allow empty slugs, for non-url-friendly book names 2022-04-08 22:11:05 -07:00
Vivianne Langdon ebf463fc91 Generation of slugs and new urls to handle slugs
- TODO: redirect to correct slug if not found.
2022-03-02 00:21:23 -08:00
Mouse Reeve 556c9ea98f Adjusts cache get_or_set to work with tests 2022-01-09 12:16:01 -08:00
Mouse Reeve f2f40cf3b9 Creates custom get_or_set function 2022-01-08 13:01:05 -08:00
Mouse Reeve a8ae427aeb Updates domain regex 2021-12-28 15:53:26 -08:00
Mouse Reeve 89c23c3e0c More thoroughly checking if title is set to avoid error 2021-12-05 09:07:17 -08:00
Hugh Rundle 8e6619294f
oclc server sure is slow 2021-12-01 21:02:25 +11:00
Hugh Rundle d8e83ffe82
moar code linting 2021-11-22 13:01:58 +11:00
Hugh Rundle a9d921cc06
code cleanup 2021-11-22 12:52:59 +11:00
Hugh Rundle 09c5a3861b
prefer English language sources for ISNI titles 2021-11-22 12:15:06 +11:00
Hugh Rundle fd3ed7fb8c
fix author is now class object not dict 2021-11-22 09:25:31 +11:00
Hugh Rundle fd2ade2313
refactor isni author enrichment
- use activitypub.Author instead of custom dict
- prefer to display "Author of [title]" from ISNI data instead of short description
- merge isni and db authors for edit_book display
- fix edit_book template to use changed data
- rename some functions in utils/isni.py
2021-11-22 08:49:22 +11:00
Hugh Rundle 1e6e4b0f8d
use activitypub dataclass for isni authors
- add timeout to isni API call
- use activitypub.Author dataclass instead of bespoke dict
- display isni authors as "Author of" first title in ISNI record if possible
- sensible fallbacks if title info unavailable in isni record
2021-11-21 19:55:55 +11:00
Hugh Rundle 8658e36ca8
code formatting 2021-11-16 20:40:22 +11:00
Hugh Rundle 9ca18d9cd4
isni utils cleanup
Utilises the requests module's built in functionality to pass params as a dict
which is url encoded by requests.
2021-11-16 20:35:47 +11:00
Hugh Rundle c3ba7ba547 pylint Y U like this? 2021-11-01 20:04:25 +11:00
Hugh Rundle 6556090524 Update existing authors when isni data available
When an existing author is selected as a new author when editing a book,
if they have an ISNI ID recorded we check the record and augment the local
database record from the ISNI data.

Also dedupes author aliases for this feature and when adding a completely
new author.
2021-11-01 19:50:49 +11:00
Hugh Rundle 1533b55a32 lint code 2021-11-01 11:58:08 +11:00
Hugh Rundle 630f508ee4 code cleanup 2021-11-01 11:39:37 +11:00
Hugh Rundle 552980e208 select correct isni record when adding authors
The original implementation of this was so, so broken.
Now it's not.
2021-11-01 11:34:32 +11:00
Hugh Rundle 30a959dfce make pylint happy 2021-11-01 10:20:19 +11:00
Hugh Rundle 3cfd31f1fe hide isni authors if isni in local db
Check the authors suggested from the local DB for a matching ISNI when pulling authors from ISNI.
i.e. we do not want to suggest the same author twice when we *know* it is the same author.
2021-10-31 20:48:47 +11:00
Hugh Rundle bce5f3f3b5 populate new authors with isni data
If a user selects an author pulled from the ISNI service when editing a book, use any relevant data from ISNI to populate the new author record.

This includes
- bio
- aliases
- isni
- wikipedia url
- viaf
2021-10-31 17:58:15 +11:00
Hugh Rundle 45158a1c03 improve isni search logic
- skip ISNIs that aren't persons
- don't look for text values in non-existent nameTitle elements
2021-10-30 09:24:42 +11:00
Hugh Rundle 87ed6f8380 code formatting 2021-10-29 21:14:32 +11:00
Hugh Rundle d87e1b1567 fix encoding
The OCLC server claims that the xml payload is encoded as latin1 (ISO-8859-1).
This causes Requests to incorrectly encode things as latin1, when actually everything is (thank goodness) UTF-8.
We can fix it by just telling Requests that it is really UTF-8

With thanks to Tex Texin, creator of http://i18nqa.com/debug/utf8-debug.html
2021-10-29 21:00:35 +11:00
Hugh Rundle 625cfac76f isni author lookup utility 2021-10-29 16:12:31 +11:00
Mouse Reeve acfb1bb376 Updating string format synatx part 2 2021-09-18 11:32:00 -07:00
Mouse Reeve 9e5c7053e9 More pylint fixes 2021-06-18 14:29:24 -07:00
Mouse Reeve 381d160105 Fixes init file 2021-06-18 14:17:05 -07:00
Mouse Reeve 4479864008 Updates code for linter 2021-06-18 14:12:56 -07:00
Mouse Reeve 70296e760b Runs black 2021-03-08 08:49:10 -08:00
Mouse Reeve 54f27519df Fixes username regex 2021-01-06 16:01:13 -08:00
Mouse Reeve a25bc2383b Improves tagging regex 2021-01-06 09:45:36 -08:00
Renato "Lond" Cerqueira b389cfb013 Use user-agent to determine whether to show pure representation
Together with #434 and #435, this fixes #429. Use the user-agent to
determine if the call is coming from a BookWyrm instance or not. If it's
not, give a pure activitypub representation for the status. Otherwise,
give a BookWyrm one, to allow for a complete integration between
instances.
2021-01-03 14:24:03 +01:00
Mouse Reeve b3449040d9 Fixes server error posting status 2021-01-01 07:27:56 -08:00
Mouse Reeve dc68fdd53e User generated local paths 2020-12-30 17:36:35 -08:00
Mouse Reeve ae435a3165 Removes sqlite support 😢
RIP, things have gotten too complicated for this I think
2020-12-12 20:11:23 -08:00
Mouse Reeve cb28c19abc Use get_data in resolving remote id 2020-12-12 15:19:57 -08:00
Mouse Reeve 85a7e83340 Adds regex util file 2020-11-01 10:57:17 -08:00
Mouse Reeve 203a0a25eb Fixes webfinger 2020-11-01 10:49:28 -08:00
Mouse Reeve f77c156733 rename main code directory 2020-09-17 13:30:54 -07:00