diff --git a/standalone_user_client.py b/standalone_user_client.py index 879413e..aa2a038 100644 --- a/standalone_user_client.py +++ b/standalone_user_client.py @@ -34,8 +34,8 @@ api.config["DEBUG"] = True def init(): print("starting up... ",) -def handle_request_get(requestName): - return flask.make_response('Handled', 200) +def handle_request_get(requestName, requestType): + return flask.make_response("{\"message\":Handled}", 200, {"Content-Type": "application/json"}) def handle_request_set(requestName, requestType, requestData): pass @@ -56,8 +56,10 @@ def get_data(): return response if 'request_name' not in request.args: return flask.make_response('{\"text\":"Argument \'request_name\' not in request"}', 400) + if 'request_type' not in request.args: + return flask.make_response('{\"text\":"Argument \'request_type\' not in request"}', 400) - return handle_request_get(request.args['request_name']) + return handle_request_get(request.args['request_name'], request.args['request_type']) if __name__ == "__main__": diff --git a/user_client/v1/index.html b/user_client/v1/index.html index d0dcebd..feadd1c 100644 --- a/user_client/v1/index.html +++ b/user_client/v1/index.html @@ -27,7 +27,7 @@

Settings

About

-

Bot Status: ??

+

Bot Status: ??

diff --git a/user_client/v1/webclient.js b/user_client/v1/webclient.js index 4f03653..6d6db5a 100644 --- a/user_client/v1/webclient.js +++ b/user_client/v1/webclient.js @@ -6,15 +6,41 @@ refresh = () => response = fetch('http://127.0.0.1:5500/') ConnectionTest = async () => { var a = await refresh(); - //delete(response) console.log(a) - document.getElementById("BotStatus").innerHTML = a; return a } -async function myFunction() { +async function BotStatus() { var connectionStatus = await ConnectionTest(); document.getElementById("BotStatus").innerHTML = connectionStatus; } +BotStatus(); -myFunction(); \ No newline at end of file + +fetch_GetList = (fetchURL) => response = fetch(fetchURL) +.then((response) => { + return response.text(); +}) + +GetList = async (listType) => { + if (listType == "Chyron") { + encodedString = encodeURIComponent({ + 'request_name': "Chyron", + 'request_type': "list" + }) + targetURL = 'http://127.0.0.1:5500/api/v1/user_client/get?' + encodedString + var a = await fetch_GetList(targetURL); + console.log(a); + return a + } + else { + return None + } +} + +async function GetListChyron() { + var returnedList = await GetList("Chyron"); + +} + +GetListChyron();