(context: vscode.ExtensionContext)
| 16 | import { smaliLsp } from "./tools/smali-lsp"; |
| 17 | |
| 18 | export function activate(context: vscode.ExtensionContext): void { |
| 19 | console.log("Activated apklab extension!"); |
| 20 | |
| 21 | // create apklabDataDir if it doesn't exist |
| 22 | if (!fs.existsSync(String(apklabDataDir))) { |
| 23 | fs.mkdirSync(apklabDataDir); |
| 24 | } |
| 25 | |
| 26 | // command for opening an apk file for decoding |
| 27 | const openApkFileCommand = vscode.commands.registerCommand( |
| 28 | "apklab.openApkFile", |
| 29 | async () => { |
| 30 | await checkAndInstallTools(); |
| 31 | await UI.openApkFile(); |
| 32 | }, |
| 33 | ); |
| 34 | |
| 35 | // command for rebuilding apk file |
| 36 | const rebuildAPkFileCommand = vscode.commands.registerCommand( |
| 37 | "apklab.rebuildApkFile", |
| 38 | async (uri: vscode.Uri) => { |
| 39 | await checkAndInstallTools(); |
| 40 | await UI.rebuildAPK(uri.fsPath); |
| 41 | }, |
| 42 | ); |
| 43 | |
| 44 | // command for installing apk file |
| 45 | const installAPkFileCommand = vscode.commands.registerCommand( |
| 46 | "apklab.installApkFile", |
| 47 | (uri: vscode.Uri) => adb.installAPK(uri.fsPath), |
| 48 | ); |
| 49 | |
| 50 | // command for rebuilding and installing the apk |
| 51 | const rebuildAndInstallAPkFileCommand = vscode.commands.registerCommand( |
| 52 | "apklab.rebuildAndInstallApkFile", |
| 53 | async (uri: vscode.Uri) => { |
| 54 | await checkAndInstallTools(); |
| 55 | await UI.rebuildAPK(uri.fsPath); |
| 56 | const parentPath = path.parse(uri.fsPath).dir; |
| 57 | const apkPath = path.join( |
| 58 | parentPath, |
| 59 | DIST_DIR, |
| 60 | apktool.getApkNameFromApkToolYaml(uri.fsPath), |
| 61 | ); |
| 62 | await adb.installAPK(apkPath); |
| 63 | }, |
| 64 | ); |
| 65 | |
| 66 | // command for patching files for https inspection |
| 67 | const patchApkForHttpsCommand = vscode.commands.registerCommand( |
| 68 | "apklab.patchApkForHttps", |
| 69 | (uri: vscode.Uri) => apkMitm.applyMitmPatches(uri.fsPath), |
| 70 | ); |
| 71 | |
| 72 | // command to empty apktool framework resource dir |
| 73 | const emptyFrameworkDirCommand = vscode.commands.registerCommand( |
| 74 | "apklab.emptyFrameworkDir", |
| 75 | async () => { |
nothing calls this directly
no test coverage detected