Skip to content

Commit

Permalink
blacklist core ; ahhh
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler committed May 21, 2024
1 parent 4179cf5 commit 920dae6
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 15 deletions.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/mbl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Module Blacklist Removal
description: Issue template to request a blacklisted module removal
title: '[MBL]: '
body:
- type: input
id: moduleid
attributes:
label: Module ID
placeholder: mmrl_install_tools
validations:
required: true
- type: textarea
id: reason
attributes:
label: Reason why it should be removed
validations:
required: true
- type: markdown
attributes:
value: >-
This template was generated with [Issue Forms
Creator](https://issue-forms-creator.netlify.app)
77 changes: 77 additions & 0 deletions Website/src/activitys/ViewBlacklistedModulesActivity.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import AntiFeatureListItem from "@Components/AntiFeatureListItem";
import Anchor from "@Components/dapi/Anchor";
import { Page } from "@Components/onsenui/Page";
import { Toolbar } from "@Components/onsenui/Toolbar";
import { useActivity } from "@Hooks/useActivity";
import { useStrings } from "@Hooks/useStrings";
import { BlacklistedModule, blacklistedModules } from "@Util/blacklisted-modules";
import { ExpandLess, ExpandMore } from "@mui/icons-material";
import { Collapse, List, ListItem, ListItemIcon, ListItemText } from "@mui/material";
import FlatList from "flatlist-react";
import React from "react";

interface BlacklistItemProps {
module: BlacklistedModule;
}

function BlacklistItem({ module }: BlacklistItemProps) {
const [open, setOpen] = React.useState(false);

const handleClick = () => {
setOpen((prev) => !prev);
};

return (
<>
<ListItem>
<ListItemIcon onClick={handleClick}>{open ? <ExpandLess /> : <ExpandMore />}</ListItemIcon>

<Anchor color="text.primary" href={module.source} noIcon>
<ListItemText primary={module.id} secondary={module.source} />
</Anchor>
</ListItem>
<Collapse in={open} timeout="auto" unmountOnExit>
<List disablePadding>
{typeof module.antifeatures === "string" ? (
<AntiFeatureListItem sx={{ pl: 4 }} type={module.antifeatures} />
) : (
Array.isArray(module.antifeatures) && module.antifeatures.map((anti) => <AntiFeatureListItem sx={{ pl: 4 }} type={anti} />)
)}
</List>
</Collapse>
</>
);
}

function ViewBlacklistedModulesActivity() {
const { context } = useActivity();
const { strings } = useStrings();

const renderToolbar = () => {
return (
<Toolbar modifier="noshadow">
<Toolbar.Left>
<Toolbar.BackButton onClick={context.popPage} />
</Toolbar.Left>
<Toolbar.Center>{strings("blacklisted_modules")}</Toolbar.Center>
</Toolbar>
);
};

return (
<Page renderToolbar={renderToolbar}>
<Page.RelativeContent zeroMargin>
<List>
<FlatList
list={blacklistedModules}
renderItem={(mod) => <BlacklistItem module={mod} />}
renderOnScroll
renderWhenEmpty={() => <></>}
/>
</List>
</Page.RelativeContent>
</Page>
);
}

export default ViewBlacklistedModulesActivity;
14 changes: 14 additions & 0 deletions Website/src/activitys/fragments/DrawerFragment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import LicensesActivity from "@Activitys/LicensesActivity";
import { SubmitModuleActivity } from "@Activitys/SubmitModuleActivity";
import { os } from "@Native/Os";
import { useTheme } from "@Hooks/useTheme";
import ViewBlacklistedModulesActivity from "@Activitys/ViewBlacklistedModulesActivity";

type Props = {
renderToolbar: () => JSX.Element;
Expand Down Expand Up @@ -68,6 +69,19 @@ export const DrawerFragment = (props: Props) => {
>
<ListItemText primary={strings("modfs")} />
</ListItemButton>

<ListItemButton
onClick={() => {
pushPage({
component: ViewBlacklistedModulesActivity,
key: "ViewBlacklistedModulesActivity",
extra: {},
});
hide();
}}
>
<ListItemText primary={strings("blacklisted_modules")} />
</ListItemButton>
</List>

<Divider />
Expand Down
5 changes: 3 additions & 2 deletions Website/src/components/AntiFeatureListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { useStrings } from "@Hooks/useStrings";
import ListItem from "@mui/material/ListItem";
import { en_antifeatures } from "./../locales/antifeatures/en";
import React from "react";
import { ListItemText } from "@mui/material";
import { ListItemText, SxProps } from "@mui/material";

interface AntiFeatureListItemProps {
sx?: SxProps;
type: string;
}

Expand All @@ -14,7 +15,7 @@ const AntiFeatureListItem = (props: AntiFeatureListItemProps) => {
if (!find) return null;

return (
<ListItem disablePadding>
<ListItem sx={props.sx} disablePadding>
<ListItemText primary={find.name} secondary={find.desc} />
</ListItem>
);
Expand Down
2 changes: 1 addition & 1 deletion Website/src/components/module/DeviceModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const DeviceModule = React.memo<Props>((props) => {
const module_config_file = SuFile.exist(format("CONFINDEX"));

const findHardCodedAntifeature = React.useMemo<Track["antifeatures"]>(() => {
return blacklistedModules[id]?.antifeatures || [];
return blacklistedModules.find((mod) => mod.id === id)?.antifeatures || [];
}, [id]);

return (
Expand Down
2 changes: 1 addition & 1 deletion Website/src/components/module/ExploreModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const ExploreModule = React.memo<Props>((props) => {
const formatLastUpdate = useFormatDate(timestamp ? timestamp : versions[versions.length - 1].timestamp);

const findHardCodedAntifeature = React.useMemo<Track["antifeatures"]>(() => {
return [...(track.antifeatures || []), ...(blacklistedModules[id]?.antifeatures || [])];
return [...(track.antifeatures || []), ...(blacklistedModules.find((mod) => mod.id === id)?.antifeatures || [])];
}, [id, track.antifeatures]);

const handleOpenModule = () => {
Expand Down
16 changes: 8 additions & 8 deletions Website/src/locales/antifeatures/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export const en_antifeatures = [
{
id: "KnownVuln",
name: "Known Vulnerability",
desc: "This app contains a known security vulnerability",
desc: "This module contains a known security vulnerability",
},
{
id: "NSFW",
name: "NSFW",
desc: "This app contains content that should not be publicized or visible everywhere",
desc: "This module contains content that should not be publicized or visible everywhere",
},
{
id: "NoSourceSince",
Expand All @@ -22,27 +22,27 @@ export const en_antifeatures = [
{
id: "NonFreeAdd",
name: "Non-Free Addons",
desc: "This app promotes non-free add-ons",
desc: "This module promotes non-free add-ons",
},
{
id: "NonFreeAssets",
name: "Non-Free Assets",
desc: "This app contains non-free assets",
desc: "This module contains non-free assets",
},
{
id: "NonFreeDep",
name: "Non-Free Dependencies",
desc: "This app depends on other non-free apps",
desc: "This module depends on other non-free modules",
},
{
id: "NonFreeNet",
name: "Non-Free Network Services",
desc: "This app promotes or depends entirely on a non-changeable or non-free network service",
desc: "This module promotes or depends entirely on a non-changeable or non-free network service",
},
{
id: "Tracking",
name: "Tracking",
desc: "This app tracks and reports your activity",
desc: "This module tracks and reports your activity",
},
{
id: "UpstreamNonFree",
Expand All @@ -52,6 +52,6 @@ export const en_antifeatures = [
{
id: "Obfuscation",
name: "Obfuscation",
desc: "The app source code is may obfuscated, making it difficult to understand, audit, or modify.",
desc: "The module source code is may obfuscated, making it difficult to understand, audit, or modify.",
},
];
2 changes: 2 additions & 0 deletions Website/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,6 @@ export const en = {

print_errors: "Print errors",
print_errors_desc: "Prints terminal and MMRL Install Tools error to the console",

blacklisted_modules: "Blacklisted modules",
};
21 changes: 18 additions & 3 deletions Website/src/util/blacklisted-modules.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
export const blacklistedModules = {
zygisksu: {
export interface BlacklistedModule {
id: string;
source: string;
hidden: boolean;
antifeatures: Track["antifeatures"];
}

export const blacklistedModules: BlacklistedModule[] = [
{
id: "zygisksu",
source: "https://github.com/Dr-TSNG/ZygiskNext",
hidden: false,
antifeatures: ["Obfuscation", "NoSourceSince"],
},
};
{
id: "ATWEAKER",
source: "https://github.com/C0d3h01/AndroidTweaker",
hidden: false,
antifeatures: ["NoSourceSince"],
},
];

0 comments on commit 920dae6

Please sign in to comment.