diff --git a/standalone_user_client.py b/standalone_user_client.py
index b751d4a..ba77678 100644
--- a/standalone_user_client.py
+++ b/standalone_user_client.py
@@ -143,6 +143,11 @@ def get_data():
return handle_request_get(request.args['request_name'], request.args['request_type'], requestData)
+@api.route('/api/v1/user_client/set', methods=['GET'])
+def set_data():
+ if 'request_type' not in request.args:
+ return flask.make_response('{\"text\":"Argument \'request_type\' not in request"}', 400)
+
if __name__ == "__main__":
init()
diff --git a/user_client/v1/index.html b/user_client/v1/index.html
index 8ab21ef..c1c29d2 100644
--- a/user_client/v1/index.html
+++ b/user_client/v1/index.html
@@ -101,21 +101,14 @@
-
-
-
Command Name:
-
-
-
-
-
-
-
+
+
+
@@ -125,12 +118,12 @@
Rewards:
-
@@ -243,63 +236,62 @@
Services:
-
-
-
-
-
Commands
-
Enable
+
-
-
-
-
diff --git a/user_client/v1/settings.html b/user_client/v1/settings.html
deleted file mode 100644
index e69de29..0000000
diff --git a/user_client/v1/webclient.js b/user_client/v1/webclient.js
index ea29e75..97695a5 100644
--- a/user_client/v1/webclient.js
+++ b/user_client/v1/webclient.js
@@ -17,6 +17,20 @@ async function BotStatus() {
BotStatus();
+async function setValue(request_type, command, isEnabled) {
+ let newCommandState = {
+ 'request_type': request_type,
+ 'command_name': command,
+ 'is_enabled': isEnabled
+ }
+ let params = "?command_name="+encodeURIComponent(newCommandState.command_name)+"&"+"is_enabled="+encodeURIComponent(newCommandState.is_enabled);
+ let targetURL = "http://127.0.0.1:42055/api/v1/user_client/set"+params;
+ //console.log(targetURL)
+ let a = await fetch_GetList(targetURL);
+ //console.log("return: "+a);
+ updateCommandList();
+}
+
fetch_GetList = (fetchURL) => response = fetch(fetchURL)
.then((response) => {
return response.text();
@@ -45,11 +59,11 @@ GetList = async (listType) => {
async function GetListCommands() {
let returnedList = await GetList("Commands");
let obj_main = JSON.parse(returnedList);
- console.log(returnedList);
- console.log(obj_main);
- console.log(typeof obj_main['message'])
+ //console.log(returnedList);
+ //console.log(obj_main);
+ //console.log(typeof obj_main['message'])
- console.log(obj_main.message);
+ //console.log(obj_main.message);
//var obj_temp = JSON.parse(obj_main.message['!lights']);
let data = atob(obj_main.message);
@@ -59,8 +73,29 @@ async function GetListCommands() {
return notDictionary
}
-function updateCommandList() {
- let returnedCommands = GetListCommands();
+async function updateCommandList() {
+ $("#CommandRowWrapper").empty();
+ let returnedCommands = await GetListCommands();
+ for (x in returnedCommands){
+ //console.log(x)
+ var commandName = returnedCommands[x].command
+ var isCommandEnabled = ""
+ if (returnedCommands[x].isCommandEnabled == "true") {
+ isCommandEnabled = "checked"
+ }
+ var commandTemplate = ""+
+ "
"
+ $("#CommandRowWrapper").append(commandTemplate);
+ }
+ //var commandName = "!testerino"
+ //var isCommandEnabled = "" // if == "checked" will start off with the isEnabled bool enabled
+
}
updateCommandList();