improvements

This commit is contained in:
KF7EEL 2021-04-21 16:10:52 -07:00
parent 0719db4e77
commit 1ce6c26d84
2 changed files with 52 additions and 46 deletions

View File

@ -2280,4 +2280,6 @@ if __name__ == '__main__':
else: else:
threading.Thread(target=aprs_rx, args=(aprs_callsign, aprs_passcode, aprs_server, aprs_port, aprs_filter, user_ssid,)).start() threading.Thread(target=aprs_rx, args=(aprs_callsign, aprs_passcode, aprs_server, aprs_port, aprs_filter, user_ssid,)).start()
#logger.info(UNIT_MAP) #logger.info(UNIT_MAP)
#global authorized_users, other_systems
#from .scripts.dashboard.authorized_apps import authorized_users, other_systems
reactor.run() reactor.run()

View File

@ -721,13 +721,17 @@ def mail_rss():
""" """
return Response(rss_header + post_data + "\n</channel>\n</rss>", mimetype='text/xml') return Response(rss_header + post_data + "\n</channel>\n</rss>", mimetype='text/xml')
@app.route('/api/<api_mode>', methods=['POST']) @app.route('/api/<api_mode>', methods=['POST', 'GET'])
def api(api_mode=None): def api(api_mode=None):
if request.method == 'GET':
print('get')
return render_template('generic.html', title = dashboard_title, content = Markup(api_content))
else:
api_data = request.json api_data = request.json
# Find out type of JSON # Find out type of JSON
#print(api_data) #print(api_data)
#print(authorized_users) #print(authorized_users)
## try: ## try:
# Filter msg_xfer # Filter msg_xfer
if api_data['mode'] == 'msg_xfer': if api_data['mode'] == 'msg_xfer':
# Handle authorization # Handle authorization
@ -771,9 +775,9 @@ def api(api_mode=None):
else: else:
message = jsonify(message='Mode not found') message = jsonify(message='Mode not found')
return make_response(message, 400) return make_response(message, 400)
## except Exception as e: ## except Exception as e:
## message = jsonify(message='Error:' + str(e)) ## message = jsonify(message='Error:' + str(e))
## return make_response(message, 400) ## return make_response(message, 400)
#################### Run App ############################ #################### Run App ############################
if __name__ == '__main__': if __name__ == '__main__':