diff --git a/src/actions/index.js b/src/actions/index.js index 355324ccf..1a149d91c 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -123,7 +123,7 @@ export const delApp = (act, menu) => { var app = Object.keys(apps).filter((x) => apps[x].action == data.type); if (app) { app = apps[app]; - if (app.pwa == true) { + if (app.pwa == true || app.pwa == False /*what is that for ?*/) { store.dispatch({ type: app.action, payload: "close" }); store.dispatch({ type: "DELAPP", payload: app.icon }); diff --git a/src/containers/applications/apps/terminal.jsx b/src/containers/applications/apps/terminal.jsx index 76ac97f4a..ad646b78a 100644 --- a/src/containers/applications/apps/terminal.jsx +++ b/src/containers/applications/apps/terminal.jsx @@ -2,8 +2,9 @@ import React, { useState, useEffect } from "react"; import { useSelector, useDispatch } from "react-redux"; import i18next from "i18next"; import login from "../../../components/login"; +import { installApp, delApp } from "../../../actions"; -import { ToolBar } from "../../../utils/general"; +import { Icon, ToolBar } from "../../../utils/general"; import dirs from "./assets/dir.json"; export const WnTerminal = () => { @@ -74,6 +75,50 @@ export const WnTerminal = () => { if (arg.length) { tmpStack.push(eval(arg).toString()); } + } else if (type == "install") { + if (arg.length) { + tmpStack.push("Installing app"); + var arg = arg.toString().split(" "); + console.log(arg); + var AppName = arg[0]; + var IframeUrl = arg[1]; + var IconUrl = arg[2]; + var Json = { + name: AppName, + icon: IconUrl, + type: "game", + data: { + type: "IFrame", + url: IframeUrl, + invert: true, + }, + }; + installApp(Json); + tmpStack.push("App installed"); + } + } else if (type == "uninstall") { + if (arg.length) { + tmpStack.push("Uninstalling app"); + var arg = arg.toString().split(" "); + var AppName = arg[0]; + tmpStack.push(AppName); + var apps = document.getElementsByClassName("dskApp"); + var Mainmenu = ""; + for (let i = 0; i < apps.length; i++) { + var app = apps[i]; + var Appcname = app.getElementsByClassName("appName")[0]; + var menu = app.getElementsByClassName("uicon")[0]; + console.log(Appcname.innerHTML); + if (Appcname.innerHTML == AppName) { + var Mainmenu = menu; + console.log(menu); + } + } + console.log(Mainmenu); + + delApp("delete", Mainmenu); + tmpStack.push("App uninstalled"); + } } else if (type == "python") { if (arg.length) { if (window.pythonRunner) { @@ -272,6 +317,8 @@ export const WnTerminal = () => { "VER Displays the Windows version.", "PYTHON EXECUTE PYTHON CODE.", "EVAL RUNS JavaScript statements.", + "INSTALL Instal a app with app name and iframe url", + "UNINSTALL Uninstal a app with app name", ]; for (var i = 0; i < helpArr.length; i++) {