This commit is contained in:
Alex Orid 2021-05-07 17:06:22 -04:00
parent d78e6bc7b4
commit e80db3449a
3 changed files with 36 additions and 8 deletions

View File

@ -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__":

View File

@ -27,7 +27,7 @@
<div class="headerItem"><p class="headerText">Settings</p></div>
<div class="headerItem"><p class="headerText">About</p></div>
</div>
<div style="position: absolute;right: 10;" onclick="myFunction()"><p id="BotStatus" class="card noselect" style="padding-left: 3px;padding-right: 3px;">Bot Status: ??</p></div>
<div style="position: absolute;right: 10;" onclick="BotStatus()"><p id="BotStatus" class="card noselect" style="padding-left: 3px;padding-right: 3px;">Bot Status: ??</p></div>
</div>
<!--<a class="btn-floating btn-large waves-effect waves-light red right hide-on-small-and-down" ><i class="material-icons">add</i></a>-->
</div>

View File

@ -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();
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();