Skip to content

Commit

Permalink
Merge pull request #845 from franck403/master
Browse files Browse the repository at this point in the history
Adding install and uninstall command to the terminal
  • Loading branch information
andrewstech committed May 5, 2024
2 parents 1c602c3 + 24f2eab commit 57ee0df
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down
49 changes: 48 additions & 1 deletion src/containers/applications/apps/terminal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 57ee0df

Please sign in to comment.