@@ -29,6 +29,7 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
29
29
"User-Agent" : "Shuffle Userinput 1.1.0" ,
30
30
}
31
31
32
+
32
33
result = {
33
34
"success" : True ,
34
35
"source" : "userinput" ,
@@ -40,6 +41,11 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
40
41
"ip" : "" ,
41
42
"user" : "" ,
42
43
"note" : "" ,
44
+ },
45
+ "links" : {
46
+ "frontend_no_answer" : "" ,
47
+ "api_continue" : "" ,
48
+ "api_abort" : "" ,
43
49
}
44
50
}
45
51
@@ -50,26 +56,32 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
50
56
if len (str (backend_url )) > 0 :
51
57
url = backend_url
52
58
53
- print ("Found backend url: %s" % url )
54
- #print("AUTH: %s" % self.full_execution["authorization"])
55
- #if len(information):
56
- # print("Should run arg: %s", information)
59
+ frontend_url = url
60
+ if ":5001" in frontend_url :
61
+ print ("Should change port to 3001." )
62
+ if "appspot.com" in frontend_url :
63
+ frontend_url = "https://shuffler.io"
64
+ if "run.app" in frontend_url :
65
+ frontend_url = "https://shuffler.io"
66
+ if "ngrok" in frontend_url :
67
+ frontend_url = ""
68
+
69
+ explore_path = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&source_node=%s" % (frontend_url , self .full_execution ["workflow" ]["id" ], self .full_execution ["authorization" ], self .full_execution ["execution_id" ], source_node )
70
+ frontend_continue_url = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url , self .full_execution ["workflow" ]["id" ], self .full_execution ["authorization" ], self .full_execution ["execution_id" ], source_node )
71
+ frontend_abort_url = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url , self .full_execution ["workflow" ]["id" ], self .full_execution ["authorization" ], self .full_execution ["execution_id" ], source_node )
72
+ api_continue_url = "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url , self .full_execution ["workflow" ]["id" ], self .full_execution ["authorization" ], self .full_execution ["execution_id" ], source_node )
73
+ api_abort_url = "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url , self .full_execution ["workflow" ]["id" ], self .full_execution ["authorization" ], self .full_execution ["execution_id" ], source_node )
74
+
75
+ result ["links" ]["frontend_no_answer" ] = explore_path
76
+ result ["links" ]["frontend_continue" ] = frontend_continue_url
77
+ result ["links" ]["frontend_abort" ] = frontend_abort_url
78
+ result ["links" ]["api_continue" ] = api_continue_url
79
+ result ["links" ]["api_abort" ] = api_abort_url
57
80
81
+ print ("Found backend url: %s" % url )
58
82
if len (subflow ) > 0 :
59
- #print("Should run subflow: %s", subflow)
60
-
61
- # Missing startnode (user input trigger)
62
- #print("Subflows to run from userinput: ", subflows)
63
83
64
84
subflows = subflow .split ("," )
65
- frontend_url = url
66
- if ":5001" in frontend_url :
67
- print ("Should change port to 3001." )
68
- if "appspot.com" in frontend_url :
69
- frontend_url = "https://shuffler.io"
70
- if "run.app" in frontend_url :
71
- frontend_url = "https://shuffler.io"
72
-
73
85
for item in subflows :
74
86
# In case of URL being passed, and not just ID
75
87
if "/" in item :
@@ -80,10 +92,10 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
80
92
argument = json .dumps ({
81
93
"information" : information ,
82
94
"parent_workflow" : self .full_execution ["workflow" ]["id" ],
83
- "frontend_continue" : "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % ( frontend_url , self . full_execution [ "workflow" ][ "id" ], self . full_execution [ "authorization" ], self . full_execution [ "execution_id" ], source_node ) ,
84
- "frontend_abort" : "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % ( frontend_url , self . full_execution [ "workflow" ][ "id" ], self . full_execution [ "authorization" ], self . full_execution [ "execution_id" ], source_node ) ,
85
- "api_continue" : "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % ( frontend_url , self . full_execution [ "workflow" ][ "id" ], self . full_execution [ "authorization" ], self . full_execution [ "execution_id" ], source_node ) ,
86
- "api_abort" : "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % ( frontend_url , self . full_execution [ "workflow" ][ "id" ], self . full_execution [ "authorization" ], self . full_execution [ "execution_id" ], source_node ) ,
95
+ "frontend_continue" : frontend_continue_url ,
96
+ "frontend_abort" : frontend_abort_url ,
97
+ "api_continue" : api_continue_url ,
98
+ "api_abort" : api_abort_url ,
87
99
})
88
100
89
101
ret = self .run_subflow (user_apikey , item , argument , source_workflow = self .full_execution ["workflow" ]["id" ], source_execution = self .full_execution ["execution_id" ], source_auth = self .full_execution ["authorization" ], startnode = startnode , backend_url = backend_url , source_node = source_node )
0 commit comments