Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed Sep 16, 2023
1 parent f6854de commit 75b8240
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
8 changes: 7 additions & 1 deletion Website/src/activitys/MainActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ const MainActivity = (): JSX.Element => {
setIsSplitterOpen(true);
};

const erudaRef = React.useRef<HTMLElement | null>(null);

React.useEffect(() => {
if (settings.eruda_console_enabled) {
eruda.init();
eruda.init({
container: erudaRef.current as HTMLElement,
tool: ["console", "elements", "resources", "info"],
});
} else {
if ((window as any).eruda) {
eruda.destroy();
Expand Down Expand Up @@ -179,6 +184,7 @@ const MainActivity = (): JSX.Element => {

return (
<Page
ref={erudaRef}
renderToolbar={() => {
return (
<Toolbar modifier="noshadow">
Expand Down
6 changes: 2 additions & 4 deletions Website/src/activitys/SettingsActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ function SettingsActivity() {
id="switch-list-__experimental_local_install"
primary={"Enable local install"}
secondary={
<>
Allows you to install local *.zip files (Experimental). <strong>Disabled due KernelSU support.</strong>
</>
<>Allows you to install local *.zip files (Experimental). {Shell.isKernelSU && <strong>Disabled due KernelSU.</strong>}</>
}
/>
<Android12Switch
edge="end"
disabled
disabled={Shell.isKernelSU}
onChange={(e: any) => {
setSettings("__experimental_local_install", e.target.checked);
}}
Expand Down
15 changes: 9 additions & 6 deletions Website/src/activitys/fragments/DeviceModuleFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { useActivity } from "@Hooks/useActivity";
import { useSettings } from "@Hooks/useSettings";
import { Page } from "@Components/onsenui/Page";
import Stack from "@mui/material/Stack";
import { Shell } from "@Native/Shell";
import { Box, Card, Typography } from "@mui/material";
import TerminalActivity from "@Activitys/TerminalActivity";

const DeviceModuleFragment = () => {
const { context } = useActivity();
Expand All @@ -15,7 +18,7 @@ const DeviceModuleFragment = () => {
const dir = SuFile.list(settings.def_mod_path).split(",");

const regex = settings.mod_filt.map(function (re) {
return new RegExp("\\b" + re + "\\b", "i");
return new RegExp("\\b" + re + "\\b", "gmi");
});

setModules(
Expand All @@ -32,9 +35,9 @@ const DeviceModuleFragment = () => {
return (
<Page>
<Page.RelativeContent>
{/* {settings.__experimental_local_install && (
<StyledCard
elevation={0}
{settings.__experimental_local_install && Shell.isMagisk && (
<Card
variant="outlined"
onClick={() => {
// @ts-ignore
Chooser.getFile(
Expand All @@ -61,8 +64,8 @@ const DeviceModuleFragment = () => {
</Typography>
</Stack>
</Box>
</StyledCard>
)} */}
</Card>
)}
<Stack sx={{ mt: 1 }} direction="column" justifyContent="flex-start" alignItems="center" spacing={1}>
{modules.map((module) => (
<DeviceModule module={module} />
Expand Down
1 change: 0 additions & 1 deletion Website/src/components/onsenui/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const RelativeContent = styled(Content)((props: ContentProps) => {

return {
boxSizing: "border-box",
height: "100%",
minWidth: props.minWidth ? props.minWidth : 200,
maxWidth: props.maxWidth ? props.maxWidth : 980,
margin: "0 auto",
Expand Down
14 changes: 14 additions & 0 deletions Website/src/native/Shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ class ShellClass extends Native<NativeShell> {
return "0:SU";
}
}

/**
* Determine if MMRL runs with KernelSU
*/
public get isKernelSU(): boolean {
return /(\d+\.\d+\.\d+):KernelSU/i.test(this.VERSION_NAME()) ? true : false;
}

/**
* Determine if MMRL runs with Magisk
*/
public get isMagisk(): boolean {
return /(\d+\.\d+):MAGISKSU/i.test(this.VERSION_NAME()) ? true : false;
}
}

export const Shell: ShellClass = new ShellClass();

0 comments on commit 75b8240

Please sign in to comment.