diff --git a/Cognitavit/src/executor/.gitignore b/Cognitavit/src/executor/.gitignore new file mode 100644 index 0000000..87ebb0e --- /dev/null +++ b/Cognitavit/src/executor/.gitignore @@ -0,0 +1,24 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build +/env + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/Cognitavit/src/executor/network/downloadApplication.py b/Cognitavit/src/executor/network/downloadApplication.py index 0565cf0..a7106f7 100644 --- a/Cognitavit/src/executor/network/downloadApplication.py +++ b/Cognitavit/src/executor/network/downloadApplication.py @@ -19,12 +19,13 @@ config_file = path.join(env_userpath, CONFIG_NAME) downloads_folder = path.join(env_userpath, "downloaded") -@download_app.route('/get_local_bots', methods=['GET']) +@download_app.route('/get_local_bots', methods=['GET', 'POST']) def get_local(): if (os.path.exists(config_file) == True): with open(config_file) as f: data = json.load(f) return {"installed": data["installed"]} + return {"installed":[]} diff --git a/Cognitavit/src/executor/network/execApplication.py b/Cognitavit/src/executor/network/execApplication.py index 02a1f96..6b78fcd 100644 --- a/Cognitavit/src/executor/network/execApplication.py +++ b/Cognitavit/src/executor/network/execApplication.py @@ -77,5 +77,24 @@ def execute_event(): ''' + print("inside send-event") + execute_factory = FactoryExecutor() + platform_exec = execute_factory.create(sys_platform) + #result = platform_exec.bot_exec(buid, arguments) + + content = request.get_json(force=True) + applet_type = content["appletType"] + applet_arg = content["appletArg"] + applet = content["applet"] + + if(applet_type == 0): #Web Bot + print("running bot event") + platform_exec.bot_exec(applet, applet_arg) + pass + + if(applet_type == 1): #Application + print("running app event") + platform_exec.execute(applet, applet_arg) + pass return {"status": True} diff --git a/Cognitavit/src/main/execbuild/core.exe b/Cognitavit/src/main/execbuild/core.exe index 4558a3d..ebb8775 100644 Binary files a/Cognitavit/src/main/execbuild/core.exe and b/Cognitavit/src/main/execbuild/core.exe differ diff --git a/Cognitavit/src/main/main.ts b/Cognitavit/src/main/main.ts index afa3960..f655a23 100644 --- a/Cognitavit/src/main/main.ts +++ b/Cognitavit/src/main/main.ts @@ -220,7 +220,7 @@ let appData_path = app.getPath('userData'); /** Code goes above */ - execSocket.start(auth_tokens, appData_path, platform , executable_path); + execSocket.start(auth_tokens, appData_path, platform , executable_path, machine_payload); console.log("Trigger socket has been started."); return true; diff --git a/Cognitavit/src/main/sockets/execSocket/execManager.ts b/Cognitavit/src/main/sockets/execSocket/execManager.ts index f6d57cf..f259eda 100644 --- a/Cognitavit/src/main/sockets/execSocket/execManager.ts +++ b/Cognitavit/src/main/sockets/execSocket/execManager.ts @@ -41,6 +41,7 @@ import { data } from 'autoprefixer'; import { io, Socket } from 'socket.io-client'; +import { get_device_id, get_device_hostname, get_platform } from './../../utils/deviceinfo/deviceInfo' class execManager{ private static instance: execManager; @@ -118,7 +119,7 @@ class execManager{ It starts the trigger process, and connects to it via socket.io ipc. Failure event managements needs to be done: TODO: */ - public start(auth_token:any /*AuthenticationToken*/, appdata_folder: string, platform: string, executable:string){ + public start(auth_token:any /*AuthenticationToken*/, appdata_folder: string, platform: string, executable:string, device_id: string){ if(auth_token == undefined|| appdata_folder == undefined || executable == undefined){ console.log("Set the authentication keys/data_path before starting"); return; @@ -126,8 +127,11 @@ class execManager{ // Clear state before starting. this.resetConfigs(); // Set authentication keys + + + execManager.setEnviromentVariables(auth_token, appdata_folder, platform, 5000); - const child = execFile(executable, [JSON.stringify(auth_token),String(execManager.appData), platform]); + const child = execFile(executable, [auth_token["localId"],String(execManager.appData), platform, device_id]); if(!child.pid){ ; // nop operator diff --git a/Cognitavit/src/main/sockets/orcherstraSocket/orchestraSocket.ts b/Cognitavit/src/main/sockets/orcherstraSocket/orchestraSocket.ts index 65ba134..ea4cc4b 100644 --- a/Cognitavit/src/main/sockets/orcherstraSocket/orchestraSocket.ts +++ b/Cognitavit/src/main/sockets/orcherstraSocket/orchestraSocket.ts @@ -112,7 +112,7 @@ class orchestraSocket{ orchestraSocket.socket.on("send-event", (payload:any) => { // UPDATE TO send-event - trigger_executor.sendRequest("executeApp", payload); + trigger_executor.sendRequest("send-event", payload); }) // --------------------------------------------------------------------------// diff --git a/Cognitavit/src/renderer/Components/dashboard/applications/WebApp/search/SearchWebApp.tsx b/Cognitavit/src/renderer/Components/dashboard/applications/WebApp/search/SearchWebApp.tsx index 29a0e5f..d6b4b39 100644 --- a/Cognitavit/src/renderer/Components/dashboard/applications/WebApp/search/SearchWebApp.tsx +++ b/Cognitavit/src/renderer/Components/dashboard/applications/WebApp/search/SearchWebApp.tsx @@ -15,7 +15,9 @@ import Modal from '@mui/material/Modal'; import TextField from '@mui/material/TextField'; const SearchWebApp = (prop: any) => { - let Apps = prop.appletList; + + const [Apps, setApps] = useState([]); + const [input, setInput] = useState(''); const [applicationList, setApplicationList] = useState(Apps); @@ -37,10 +39,17 @@ const SearchWebApp = (prop: any) => { setInput(input_word); return; } - const filtered_apps = Apps.filter((apps: string) => - apps.toLowerCase().includes(input_word.toLowerCase()) + + const filtered_apps = Apps.filter((apps: any) => + apps["name"].toLowerCase().includes(input_word.toLowerCase()) ); - setApplicationList(filtered_apps.sort()); + + console.log("------------------") + console.log(filtered_apps); + console.log(applicationList); + console.log("------------------") + + setApplicationList(filtered_apps); setInput(input_word); }; @@ -49,22 +58,30 @@ const SearchWebApp = (prop: any) => { //FUTURE: //Look at the prop.type value to determine if its custom_bin, or applets. - let value = window.exec_calls.proc_bus(["getApplist", {}]) + let value = window.exec_calls.proc_bus(["get_local_bots", {}]) + toast.promise(value,{ pending: "Reading Application List", error: "Unable to read from Application list, IPC BUS has not responded.", success: "Application List has been obtained.." }) + console.log(value) + //Array + + value.then((result:any) => { - if(result != undefined && result["application_list"] != undefined){ - if(result["application_list"].length > 0){ - setApplicationList(result["application_list"].sort()) + console.log(result); + if(result != undefined && result["installed"] != undefined){ + if(result["installed"].length > 0){ + //Array of jsons + setApps(result["installed"]) + setApplicationList(result["installed"]) } } - console.log("INSIDE THE NATIVE_APP", result["application_list"]); }) + if(prop.type == 'native'){ setExectuableType("Native App") }else if(prop.type == 'custom'){ @@ -114,8 +131,8 @@ const SearchWebApp = (prop: any) => { */ // Send a message over our ipc bus manager - let value = window.exec_calls.proc_bus(["executeApp", { - application_name: application_name, + let value = window.exec_calls.proc_bus(["executeBot", { + buid: application_name, arguments: application_arguments }]) toast.promise(value,{ @@ -187,21 +204,29 @@ const SearchWebApp = (prop: any) => { placeholder= {executableType + " List"} /> + { + applicationList.map((appname:any)=>{ + console.log("HERE") + console.log(appname["buid"]); + }) + } +
{applicationList && applicationList.length > 0 ? ( - applicationList.map((appname: string) => ( -
  • + applicationList.map((appname: any) => ( + +
  • Orchestra Logo -

    {appname}

    +

    {appname["name"]}