12345678910111213141516171819202122 |
- //AGI script for saving and getting data from system core database
- if (opr == "set"){
- if (typeof key !== 'undefined' && typeof value !== 'undefined'){
- if (!writeDBItem("Code Studio",USERNAME + "/" + key, value)){
- sendJSONResp(JSON.stringify({
- error: "Failed to write to database"
- }));
- }
- }
- }else if (opr == "get"){
- if (typeof key !== 'undefined'){
- var content = readDBItem("Code Studio",USERNAME + "/" + key);
- if (content == false){
- sendJSONResp(JSON.stringify({
- error: "Unable to read database"
- }));
- }else{
- sendJSONResp(JSON.stringify(content));
- }
-
- }
- }
|