store.agi 716 B

12345678910111213141516171819202122
  1. //AGI script for saving and getting data from system core database
  2. if (opr == "set"){
  3. if (typeof key !== 'undefined' && typeof value !== 'undefined'){
  4. if (!writeDBItem("Code Studio",USERNAME + "/" + key, value)){
  5. sendJSONResp(JSON.stringify({
  6. error: "Failed to write to database"
  7. }));
  8. }
  9. }
  10. }else if (opr == "get"){
  11. if (typeof key !== 'undefined'){
  12. var content = readDBItem("Code Studio",USERNAME + "/" + key);
  13. if (content == false){
  14. sendJSONResp(JSON.stringify({
  15. error: "Unable to read database"
  16. }));
  17. }else{
  18. sendJSONResp(JSON.stringify(content));
  19. }
  20. }
  21. }