Skip to content

Commit

Permalink
Fix federation of Follow request
Browse files Browse the repository at this point in the history
Fix cache and add psycopg[binary] to requirements.txt

Signed-off-by: ziadhany <ziadhany2016@gmail.com>
  • Loading branch information
ziadhany committed Nov 14, 2023
1 parent cf9a99c commit 47bb7f5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions purl_sync/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ tzlocal==5.0.1
unidiff==0.7.5
urllib3==2.0.3
wrapt==1.15.0
psycopg[binary]==3.1.12
8 changes: 4 additions & 4 deletions purl_sync/review/tests/docker-compose-dev-test-federation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,29 @@ services:

purl_sync1:
build: ../../
command: /bin/sh -c "apt-get update && pip install psycopg2 --force-reinstall --no-cache-dir && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
command: /bin/sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8001"
env_file:
- docker-compose-dev-test-federation1.env
volumes:
- /etc/purl_sync1/:/etc/purl_sync1/
expose:
- 8000
ports:
- "8000:8000"
- "8001:8001"
depends_on:
- db1

purl_sync2:
build: ../../
command: /bin/sh -c "apt-get update && pip install psycopg2 --force-reinstall --no-cache-dir && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
command: /bin/sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8002"
env_file:
- docker-compose-dev-test-federation2.env
volumes:
- /etc/purl_sync2/:/etc/purl_sync2/
expose:
- 8000
ports:
- "8001:8000"
- "8002:8002"
depends_on:
- db2

Expand Down
2 changes: 1 addition & 1 deletion purl_sync/review/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def ap_collection(objects):
def webfinger_actor(domain, user):
""" """
acct = generate_webfinger(user, domain)
url = f"https://{domain}/.well-known/webfinger?resource=acct:{acct}"
url = f"http://{domain}/.well-known/webfinger?resource=acct:{acct}" # TODO http -> https
headers = {"User-Agent": ""} # TODO
try:
response = requests.get(url, headers=headers)
Expand Down
2 changes: 1 addition & 1 deletion purl_sync/review/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def post(self, request, *args, **kwargs):
form = SubscribePurlForm(request.POST)
if form.is_valid():
user, domain = parse_webfinger(form.cleaned_data.get("acct"))
remote_actor_url = webfinger_actor(user, domain)
remote_actor_url = webfinger_actor(domain, user)

payload = json.dumps(
{
Expand Down

0 comments on commit 47bb7f5

Please sign in to comment.