|
@@ -33,7 +33,7 @@ def login(): # Verify the streamer using indieauth, to their owncast instance
|
|
|
global state_value
|
|
global state_value
|
|
|
state_value = code_verifier
|
|
state_value = code_verifier
|
|
|
owncast_url = current_app.config['OWNCAST_URL']
|
|
owncast_url = current_app.config['OWNCAST_URL']
|
|
|
- client_id = current_app.config['INDIEAUTH_CLIENT_ID']
|
|
|
|
|
|
|
+ client_id = current_app.config['ACCESS_ID']
|
|
|
redirect_url = f'{owncast_url}/api/auth/provider/indieauth?client_id={client_id}&redirect_uri={url_for("web_panels.auth_response", _external=True)}&response_type=code&code_challenge_method=S256&code_challenge={code_challenge}&state={code_verifier}'
|
|
redirect_url = f'{owncast_url}/api/auth/provider/indieauth?client_id={client_id}&redirect_uri={url_for("web_panels.auth_response", _external=True)}&response_type=code&code_challenge_method=S256&code_challenge={code_challenge}&state={code_verifier}'
|
|
|
return redirect(redirect_url)
|
|
return redirect(redirect_url)
|
|
|
|
|
|
|
@@ -46,13 +46,13 @@ def auth_response():
|
|
|
current_app.logger.info(f'CSRF code is valid.')
|
|
current_app.logger.info(f'CSRF code is valid.')
|
|
|
owncast_url = current_app.config['OWNCAST_URL']
|
|
owncast_url = current_app.config['OWNCAST_URL']
|
|
|
owncast_auth_url = f'{owncast_url}/api/auth/provider/indieauth'
|
|
owncast_auth_url = f'{owncast_url}/api/auth/provider/indieauth'
|
|
|
- client_id = current_app.config['INDIEAUTH_CLIENT_ID']
|
|
|
|
|
- client_secret = current_app.config['INDIEAUTH_CLIENT_SECRET']
|
|
|
|
|
|
|
+ access_id = current_app.config['ACCESS_ID']
|
|
|
|
|
+ access_token = current_app.config['ACCESS_TOKEN']
|
|
|
# https://owncast.online/api/latest/#tag/Auth
|
|
# https://owncast.online/api/latest/#tag/Auth
|
|
|
# https://aaronparecki.com/2021/04/13/26/indieauth
|
|
# https://aaronparecki.com/2021/04/13/26/indieauth
|
|
|
token_response = requests.post(owncast_auth_url, data={
|
|
token_response = requests.post(owncast_auth_url, data={
|
|
|
- 'client_id': client_id,
|
|
|
|
|
- 'client_secret': client_secret,
|
|
|
|
|
|
|
+ 'client_id': access_id,
|
|
|
|
|
+ 'client_secret': access_token,
|
|
|
'code': code,
|
|
'code': code,
|
|
|
'redirect_uri': url_for("web_panels.auth_response", _external=True),
|
|
'redirect_uri': url_for("web_panels.auth_response", _external=True),
|
|
|
'grant_type': 'authorization_code',
|
|
'grant_type': 'authorization_code',
|
|
@@ -93,8 +93,10 @@ def mgmt():
|
|
|
all_cats = current_app.config['ALL_CAT']
|
|
all_cats = current_app.config['ALL_CAT']
|
|
|
points_interval = current_app.config['POINTS_INTERVAL']
|
|
points_interval = current_app.config['POINTS_INTERVAL']
|
|
|
points_award = current_app.config['POINTS_AWARD']
|
|
points_award = current_app.config['POINTS_AWARD']
|
|
|
|
|
+ follow_points = current_app.config['FOLLOW_POINTS']
|
|
|
gunicorn_logging = current_app.config['GUNICORN']
|
|
gunicorn_logging = current_app.config['GUNICORN']
|
|
|
prefix = current_app.config['PREFIX']
|
|
prefix = current_app.config['PREFIX']
|
|
|
|
|
+ access_id = current_app.config['ACCESS_ID']
|
|
|
access_token = current_app.config['ACCESS_TOKEN']
|
|
access_token = current_app.config['ACCESS_TOKEN']
|
|
|
kofi_token = current_app.config['KOFI_TOKEN']
|
|
kofi_token = current_app.config['KOFI_TOKEN']
|
|
|
kofi_integration = current_app.config['KOFI_INTEGRATION']
|
|
kofi_integration = current_app.config['KOFI_INTEGRATION']
|
|
@@ -103,6 +105,7 @@ def mgmt():
|
|
|
announce_interval = current_app.config['ANNOUNCE_INTERVAL']
|
|
announce_interval = current_app.config['ANNOUNCE_INTERVAL']
|
|
|
announcements = current_app.config['ANNOUNCEMENTS']
|
|
announcements = current_app.config['ANNOUNCEMENTS']
|
|
|
settings_info = [
|
|
settings_info = [
|
|
|
|
|
+ access_id,
|
|
|
points_interval,
|
|
points_interval,
|
|
|
points_award,
|
|
points_award,
|
|
|
gunicorn_logging,
|
|
gunicorn_logging,
|
|
@@ -112,7 +115,8 @@ def mgmt():
|
|
|
kofi_token,
|
|
kofi_token,
|
|
|
kofi_integration,
|
|
kofi_integration,
|
|
|
announce_enable,
|
|
announce_enable,
|
|
|
- announce_interval
|
|
|
|
|
|
|
+ announce_interval,
|
|
|
|
|
+ follow_points
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
return render_template('mgmt.html',
|
|
return render_template('mgmt.html',
|
|
@@ -314,19 +318,23 @@ def settings():
|
|
|
points_award = int(request.form['points_award'])
|
|
points_award = int(request.form['points_award'])
|
|
|
gunicorn_logging = 'gunicorn_logging' in request.form
|
|
gunicorn_logging = 'gunicorn_logging' in request.form
|
|
|
prefix = request.form['prefix']
|
|
prefix = request.form['prefix']
|
|
|
|
|
+ access_id = request.form['access_id']
|
|
|
access_token = request.form['access_token']
|
|
access_token = request.form['access_token']
|
|
|
owncast_url = request.form['owncast_url']
|
|
owncast_url = request.form['owncast_url']
|
|
|
kofi_integration = 'kofi_integration' in request.form
|
|
kofi_integration = 'kofi_integration' in request.form
|
|
|
kofi_token = request.form['kofi_token']
|
|
kofi_token = request.form['kofi_token']
|
|
|
|
|
+ follow_points = request.form['follow_points']
|
|
|
config_dict = {
|
|
config_dict = {
|
|
|
'POINTS_INTERVAL': points_interval,
|
|
'POINTS_INTERVAL': points_interval,
|
|
|
'POINTS_AWARD': points_award,
|
|
'POINTS_AWARD': points_award,
|
|
|
'GUNICORN': gunicorn_logging,
|
|
'GUNICORN': gunicorn_logging,
|
|
|
'PREFIX': prefix,
|
|
'PREFIX': prefix,
|
|
|
|
|
+ 'ACCESS_ID': access_id,
|
|
|
'ACCESS_TOKEN': access_token,
|
|
'ACCESS_TOKEN': access_token,
|
|
|
'OWNCAST_URL': owncast_url,
|
|
'OWNCAST_URL': owncast_url,
|
|
|
'KOFI_TOKEN': kofi_token,
|
|
'KOFI_TOKEN': kofi_token,
|
|
|
- 'KOFI_INTEGRATION': kofi_integration
|
|
|
|
|
|
|
+ 'KOFI_INTEGRATION': kofi_integration,
|
|
|
|
|
+ 'FOLLOW_POINTS': follow_points
|
|
|
}
|
|
}
|
|
|
if save_config(config_dict): # Save new config.py
|
|
if save_config(config_dict): # Save new config.py
|
|
|
current_app.logger.info('Saved new config.')
|
|
current_app.logger.info('Saved new config.')
|
|
@@ -531,10 +539,10 @@ def rereadv():
|
|
|
@ocb.route('/mgmt/clearfulfilled', methods=['GET', 'POST'])
|
|
@ocb.route('/mgmt/clearfulfilled', methods=['GET', 'POST'])
|
|
|
def clearfulfilled():
|
|
def clearfulfilled():
|
|
|
clear_fulfilled_rewards()
|
|
clear_fulfilled_rewards()
|
|
|
- return redirect(url_for('web_panels.mgmt'))
|
|
|
|
|
|
|
+ return redirect(url_for('web_panels.mgmtqueue'))
|
|
|
|
|
|
|
|
|
|
|
|
|
@ocb.route('/mgmt/clearqueue', methods=['GET', 'POST'])
|
|
@ocb.route('/mgmt/clearqueue', methods=['GET', 'POST'])
|
|
|
def clear_queue():
|
|
def clear_queue():
|
|
|
clear_reward_queue()
|
|
clear_reward_queue()
|
|
|
- return redirect(url_for('web_panels.mgmt'))
|
|
|
|
|
|
|
+ return redirect(url_for('web_panels.mgmtqueue'))
|