Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
更新1.2.12
Browse files Browse the repository at this point in the history
- 添加了安装软件包的选项
- 完善了 ldrestart
  • Loading branch information
Lakr Aream committed May 15, 2020
1 parent 52f395e commit a0bf218
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"displayName": "iOSre Extension",
"description": "A fast and elegant VSCode extension used for iOSre projects. (READ README BEFORE INSTALL)",
"license": "SEE LICENSE FILE",
"version": "1.2.10",
"version": "1.2.12",
"icon": "images/icon.png",
"engines": {
"vscode": "^1.43.0"
Expand Down
1 change: 1 addition & 0 deletions res/package.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 47 additions & 2 deletions src/iDeviceToolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { join } from 'path';
import { LKutils } from './Utils';
import { iDevices } from './iDevices';
import { iDeviceItem, iDeviceNodeProvider } from './iDeviceConnections';
import { writeFileSync } from 'fs';
import { url } from 'inspector';


export class ToolItem extends vscode.TreeItem {
Expand All @@ -27,6 +29,8 @@ export class ToolItem extends vscode.TreeItem {
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'kill.svg'));
} else if (name === "Add iProxy") {
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'connect.svg'));
} else if (name === "Install deb") {
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'package.svg'));
} else {
return vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'ios.svg'));
}
Expand All @@ -45,7 +49,7 @@ export class ToolItem extends vscode.TreeItem {

export class ToolboxNodeProvider implements vscode.TreeDataProvider<ToolItem> {

public static tools = ["Copy UDID", "Copy ECID", "sbreload", "ldrestart", "Safemode", "Shutdown iProxy", "Add iProxy"];
public static tools = ["Copy UDID", "Copy ECID", "Install deb", "sbreload", "ldrestart", "Safemode", "Shutdown iProxy", "Add iProxy"];
public static nodeProvider: ToolboxNodeProvider;

public static init() {
Expand All @@ -70,14 +74,55 @@ export class ToolboxNodeProvider implements vscode.TreeDataProvider<ToolItem> {
vscode.env.clipboard.writeText(vdev?.ecid);
return;
}
if (toolObject.label === "Install deb") {
const options: vscode.OpenDialogOptions = {
canSelectMany: false,
canSelectFolders: false,
canSelectFiles: true,
openLabel: 'deb pls',
filters: {
'DEBIAN Package': ['deb']
}
};
vscode.window.showOpenDialog(options).then((uri) => {
if (uri === undefined || uri === null) {
return;
}
let selection = iDevices.shared.getDevice() as iDeviceItem;
iDeviceNodeProvider.nodeProvider.ensureiProxy(selection);
let terminal = vscode.window.createTerminal("Install DEB");
terminal.show();
let passpath = LKutils.shared.storagePath + "/" + LKutils.shared.makeid(10);
writeFileSync(passpath, selection.iSSH_password);
terminal.show();
let script = "#!/bin/bash\n";
let items = [];
items.push(" export SSHPASSWORD=$(cat \'" + passpath + "\')");
items.push(" rm -f \'" + passpath + "\'");
items.push(" ssh-keygen -R \"[127.0.0.1]:" + selection.iSSH_mappedPort + "\" &> /dev/null");
items.push(" sshpass -p $SSHPASSWORD ssh -oStrictHostKeyChecking=no -p " + selection.iSSH_mappedPort + " [email protected] \'rm -rf /var/mobile/Media/DEBIAN && mkdir -p /var/mobile/Media/DEBIAN\'");
uri.forEach((sel) => {
items.push(" sshpass -p $SSHPASSWORD scp -oStrictHostKeyChecking=no -r -P" + selection.iSSH_mappedPort + " \"" + sel.path + "\" \"[email protected]:/var/mobile/Media/DEBIAN\"");
});
items.push(" sshpass -p $SSHPASSWORD ssh -oStrictHostKeyChecking=no -p " + selection.iSSH_mappedPort + " [email protected] \'dpkg -i /var/mobile/Media/DEBIAN/*.deb\'");
items.forEach((line) => {
script += line + "\n";
});
let scriptpath = LKutils.shared.storagePath + "/" + LKutils.shared.makeid(10);
writeFileSync(scriptpath, script);
terminal.sendText(" chmod +x \"" + scriptpath + "\"");
terminal.sendText(" \"" + scriptpath + "\"");
});
return;
}
if (toolObject.label === "sbreload") {
iDeviceNodeProvider.nodeProvider.ensureiProxy(vdev);
iDevices.shared.executeOnDevice("sbreload");
return;
}
if (toolObject.label === "ldrestart") {
iDeviceNodeProvider.nodeProvider.ensureiProxy(vdev);
iDevices.shared.executeOnDevice("ldrestart &");
iDevices.shared.executeOnDevice("( ldrestart & )");
return;
}
if (toolObject.label === "Safemode") {
Expand Down

0 comments on commit a0bf218

Please sign in to comment.