mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 09:31:08 +00:00
Support http:// protocol in BookWyrm connector
This commit is contained in:
parent
c42db40a63
commit
609bc15406
1 changed files with 6 additions and 4 deletions
|
@ -122,16 +122,18 @@ def get_or_create_connector(remote_id: str) -> abstract_connector.AbstractConnec
|
||||||
if not identifier:
|
if not identifier:
|
||||||
raise ValueError(f"Invalid remote id: {remote_id}")
|
raise ValueError(f"Invalid remote id: {remote_id}")
|
||||||
|
|
||||||
|
base_url = f"{url.scheme}://{url.netloc}"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connector_info = models.Connector.objects.get(identifier=identifier)
|
connector_info = models.Connector.objects.get(identifier=identifier)
|
||||||
except models.Connector.DoesNotExist:
|
except models.Connector.DoesNotExist:
|
||||||
connector_info = models.Connector.objects.create(
|
connector_info = models.Connector.objects.create(
|
||||||
identifier=identifier,
|
identifier=identifier,
|
||||||
connector_file="bookwyrm_connector",
|
connector_file="bookwyrm_connector",
|
||||||
base_url=f"https://{identifier}",
|
base_url=base_url,
|
||||||
books_url=f"https://{identifier}/book",
|
books_url=f"{base_url}/book",
|
||||||
covers_url=f"https://{identifier}/images/covers",
|
covers_url=f"{base_url}/images/covers",
|
||||||
search_url=f"https://{identifier}/search?q=",
|
search_url=f"{base_url}/search?q=",
|
||||||
priority=2,
|
priority=2,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue