From 74358895047e9894590ba01503d01f1810e1a9a3 Mon Sep 17 00:00:00 2001 From: Der_Googler <54764558+DerGoogler@users.noreply.github.com> Date: Sat, 27 Jan 2024 18:25:34 +0100 Subject: [PATCH] improve modconf --- Website/src/activitys/ModConfActivity.tsx | 101 ++++++++++++++---- Website/src/activitys/TerminalActivity.tsx | 9 +- .../src/components/DialogEditTextListItem.tsx | 4 +- Website/src/hooks/useModConf.tsx | 4 + docs/ModConf.md | 33 ++++++ 5 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 docs/ModConf.md diff --git a/Website/src/activitys/ModConfActivity.tsx b/Website/src/activitys/ModConfActivity.tsx index ed5e1fb2..4a8d1514 100644 --- a/Website/src/activitys/ModConfActivity.tsx +++ b/Website/src/activitys/ModConfActivity.tsx @@ -1,4 +1,4 @@ -import { Alert, Box, Divider, List, ListSubheader } from "@mui/material"; +import { Alert, Box, Divider, List, ListSubheader, Stack, Typography } from "@mui/material"; import AvatarGroup from "@mui/material/AvatarGroup"; import Avatar from "@mui/material/Avatar"; import { Toolbar } from "@Components/onsenui/Toolbar"; @@ -9,6 +9,7 @@ import { StyledListItemText } from "@Components/StyledListItemText"; import { Shell } from "@Native/Shell"; import { DialogEditTextListItem } from "@Components/DialogEditTextListItem"; import React from "react"; +import Anchor from "@Components/dapi/Anchor"; interface ModConfSections { sectionText: string; @@ -18,6 +19,7 @@ interface ModConfSections { interface ModConfListItem { confKey: K; text: string; + dialogDesc?: React.ReactNode; /** * Used for the config requirement */ @@ -177,14 +179,68 @@ function ModConfActivity() { }, ], }, + { + sectionText: "Others", + items: [ + { + text: "MMRL Install Tools", + confKey: "MMRLINI", + }, + { + text: "Config working directory", + confKey: "CONFCWD", + }, + { + text: "Config index file", + confKey: "CONFINDEX", + }, + { + text: "Explore install script", + dialogDesc: ( + <> + + Check the{" "} + + documentations + {" "} + for possible workarounds!
{" and can also be used, "} shell supported. +
+ + ), + confKey: "EXPLORE_INSTALL", + }, + { + text: "Local install script", + dialogDesc: ( + <> + + Check the{" "} + + documentations + {" "} + for possible workarounds!
{" can also be used, "} shell supported. +
+ + ), + confKey: "LOCAL_INSTALL", + }, + ], + }, ], [] ); return ( - - + + 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 @@ -202,6 +258,7 @@ function ModConfActivity() { type="text" title={item.text} disabled={item.disabled} + description={item.dialogDesc} initialValue={_modConf[item.confKey]} onSuccess={(value) => { if (value) { @@ -211,22 +268,28 @@ function ModConfActivity() { > - {item.logoText && Array.isArray(item.logoText) ? ( - <> - - {item.logoText.map((logo) => ( - - ))} - - - ) : ( - item.logoText && ( - - ) - )} - [{item.confKey}]: {item.text} - + + {`<${item.confKey}>`} + + {" "} + + {item.logoText && Array.isArray(item.logoText) ? ( + <> + + {item.logoText.map((logo) => ( + + ))} + + + ) : ( + item.logoText && ( + + ) + )} + {item.text} + + + } secondary={_modConf[item.confKey]} /> diff --git a/Website/src/activitys/TerminalActivity.tsx b/Website/src/activitys/TerminalActivity.tsx index 7557d33a..5d8abfca 100644 --- a/Website/src/activitys/TerminalActivity.tsx +++ b/Website/src/activitys/TerminalActivity.tsx @@ -79,7 +79,9 @@ const TerminalActivity = () => { }; Terminal.exec({ - command: `${modConf("MMRLINI")}/system/usr/share/mmrl/bin/mmrl_explore_install_v4`, + command: modConf("EXPLORE_INSTALL", { + URL: path, + }), env: envp_explore, onLine: (line) => { addLine(line); @@ -101,7 +103,10 @@ const TerminalActivity = () => { }; Terminal.exec({ - command: `${modConf("MMRLINI")}/system/usr/share/mmrl/bin/mmrl_local_install_v4`, + command: modConf("LOCAL_INSTALL", { + ZIPFILE: path, + MODID: id, + }), env: envp_local, onLine: (line) => { addLine(line); diff --git a/Website/src/components/DialogEditTextListItem.tsx b/Website/src/components/DialogEditTextListItem.tsx index 1e966998..b290ef81 100644 --- a/Website/src/components/DialogEditTextListItem.tsx +++ b/Website/src/components/DialogEditTextListItem.tsx @@ -17,7 +17,7 @@ export interface DialogEditTextListItemProps extends React.PropsWithChildren { title: string; disabled?: boolean; initialValue: string; - description?: string; + description?: React.ReactNode; type?: React.HTMLInputTypeAttribute; onSuccess: (value: string) => void; InputProps?: Partial; @@ -50,7 +50,7 @@ export const DialogEditTextListItem = (props: DialogEditTextListItemProps) => { {props.children} - + {props.title} {props.description && {props.description}} diff --git a/Website/src/hooks/useModConf.tsx b/Website/src/hooks/useModConf.tsx index f8defc31..8192d684 100644 --- a/Website/src/hooks/useModConf.tsx +++ b/Website/src/hooks/useModConf.tsx @@ -39,6 +39,8 @@ export interface ModConf { // others MMRLINI: string; + EXPLORE_INSTALL: string; + LOCAL_INSTALL: string; CONFCWD: string; CONFINDEX: string; } @@ -79,6 +81,8 @@ export const INITIAL_MOD_CONF: ModConf = { // others MMRLINI: "/mmrl_install_tools", CONFCWD: "/system/usr/share/mmrl/config/", + EXPLORE_INSTALL: "/system/usr/share/mmrl/bin/mmrl_explore_install_v5", + LOCAL_INSTALL: "/system/usr/share/mmrl/bin/mmrl_local_install_v5", CONFINDEX: "/index.jsx", }; diff --git a/docs/ModConf.md b/docs/ModConf.md new file mode 100644 index 00000000..dcb51a68 --- /dev/null +++ b/docs/ModConf.md @@ -0,0 +1,33 @@ +# ModConf + +TODO + +## Workarounds + +Here are some samples to avoid some configs + +## Avoid MMRL Install Tools + +This workaroud is for people who don't wanna install a extra module for installing other modules + +Based on your selected root method + +| Root method | CLI | Busybox | +| ----------- | ---------- | ---------- | +| Magisk | `` | `` | +| KernelSU | `` | `` | +| APatch | `` | `` | + +### Local install script + +```shell + --install-module "" +``` + +> We use magisk as example. KernelSU or APatch is ` module install ""` + +### Explore install script + +```shell +FILE="/data/local/tmp/.zip"; wget "" -O $FILE; --install-module $FILE; +```