Fixed oauth2 and backslash SDK issue

This commit is contained in:
frikky
2021-09-07 03:14:36 +02:00
parent e67d577205
commit 52ba4a9537
5 changed files with 45 additions and 18 deletions
+33 -11
View File
@@ -521,7 +521,7 @@ class AppBase:
print("[INFO] Multiplier length: %d" % len(param_multiplier))
#tmp = ""
for subparams in param_multiplier:
print(f"SUBPARAMS IN MULTI: {subparams}")
#print(f"SUBPARAMS IN MULTI: {subparams}")
try:
#tmp = await func(**subparams)
@@ -1129,6 +1129,7 @@ class AppBase:
return default_error
# Parses the INNER value and recurses until everything is done
# Looks for a way to use e.g. int() or number() as a value
def parse_wrapper(data):
try:
if "(" not in data or ")" not in data:
@@ -1177,7 +1178,7 @@ class AppBase:
c_parentheses = parse_nested_param(parse_string, 0)[0]
match_string = re.escape(c_parentheses)
custom_casting = re.findall(fr"({wrapper_group})\({match_string}", parse_string)
print("In ELSE: %s" % custom_casting)
# check if a wrapper was found
if len(custom_casting) != 0:
inner_result = parse_type(c_parentheses, custom_casting[0])
@@ -1189,6 +1190,7 @@ class AppBase:
else:
parse_string = inner_result
print("PARSE STRING: %s" % parse_string)
return parse_string, True
# Looks for parantheses to grab special cases within a string, e.g:
@@ -1203,16 +1205,28 @@ class AppBase:
if "(" not in data or ")" not in data:
return data
if isinstance(data, str) and len(data) > 4:
if (data[0] == "{" or data[0] == "[") and (data[len(data)-1] == "]" or data[len(data)-1] == "}"):
print("Skipping parser because use of {[ and ]}")
return data
newdata = []
newstring = ""
record = True
paranCnt = 0
charcnt = 0
for char in data:
if char == "(":
paranCnt += 1
if not record:
record = True
charskip = False
if charcnt > 0:
if data[charcnt-1] == " ":
charskip = True
if not charskip:
paranCnt += 1
if not record:
record = True
if record:
newstring += char
@@ -1227,6 +1241,8 @@ class AppBase:
if paranCnt == 0:
record = False
charcnt += 1
if len(newstring) > 0:
newdata.append(newstring)
@@ -1378,7 +1394,7 @@ class AppBase:
basejson = json.loads(basejson[value])
print("BASEJSON: %s" % basejson)
except json.decoder.JSONDecodeError as e:
print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
print("RETURNING BECAUSE '%s' IS A NORMAL STRING (0)" % basejson[value])
return basejson[value], False
else:
basejson = basejson[value]
@@ -1398,7 +1414,7 @@ class AppBase:
basejson = json.loads(basejson[value])
print("BASEJSON: %s" % basejson)
except json.decoder.JSONDecodeError as e:
print("RETURNING BECAUSE '%s' IS A NORMAL STRING" % basejson[value])
print("RETURNING BECAUSE '%s' IS A NORMAL STRING (1)" % basejson[value])
return basejson[value], False
else:
basejson = basejson[value]
@@ -2206,9 +2222,9 @@ class AppBase:
for i in range(len(json_replacement)):
if isinstance(json_replacement[i], dict) or isinstance(json_replacement[i], list):
tmp_replacer = json.dumps(json_replacement[i])
newvalue = tmpitem.replace(actualitem[index][0], tmp_replacer, 1)
newvalue = tmpitem.replace(str(actualitem[index][0]), str(tmp_replacer), 1)
else:
newvalue = tmpitem.replace(actualitem[index][0], json_replacement[i], 1)
newvalue = tmpitem.replace(str(actualitem[index][0]), str(json_replacement[i]), 1)
try:
newvalue = json.loads(newvalue)
@@ -2281,6 +2297,7 @@ class AppBase:
actualitem = replace[2]
if actualitem.endswith("}$"):
actualitem = actualitem[:-2]
except IndexError:
continue
@@ -2344,6 +2361,7 @@ class AppBase:
print("(2) JSON ERROR IN FILE HANDLING: %s" % e)
if not isfile:
tmpitem = tmpitem.replace("\\\\", "\\", -1)
resultarray.append(tmpitem)
# With this parameter ready, add it to... a greater list of parameters. Rofl
@@ -2397,7 +2415,11 @@ class AppBase:
else:
# Parses things like int(value)
print("Normal parsing (not looping)")#with data %s" % value)
# This part has fucked over so many random JSON usages because of weird paranthesis parsing
value = parse_wrapper_start(value)
print("Post return: %s" % value)
#if parameter["id"] == "body_replacement":
# print("Should run body replacement in index %d with %s" % (bodyindex, parameter))
@@ -2436,7 +2458,7 @@ class AppBase:
#remove_params.append(parameter["name"])
# Fix lists here
# FIXME: This doesn't really do anything anymore
print("CHECKING multi execution list!")
print("CHECKING multi execution list: %d!" % len(multi_execution_lists))
if len(multi_execution_lists) > 0:
print("\n Multi execution list has more data: %d" % len(multi_execution_lists))
filteredlist = []
+3 -1
View File
@@ -45,7 +45,9 @@ const AuthenticationOauth2 = (props) => {
console.log("EDIT SCOPE!")
}
const redirectUri = `http://${window.location.host}/set_authentication`
console.log(window.location)
//const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io"
const redirectUri = `${window.location.protocol}//${window.location.host}/set_authentication`
const state = `workflow_id%3D${workflow.id}%26reference_action_id%3d${selectedAction.app_id}%26app_name%3d${selectedAction.app_name}%26app_id%3d${selectedAction.app_id}%26app_version%3d${selectedAction.app_version}%26authentication_url%3d${authentication_url}%26scope%3d${resources}%26client_id%3d${client_id}%26client_secret%3d${client_secret}`
const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&state=${state}`
+3 -3
View File
@@ -1552,9 +1552,9 @@ const ParsedAction = (props) => {
<span>
<Button color="primary" style={{}} fullWidth variant="contained" onClick={() => {
console.log(authenticationType)
if (authenticationType.type === "oauth2" && authenticationType.redirect_uri !== undefined && authenticationType.redirect_uri !== null) {
return null
}
//if (authenticationType.type === "oauth2" && authenticationType.redirect_uri !== undefined && authenticationType.redirect_uri !== null) {
// return null
//}
setAuthenticationModalOpen(true)
}}>
+4 -1
View File
@@ -215,7 +215,7 @@ const LoginDialog = props => {
marginTop: 15,
}}>
<Typography variant="body2" style={{marginBottom: 20, color: "white",}}>
<b>Make sure Shuffle is <a href="https://github.com/frikky/Shuffle/blob/master/.github/install-guide.md" style={{textDecoration: "none", color: "#f86a3e"}}>installed correctly</a></b>
<b>Are you sure Shuffle is <a rel="norefferer" target="_blank" href="https://github.com/frikky/Shuffle/blob/master/.github/install-guide.md" style={{textDecoration: "none", color: "#f86a3e"}}>installed correctly</a></b>
</Typography>
<Typography variant="body2" style={{marginBottom: 20, color: "white",}}>
<b>1.</b> Make sure shuffle-database folder has correct access: <br/><br/>
@@ -227,6 +227,9 @@ const LoginDialog = props => {
sudo sysctl -w vm.max_map_count=262144
</Typography>
</Paper>
<Typography variant="body2" style={{marginBottom: 10, color: "white", marginTop: 20, }}>
Need help? <a rel="norefferer" target="_blank" href="https://discord.gg/B2CBzUm" style={{textDecoration: "none", color: "#f86a3e"}}>Join the Discord!</a>
</Typography>
</div>
:
<form onSubmit={onSubmit} style={{ margin: "15px 15px 15px 15px", color: "white", }}>
+2 -2
View File
@@ -186,7 +186,7 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
Type: "json-file",
Config: map[string]string{},
},
Resources: container.Resources{},
Resources: container.Resources{},
NetworkMode: container.NetworkMode(fmt.Sprintf("container:worker-%s", workflowExecution.ExecutionId)),
}
@@ -1107,7 +1107,7 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) {
if strings.Contains(buildBuf.String(), "errorDetail") {
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
log.Printf("[DEBUG] Shutting down (14)")
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
shutdown(workflowExecution, action.ID, fmt.Sprintf("Error deploying container: %s", buildBuf.String()), true)
}
log.Printf("[INFO] Successfully downloaded %s", image)