Add server config file
This commit is contained in:
parent
f7b0c3df40
commit
6153aa1b2a
@ -22,13 +22,16 @@ import bleach
|
|||||||
import urllib
|
import urllib
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
#### Config variables ####
|
#### Config variables ####
|
||||||
##########################
|
##########################
|
||||||
NITTERINSTANCE = "https://nitter.net/" # Must be https://.../
|
config = json.load(open('yotter-config.json'))
|
||||||
|
##########################
|
||||||
|
#### Config variables ####
|
||||||
|
##########################
|
||||||
|
NITTERINSTANCE = config['nitterInstance'] # Must be https://.../
|
||||||
YOUTUBERSS = "https://www.youtube.com/feeds/videos.xml?channel_id="
|
YOUTUBERSS = "https://www.youtube.com/feeds/videos.xml?channel_id="
|
||||||
REGISTRATIONS = True
|
REGISTRATIONS = config['registrations']
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
#### Global variables ####
|
#### Global variables ####
|
||||||
@ -457,15 +460,21 @@ def allowed_file(filename):
|
|||||||
|
|
||||||
@app.route('/register', methods=['GET', 'POST'])
|
@app.route('/register', methods=['GET', 'POST'])
|
||||||
def register():
|
def register():
|
||||||
|
global REGISTRATIONS
|
||||||
|
count = db.session.query(User).count()
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
if count >= config['maxInstanceUsers']:
|
||||||
|
REGISTRATIONS = False
|
||||||
|
|
||||||
form = RegistrationForm()
|
form = RegistrationForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
if User.query.filter_by(username=form.username.data).first():
|
if User.query.filter_by(username=form.username.data).first():
|
||||||
flash("This username is taken! Try with another.")
|
flash("This username is taken! Try with another.")
|
||||||
return redirect(request.referrer)
|
return redirect(request.referrer)
|
||||||
|
|
||||||
|
|
||||||
user = User(username=form.username.data)
|
user = User(username=form.username.data)
|
||||||
user.set_password(form.password.data)
|
user.set_password(form.password.data)
|
||||||
db.session.add(user)
|
db.session.add(user)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div class="ui center aligned text container">
|
<div class="ui center aligned text container">
|
||||||
<div class="ui row">
|
<div class="ui row">
|
||||||
<img alt="Closed registrations image" class="ui image" src="{{ url_for('static',filename='img/closed.png') }}">
|
<img alt="Closed registrations image" class="ui centered medium image" src="{{ url_for('static',filename='img/closed.png') }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui row">
|
<div class="ui row">
|
||||||
|
6
yotter-config.json
Normal file
6
yotter-config.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"nitterInstance": "https://nitter.net/",
|
||||||
|
"registrations": true,
|
||||||
|
"maxInstanceUsers": 1,
|
||||||
|
"proxyAll": true
|
||||||
|
}
|
Reference in New Issue
Block a user