Started looking at ways to parse invalid JSON patterns

This commit is contained in:
frikky
2022-02-16 20:14:52 +01:00
parent be31c329de
commit 8af27d2800
4 changed files with 430 additions and 395 deletions
+24 -1
View File
@@ -16,6 +16,7 @@ import urllib.parse
import jinja2 import jinja2
from io import BytesIO from io import BytesIO
from liquid import Liquid from liquid import Liquid
#import barely_json
runtime = os.getenv("SHUFFLE_SWARM_CONFIG", "") runtime = os.getenv("SHUFFLE_SWARM_CONFIG", "")
@@ -171,6 +172,7 @@ class AppBase:
# Try it with some magic # Try it with some magic
self.logger.info(f"""[DEBUG] Inside Send result with status {action_result["status"]}""") self.logger.info(f"""[DEBUG] Inside Send result with status {action_result["status"]}""")
#if isinstance(action_result,
# FIXME: Add cleanup of parameters to not send to frontend here # FIXME: Add cleanup of parameters to not send to frontend here
params = {} params = {}
@@ -1745,7 +1747,7 @@ class AppBase:
basejson = json.loads(baseresult) basejson = json.loads(baseresult)
except json.decoder.JSONDecodeError as e: except json.decoder.JSONDecodeError as e:
try: try:
baseresult = baseresult.replace("\'", "\"") #baseresult = baseresult.replace("\'", "\"")
basejson = json.loads(baseresult) basejson = json.loads(baseresult)
except json.decoder.JSONDecodeError as e: except json.decoder.JSONDecodeError as e:
print("Parser issue with JSON: %s" % e) print("Parser issue with JSON: %s" % e)
@@ -2333,6 +2335,27 @@ class AppBase:
return True, "" return True, ""
#
#
#
#
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
# CONT
#
#
#
#
# THE START IS ACTUALLY RIGHT HERE :O # THE START IS ACTUALLY RIGHT HERE :O
# Checks whether conditions are met, otherwise set # Checks whether conditions are met, otherwise set
+11
View File
@@ -5177,8 +5177,19 @@ func handleCloudSetup(resp http.ResponseWriter, request *http.Request) {
_, err = handleStopCloudSync(syncPath, *org) _, err = handleStopCloudSync(syncPath, *org)
if err != nil { if err != nil {
ret := shuffle.ResultChecker{
Success: false,
Reason: err,
}
resp.WriteHeader(401) resp.WriteHeader(401)
b, err := json.Marshal(requestData)
if err != nil {
resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err))) resp.Write([]byte(fmt.Sprintf(`{"success": false, "reason": "%s"}`, err)))
return
}
resp.Write([]byte(fmt.Sprintf(b)))
} else { } else {
resp.WriteHeader(200) resp.WriteHeader(200)
resp.Write([]byte(fmt.Sprintf(`{"success": true, "reason": "Successfully disabled cloud sync for org."}`))) resp.Write([]byte(fmt.Sprintf(`{"success": true, "reason": "Successfully disabled cloud sync for org."}`)))
+1 -1
View File
@@ -542,7 +542,7 @@ const ParsedAction = (props) => {
} }
} }
console.log("ACTIONLIST: ", actionlist) //console.log("ACTIONLIST: ", actionlist)
setActionlist(actionlist); setActionlist(actionlist);
} }
} }
+2 -1
View File
@@ -735,6 +735,7 @@ const AngularWorkflow = (defaultprops) => {
// Loop nodes and find results // Loop nodes and find results
// Update on every interval? idk // Update on every interval? idk
ReactDOM.unstable_batchedUpdates(() => {
if (JSON.stringify(responseJson) !== JSON.stringify(executionData)) { if (JSON.stringify(responseJson) !== JSON.stringify(executionData)) {
// FIXME: If another is selected, don't edit.. // FIXME: If another is selected, don't edit..
// Doesn't work because this is some async garbage // Doesn't work because this is some async garbage
@@ -929,6 +930,7 @@ const AngularWorkflow = (defaultprops) => {
getWorkflowExecution(props.match.params.key, ""); getWorkflowExecution(props.match.params.key, "");
setUpdate(Math.random()); setUpdate(Math.random());
} }
})
}; };
const sendStreamRequest = (body) => { const sendStreamRequest = (body) => {
@@ -1137,7 +1139,6 @@ const AngularWorkflow = (defaultprops) => {
maxHeight: 270, maxHeight: 270,
}) })
console.log("CY: ", cyImageData)
if (cyImageData !== undefined && cyImageData !== null && cyImageData.length > 0) { if (cyImageData !== undefined && cyImageData !== null && cyImageData.length > 0) {
useworkflow.image = cyImageData useworkflow.image = cyImageData
} }