From 1a75d9b085ecc7fc0b0251fd04dd08b7d386b76b Mon Sep 17 00:00:00 2001 From: Der_Googler <54764558+DerGoogler@users.noreply.github.com> Date: Thu, 21 Sep 2023 18:55:42 +0200 Subject: [PATCH] Little other fixes --- Website/src/activitys/ModuleTreeConf.tsx | 46 +++++++++++++++++++++- Website/src/activitys/TerminalActivity.tsx | 14 ++++++- Website/src/hooks/useSettings.tsx | 8 ++++ Website/src/native/Shell.ts | 10 ----- 4 files changed, 65 insertions(+), 13 deletions(-) diff --git a/Website/src/activitys/ModuleTreeConf.tsx b/Website/src/activitys/ModuleTreeConf.tsx index 6eda5ff0..f1bc6fad 100644 --- a/Website/src/activitys/ModuleTreeConf.tsx +++ b/Website/src/activitys/ModuleTreeConf.tsx @@ -47,6 +47,48 @@ function ModuleTreeConf() { I am not responsible for anything that may happen to your phone by changing these informations. You do it at your own risk and take the responsibility upon yourself and you are not to blame us or MMRL and its respected developers + ({ bgcolor: theme.palette.background.default })}>Command line interfaces} + > + { + if (value) { + setSettings("mod_msu_cli", value); + } + }} + > + + + { + if (value) { + setSettings("mod_ksu_cli", value); + } + }} + > + + + KernelSU install cli + + } + secondary={settings.mod_ksu_cli} + /> + + + + ({ bgcolor: theme.palette.background.default })}>Default paths}> { if (value) { @@ -287,7 +329,7 @@ function ModuleTreeConf() { } type="text" title="Boot complete service location" - disabled={Shell.isMagiskSU()} + disabled={!Shell.isKernelSU()} initialValue={settings.mod_boot} onSuccess={(value) => { if (value) { diff --git a/Website/src/activitys/TerminalActivity.tsx b/Website/src/activitys/TerminalActivity.tsx index 7b813613..605741ee 100644 --- a/Website/src/activitys/TerminalActivity.tsx +++ b/Website/src/activitys/TerminalActivity.tsx @@ -7,6 +7,7 @@ import Ansi from "ansi-to-react"; import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import React from "react"; import { Shell } from "@Native/Shell"; +import { useSettings } from "@Hooks/useSettings"; function useOnceCall(effect: React.EffectCallback, deps?: React.DependencyList | undefined) { const isCalledRef = React.useRef(false); @@ -21,6 +22,7 @@ function useOnceCall(effect: React.EffectCallback, deps?: React.DependencyList | const TerminalActivity = () => { const { context, extra } = useActivity(); + const { settings } = useSettings(); const [active, setActive] = React.useState(true); const [lines, setLines] = React.useState([]); @@ -47,6 +49,16 @@ const TerminalActivity = () => { } }; + const installCli = (path: string) => { + if (Shell.isMagiskSU()) { + return settings.mod_msu_cli.replace(/{path}/i, path); + } else if (Shell.isKernelSU()) { + return settings.mod_ksu_cli.replace(/{path}/i, path); + } else { + throw new Error("Unable to determine installation string"); + } + }; + const install = () => { const { exploreInstall, path } = extra; @@ -75,7 +87,7 @@ const TerminalActivity = () => { } else { // @ts-ignore Terminal.exec( - Shell.installModuleString(path), + installCli(path), (r) => { addLine(r); }, diff --git a/Website/src/hooks/useSettings.tsx b/Website/src/hooks/useSettings.tsx index 73674b01..cdd395f9 100644 --- a/Website/src/hooks/useSettings.tsx +++ b/Website/src/hooks/useSettings.tsx @@ -163,6 +163,10 @@ export interface StorageDeclaration { repos: StoredRepo[]; shade_value: number; + // cli + mod_msu_cli: string; + mod_ksu_cli: string; + // default paths mod_tree: string; mod_prop: string; @@ -193,6 +197,10 @@ export const INITIAL_SETTINGS: StorageDeclaration = { repos: [], shade_value: -80, + //cli + mod_msu_cli: '/system/bin/magisk --install-module "{path}"', + mod_ksu_cli: '/data/adb/ksu/bin/ksud module install "{path}"', + // default paths mod_tree: "/data/adb/modules", mod_prop: "module.prop", diff --git a/Website/src/native/Shell.ts b/Website/src/native/Shell.ts index 4c054d50..e43e4064 100644 --- a/Website/src/native/Shell.ts +++ b/Website/src/native/Shell.ts @@ -140,16 +140,6 @@ class ShellClass extends Native { return false; } } - - public installModuleString(path: string): string { - if (this.isMagiskSU()) { - return `/system/bin/magisk --install-module "${path}"`; - } else if (this.isKernelSU()) { - return `/data/adb/ksu/ksud module install "${path}"`; - } else { - throw new Error("Unable to determine installation string"); - } - } } export const Shell: ShellClass = new ShellClass();