Skip to content

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DerGoogler authored Apr 2, 2024
1 parent d5ad5cd commit 5de4131
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 57 deletions.
24 changes: 24 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SKIPMOUNT=false
PROPFILE=false
POSTFSDATA=false
LATESTARTSERVICE=false

print_modname() {
ui_print " __ ______ ____ "
ui_print " \ \ / | _ \| _ \ "
ui_print " \ \ /\ / /| |_) | | | |"
ui_print " \ V V / | __/| |_| |"
ui_print " \_/\_/ |_| |____/ "
}

on_install() {
ui_print "- Extracting module files"
unzip -qq -o "$ZIPFILE" 'system/*' -d $MODPATH >&2
[ -d "$MODPATH/system/bin/" ] || mkdir -p "$MODPATH/system/bin/"
}

set_permissions() {
# The following is the default rule, DO NOT remove
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm $MODPATH/system/bin/wpd 0 0 0755
}
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=mmrl_wpd
name=WiFi Password Viewer for MMRL
version=2.1.1
versionCode=211
version=2.2.1
versionCode=221
author=Der_Googler, veez21 @ xda-developers
description=View all your WiFi passwords inside MMRL
19 changes: 19 additions & 0 deletions system/bin/wpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/system/bin/sh

[ "$(whoami)" != "root" ] && { echo "root required"; exit 1; }
configs=( /data/misc/wifi/WifiConfigStore.xml /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml )
for z in ${configs[@]}; do
if [ -f $z ]; then
config=$z
break
fi
done
SSID=($(grep 'name="SSID"' $config | sed "s/.*>"//;s/".*//;s/ /-_-/g"))
PSK=($(grep 'name="PreSharedKey"' $config | sed "s/<null.*/\e[01;30mNONE\e[00;37;40m/;s/.*>&quot;/\e[01;32m/;s/&quot;.*/\e[00;37;40m/;s/ /-_-/g"))

echo "WiFi Password Viewer"
echo "veez21 @ xda-developers\n"

for i in ${!SSID[@]}; do
echo "\e[01;37m${SSID[$i]}\e[00;37;40m - ${PSK[$i]}" | sed "s/-_-/ /g"
done
19 changes: 0 additions & 19 deletions system/usr/share/mmrl/config/mmrl_wpd/components/CenterBox.jsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react";
import { Toolbar } from "@mmrl/ui";
import { useActivity } from "@mmrl/hooks";

const useBackHandler = include("hooks/useBackHandler.js")

export default () => {
const { context } = useActivity();
const handleBack = useBackHandler()

return (
<Toolbar
modifier="noshadow"
Expand All @@ -13,7 +15,7 @@ export default () => {
}}
>
<Toolbar.Left>
<Toolbar.BackButton onClick={context.popPage} />
<Toolbar.BackButton onClick={handleBack} />
</Toolbar.Left>
<Toolbar.Center>WiFi Password Viewer</Toolbar.Center>
</Toolbar>
Expand Down
23 changes: 23 additions & 0 deletions system/usr/share/mmrl/config/mmrl_wpd/hooks/useBackHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { useActivity, useConfirm } from "@mmrl/hooks";

export default () => {
const { context } = useActivity();
const confirm = useConfirm();

return (e) => {
confirm({
title: "Leaving?",
description: "Are you sure that you want leave this config?",
confirmationText: "Yes",
cancellationText: "No",
})
.then(() => {
if (typeof e.callParentHandler === "function") {
e.callParentHandler();
} else {
context.popPage();
}
})
.catch(() => {});
};
};
62 changes: 29 additions & 33 deletions system/usr/share/mmrl/config/mmrl_wpd/index.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import React from "react";
import { Page } from "@mmrl/ui";
import { Page, CodeBlock } from "@mmrl/ui";
import { useNativeStorage } from "@mmrl/hooks";
import { List, ListItem, ListSubheader, Switch, ListItemText, Divider } from "@mui/material";
import { withRequireNewVersion } from "@mmrl/hoc";
import { List, ListItem, ListSubheader, Switch, ListItemText, Divider, Typography, Stack } from "@mui/material";

const RenderToolbar = include("components/RenderToolbar.jsx");
const CenterBox = include("components/CenterBox.jsx");

const useNetworks = include("hooks/useNetworks.js");
const useBackHandler = include("hooks/useBackHandler.js")

function App() {
const networks = useNetworks();
const handleBack = useBackHandler()
const [hidePasswords, setHidePasswords] = useNativeStorage("wpd_hide_passwords", true);

if (!networks) {
return (
<Page renderToolbar={RenderToolbar}>
<Page onDeviceBackButton={handleBack} renderToolbar={RenderToolbar}>
<CenterBox>No networks found</CenterBox>
</Page>
);
}

return (
<Page renderToolbar={RenderToolbar} modifier="noshadow">
<Page onDeviceBackButton={handleBack} renderToolbar={RenderToolbar} modifier="noshadow">
<List subheader={<ListSubheader>Settings</ListSubheader>}>
<ListItem>
<ListItemText primary="Hide passwords" />
Expand All @@ -29,36 +31,30 @@ function App() {
</List>
<Divider />
<List subheader={<ListSubheader>Passwords</ListSubheader>}>
{networks.map((wifi) => (
<ListItem>
<ListItemText
sx={{
"& .MuiListItemText-secondary": {
WebkitTextSecurity: wifi.psk !== null && hidePasswords ? "disc" : "none",
wordWrap: "break-word",
fontStyle: wifi.psk === null ? "italic" : "none",
},
}}
primary={wifi.ssid}
secondary={wifi.psk ? wifi.psk : "Has no password"}
/>
</ListItem>
{networks.map((wifi, index, arr) => (
<>
<ListItem>
<ListItemText
sx={{
"& .MuiListItemText-secondary": {
WebkitTextSecurity: wifi.psk !== null && hidePasswords ? "disc" : "none",
wordWrap: "break-word",
fontStyle: wifi.psk === null ? "italic" : "none",
},
}}
primary={<Typography variant="h5">{wifi.ssid}</Typography>}
secondary={<CodeBlock sx={{ pt: 1 }} children={wifi.psk ? wifi.psk : "Has no password"} />}
/>
</ListItem>
{index + 1 !== arr.length && <Divider variant="middle" />}
</>
))}
</List>
</Page>
);
}

export default () => {
if (BuildConfig.VERSION_CODE < 21410) {
return (
<Page renderToolbar={RenderToolbar}>
<CenterBox>
WPD requires MMRL above <strong>2.14.10</strong>!
</CenterBox>
</Page>
);
} else {
return <App />;
}
};
export default withRequireNewVersion({
versionCode: 21510,
component: App,
});

0 comments on commit 5de4131

Please sign in to comment.