kopia lustrzana https://github.com/snarfed/bridgy-fed
make verification accept fed.brid.gy redirects when running locally
rodzic
65f3ef3cc7
commit
30d9f7c9a5
|
@ -95,9 +95,11 @@ class User(StringIdModel):
|
||||||
try:
|
try:
|
||||||
resp = common.requests_get(urllib.parse.urljoin(site, path),
|
resp = common.requests_get(urllib.parse.urljoin(site, path),
|
||||||
allow_redirects=False, gateway=False)
|
allow_redirects=False, gateway=False)
|
||||||
expected = urllib.parse.urljoin(request.host_url, path)
|
domain_urls = ([f'https://{domain}/' for domain in common.DOMAINS] +
|
||||||
|
[request.host_url])
|
||||||
|
expected = [urllib.parse.urljoin(url, path) for url in domain_urls]
|
||||||
self.has_redirects = (resp.is_redirect and
|
self.has_redirects = (resp.is_redirect and
|
||||||
resp.headers.get('Location') == expected)
|
resp.headers.get('Location') in expected)
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
self.has_redirects = False
|
self.has_redirects = False
|
||||||
|
|
||||||
|
|
4
pages.py
4
pages.py
|
@ -2,6 +2,7 @@
|
||||||
import calendar
|
import calendar
|
||||||
import datetime
|
import datetime
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
|
@ -19,6 +20,8 @@ from models import Follower, User, Activity
|
||||||
PAGE_SIZE = 20
|
PAGE_SIZE = 20
|
||||||
FOLLOWERS_UI_LIMIT = 999
|
FOLLOWERS_UI_LIMIT = 999
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@flask_util.cached(cache, datetime.timedelta(days=1))
|
@flask_util.cached(cache, datetime.timedelta(days=1))
|
||||||
|
@ -54,6 +57,7 @@ def check_web_site():
|
||||||
if util.is_connection_failure(e):
|
if util.is_connection_failure(e):
|
||||||
flash(f"Couldn't connect to {url}")
|
flash(f"Couldn't connect to {url}")
|
||||||
return render_template('enter_web_site.html')
|
return render_template('enter_web_site.html')
|
||||||
|
raise
|
||||||
|
|
||||||
user.put()
|
user.put()
|
||||||
return redirect(f'/user/{domain}')
|
return redirect(f'/user/{domain}')
|
||||||
|
|
Ładowanie…
Reference in New Issue