add instance hidelist
This commit is contained in:
parent
77bb52cb9e
commit
bbbb2470ed
|
@ -47,7 +47,23 @@ SENTRY
|
||||||
|
|
||||||
If you want to send exceptions to sentry, enter your sentry DSN here
|
If you want to send exceptions to sentry, enter your sentry DSN here
|
||||||
"""
|
"""
|
||||||
# SENTRY_DSN=
|
# SENTRY_DSN=''
|
||||||
|
|
||||||
|
"""
|
||||||
|
HIDDEN INSTANCES
|
||||||
|
|
||||||
|
The front page shows one-click login buttons for the mastodon and
|
||||||
|
misskey instances that see the most heavy use. Instances configured in this
|
||||||
|
list will be prevented from appearing in these buttons.
|
||||||
|
|
||||||
|
They will still appear if a user has previously logged into them and their
|
||||||
|
browser remembers it. A user will still be able to log into them by manually
|
||||||
|
typing the address into the log in form.
|
||||||
|
|
||||||
|
This is a space-delimited list. Example syntax:
|
||||||
|
HIDDEN_INSTANCES='social.example.com pleroma.example.net mk.example.org'
|
||||||
|
"""
|
||||||
|
# HIDDEN_INSTANCES=''
|
||||||
|
|
||||||
"""
|
"""
|
||||||
ADVANCED FLASK CONFIG
|
ADVANCED FLASK CONFIG
|
||||||
|
|
|
@ -37,8 +37,9 @@ def index():
|
||||||
|
|
||||||
@app.route('/about/')
|
@app.route('/about/')
|
||||||
def about():
|
def about():
|
||||||
mastodon_instances = libforget.mastodon.suggested_instances()
|
blocklist = app.config.get('HIDDEN_INSTANCES', '').split()
|
||||||
misskey_instances = libforget.misskey.suggested_instances()
|
mastodon_instances = libforget.mastodon.suggested_instances(blocklist=blocklist)
|
||||||
|
misskey_instances = libforget.misskey.suggested_instances(blocklist=blocklist)
|
||||||
return render_template(
|
return render_template(
|
||||||
'about.html',
|
'about.html',
|
||||||
mastodon_instances=mastodon_instances,
|
mastodon_instances=mastodon_instances,
|
||||||
|
@ -186,9 +187,11 @@ def mastodon_login_step1(instance=None):
|
||||||
or request.form.get('instance_url', None))
|
or request.form.get('instance_url', None))
|
||||||
|
|
||||||
if not instance_url:
|
if not instance_url:
|
||||||
|
blocklist = app.config.get('HIDDEN_INSTANCES', '').split()
|
||||||
instances = libforget.mastodon.suggested_instances(
|
instances = libforget.mastodon.suggested_instances(
|
||||||
limit=30,
|
limit=30,
|
||||||
min_popularity=1
|
min_popularity=1,
|
||||||
|
blocklist=blocklist,
|
||||||
)
|
)
|
||||||
return render_template(
|
return render_template(
|
||||||
'mastodon_login.html', instances=instances,
|
'mastodon_login.html', instances=instances,
|
||||||
|
@ -245,11 +248,13 @@ def mastodon_login_step2(instance_url):
|
||||||
def misskey_login(instance=None):
|
def misskey_login(instance=None):
|
||||||
instance_url = (request.args.get('instance_url', None)
|
instance_url = (request.args.get('instance_url', None)
|
||||||
or request.form.get('instance_url', None))
|
or request.form.get('instance_url', None))
|
||||||
|
|
||||||
if not instance_url:
|
if not instance_url:
|
||||||
|
blocklist = app.config.get('HIDDEN_INSTANCES', '').split()
|
||||||
instances = libforget.misskey.suggested_instances(
|
instances = libforget.misskey.suggested_instances(
|
||||||
limit = 30,
|
limit = 30,
|
||||||
min_popularity = 1
|
min_popularity = 1,
|
||||||
|
blocklist=blocklist,
|
||||||
)
|
)
|
||||||
return render_template(
|
return render_template(
|
||||||
'misskey_login.html', instances=instances,
|
'misskey_login.html', instances=instances,
|
||||||
|
@ -258,7 +263,7 @@ def misskey_login(instance=None):
|
||||||
)
|
)
|
||||||
|
|
||||||
instance_url = domain_from_url(instance_url)
|
instance_url = domain_from_url(instance_url)
|
||||||
|
|
||||||
callback = url_for('misskey_callback',
|
callback = url_for('misskey_callback',
|
||||||
instance_url=instance_url, _external=True)
|
instance_url=instance_url, _external=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue