apoxi unlocker

This commit is contained in:
Kirill Zhumarin 2025-08-11 09:24:55 +00:00
parent ef29dacca8
commit 65dbf9261d
7 changed files with 858 additions and 14 deletions

View file

@ -25,13 +25,15 @@
"vite-bundle-visualizer": "^1.2.1",
"vite-plugin-node-polyfills": "^0.17.0",
"vite-plugin-solid": "^2.11.8",
"vite-plugin-wasm": "^3.5.0",
"vite-tsconfig-paths": "^5.1.4"
},
"dependencies": {
"@fontsource-variable/roboto": "^5.2.6",
"@kobalte/core": "^0.13.11",
"@serialport/stream": "^13.0.0",
"@sie-js/serial": "^1.1.8",
"@sie-js/apoxi-tool": "^1.0.5",
"@sie-js/serial": "^1.1.10",
"@solid-primitives/storage": "^4.3.3",
"@solidjs/router": "^0.15.3",
"@suid/icons-material": "^0.9.0",

740
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,7 @@ import SdCardIcon from '@suid/icons-material/SdCard';
import MailIcon from '@suid/icons-material/Mail';
import ExpandMoreIcon from '@suid/icons-material/ExpandMore';
import ExpandLessIcon from '@suid/icons-material/ExpandLess';
import PhonelinkLockIcon from '@suid/icons-material/PhonelinkLock';
import ApoxiIcon from '@/assets/apoxi.svg';
import SgoldIcon from '@/assets/sgold.svg';
import { useTheme } from '@suid/material/styles';
@ -128,13 +129,11 @@ export const AppDrawer: Component<AppDrawerProps> = (props) => {
icon: <ApoxiIcon width="1.5em" height="1.5em" />,
title: "APOXI Tools",
sublinks: [
/*
{
icon: <PhonelinkLockIcon />,
title: "Unlock boot",
url: "/apoxi/unlock-boot",
},
*/
{
icon: <SdCardIcon />,
title: "Memory dumper",

View file

@ -4,6 +4,7 @@ import { Navigate, Route, Router } from "@solidjs/router";
import ScreenShooterPage from "@/pages/ScreenShooter/ScreenShooterPage";
import { MemoryDumperPage } from "@/pages/MemoryDumper/MemoryDumperPage";
import SMSReaderPage from "@/pages/SMSReader/SMSReaderPage";
import UnlockBootloaderPage from "@/pages/Apoxi/UnlockBootloaderPage";
export const Root: Component = () => {
const showAppError = (err: any) => {
@ -19,7 +20,7 @@ export const Root: Component = () => {
<Route path="/dumper" component={MemoryDumperPage} />
<Route path="/dumper/:protocol" component={MemoryDumperPage} />
<Route path="/sms-reader" component={SMSReaderPage} />
<Route path="/apoxi/unlock-boot" component={SMSReaderPage} />
<Route path="/apoxi/unlock-boot" component={UnlockBootloaderPage} />
<Route path="*" component={() => <Navigate href="/" />} />
</Router>
</ErrorBoundary>

View file

@ -0,0 +1,111 @@
import { Component, createSignal } from "solid-js";
import {
Alert,
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
Stack,
TextField
} from "@suid/material";
import { Title } from "@/components/Layout/Title";
import { SerialConnect } from "@/components/SerialConnect";
import { useSerial } from "@/providers/SerialProvider";
import * as Comlink from "comlink";
import { ButtonLoadingText } from "@/components/UI/ButtonLoadingText";
export const UnlockBootloaderPage: Component = () => {
let logFieldRef!: HTMLTextAreaElement;
const [log, setLog] = createSignal<string>("");
const [isBusy, setIsBusy] = createSignal<boolean>(false);
const [showConfirm, setShowConfirm] = createSignal(false);
const isSerialReady = () => serial.protocol() == "DWD";
const serial = useSerial();
const onUnlockLog = (log: string) => {
setLog((prev) => prev + log + "\n");
logFieldRef.scrollTop = logFieldRef.scrollHeight;
};
const handleUnlock = async () => {
setShowConfirm(false);
setIsBusy(true);
try {
onUnlockLog("Starting unlock process...");
await serial.dwd.unlockBoot(Comlink.proxy(onUnlockLog));
} catch (e) {
onUnlockLog(String(e));
} finally {
setIsBusy(false);
}
};
const handleCancelUnlock = () => {
setShowConfirm(false);
};
return (
<Box mt={1}>
<Title>Unlock Bootloader</Title>
<SerialConnect protocol="DWD" />
<Box mt={1}>
<Alert severity="info">
Unlocking the bootloader lets you use external flash tools.<br />
For example: V-Klay to install patches.<br />
<b>This does not remove the SIM lock.</b>
<Box mt={1}>
<Button
variant="contained"
onClick={() => setShowConfirm(true)}
disabled={isBusy() || !isSerialReady()}
>
<ButtonLoadingText loading={isBusy()}>
Unlock bootloader
</ButtonLoadingText>
</Button>
</Box>
</Alert>
</Box>
<Dialog open={showConfirm()} onClose={handleCancelUnlock}>
<DialogTitle id="alert-dialog-title">
Unlocking bootloader
</DialogTitle>
<DialogContent>
<DialogContentText id="alert-dialog-description">
Unlocking the APOXI bootloader WILL BREAK THE DEVICE and it may never work again.<br /><br />
<b>MAKE A FULL BACKUP BEFORE THE OPERATION.</b>
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleCancelUnlock}>Cancel</Button>
<Button onClick={handleUnlock} color="error">
Continue
</Button>
</DialogActions>
</Dialog>
<Stack mt={2}>
<TextField
inputRef={(ref) => (logFieldRef = ref as HTMLElement as HTMLTextAreaElement)}
value={log()}
sx={{flex: 1}}
multiline={true}
rows={10}
inputProps={{ readOnly: true }}
label="Log output"
/>
</Stack>
</Box>
);
}
export default UnlockBootloaderPage;

View file

@ -1,6 +1,7 @@
import { DWD, IoReadWriteProgress } from "@sie-js/serial";
import { SerialService } from "./SerialService";
import { openSerialPort } from "@/utils/serial.js";
import { isApoxiBootUnlocked, unlockApoxiBootloader, UnlockBootloaderOptions } from "@sie-js/apoxi-tool";
export class DwdService extends SerialService<DWD> {
async connect(portIndex: number): Promise<void> {
@ -36,6 +37,14 @@ export class DwdService extends SerialService<DWD> {
return `${sw.sw} (${sw.cpu})`;
}
async isBootUnlocked() {
return await isApoxiBootUnlocked(this.handle);
}
async unlockBoot(onDebugLog: (log: string) => void) {
await unlockApoxiBootloader(this.handle, { debug: onDebugLog });
}
async disconnect(): Promise<void> {
if (this.isConnected) {
const port = this.handle.getSerialPort();

View file

@ -74,7 +74,7 @@ export default defineConfig({
}),
],
optimizeDeps: {
exclude: ['siemens-sms-parser'],
exclude: ['siemens-sms-parser', '@sie-js/creampie'],
},
server: {
port: 3000,