@mcesystems/apple-kit 1.0.85 → 1.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +51 -7
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +51 -7
- package/dist/index.mjs.map +2 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -1182,9 +1182,9 @@ function throwIfAborted(signal) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
var { logTask, logInfo, setNamespace } = createLoggers("apple-kit:device");
|
|
1185
|
-
function
|
|
1185
|
+
function getLockdownPath() {
|
|
1186
1186
|
if (process.platform === "win32") {
|
|
1187
|
-
return (0, import_node_path.join)(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
|
|
1187
|
+
return process.env.LOCKDOWN_WINDOWS_PATH || (0, import_node_path.join)(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
|
|
1188
1188
|
}
|
|
1189
1189
|
if (process.platform === "darwin") {
|
|
1190
1190
|
return "/var/db/lockdown";
|
|
@@ -1278,7 +1278,7 @@ var DeviceActions = class {
|
|
|
1278
1278
|
}
|
|
1279
1279
|
async unpair() {
|
|
1280
1280
|
logInfo(`Un-pairing device ${this.udid}`);
|
|
1281
|
-
const lockdownDir =
|
|
1281
|
+
const lockdownDir = getLockdownPath();
|
|
1282
1282
|
if (!lockdownDir) {
|
|
1283
1283
|
throw new Error("Cannot determine lockdown directory for this platform");
|
|
1284
1284
|
}
|
|
@@ -37967,7 +37967,10 @@ var InstallActions = class {
|
|
|
37967
37967
|
return this.iosClient.installApp(ipaPath);
|
|
37968
37968
|
}
|
|
37969
37969
|
async installManagedApp(ipaPath, options) {
|
|
37970
|
+
const fs9f4 = require("node:fs");
|
|
37971
|
+
fs9f4.appendFileSync("debug-9f3919.log", JSON.stringify({ sessionId: "9f3919", location: "install.ts:installManagedApp:entry", message: "installManagedApp called", data: { ipaPath, udid: this.udid, options }, timestamp: Date.now(), hypothesisId: "C" }) + "\n");
|
|
37970
37972
|
const result = await this.iosClient.installApp(ipaPath);
|
|
37973
|
+
fs9f4.appendFileSync("debug-9f3919.log", JSON.stringify({ sessionId: "9f3919", location: "install.ts:installManagedApp:afterInstall", message: "iosClient.installApp returned", data: { exitCode: result.exitCode, stderr: result.raw.stderr.substring(0, 2e3), stdout: result.raw.stdout.substring(0, 2e3) }, timestamp: Date.now(), hypothesisId: "A" }) + "\n");
|
|
37971
37974
|
logInfo3("Installing app via MDM for management takeover");
|
|
37972
37975
|
const mdmClient = await createMDMClient();
|
|
37973
37976
|
if (!mdmClient) {
|
|
@@ -38010,7 +38013,8 @@ var ProxyActions = class {
|
|
|
38010
38013
|
childProcess = /* @__PURE__ */ new Map();
|
|
38011
38014
|
async startPortForward(localPort, devicePort) {
|
|
38012
38015
|
logInfo4(`Starting port forward ${localPort} -> ${devicePort} for device ${this.udid}`);
|
|
38013
|
-
const result =
|
|
38016
|
+
const result = this.iosClient.forward({ fromPort: localPort, toPort: devicePort });
|
|
38017
|
+
this.childProcess.set(this.udid, result);
|
|
38014
38018
|
return new Promise((resolve2, reject) => {
|
|
38015
38019
|
const timeout2 = setTimeout(() => {
|
|
38016
38020
|
reject(new Error("Port forwarding timed out"));
|
|
@@ -38653,6 +38657,8 @@ var IosClient = class {
|
|
|
38653
38657
|
}
|
|
38654
38658
|
spawnIosCommand(args) {
|
|
38655
38659
|
logTask4(`Running command: ${this.iosPath} ${args.join(" ")}`);
|
|
38660
|
+
const fs9f3 = require("node:fs");
|
|
38661
|
+
fs9f3.appendFileSync("debug-9f3919.log", JSON.stringify({ sessionId: "9f3919", location: "iosClient.ts:spawnIosCommand", message: "spawning ios command", data: { iosPath: this.iosPath, args, USBMUXD_SOCKET_ADDRESS: this.usbmuxdAddress, command: args[0] }, timestamp: Date.now(), hypothesisId: "D" }) + "\n");
|
|
38656
38662
|
const child = (0, import_node_child_process.spawn)(this.iosPath, args, {
|
|
38657
38663
|
windowsHide: true,
|
|
38658
38664
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -38753,14 +38759,52 @@ var IosClient = class {
|
|
|
38753
38759
|
async pair() {
|
|
38754
38760
|
return this.runIosCommand(["pair", "--udid", this.udid]);
|
|
38755
38761
|
}
|
|
38756
|
-
|
|
38762
|
+
forward({ fromPort, toPort }) {
|
|
38757
38763
|
return this.spawnIosCommand(["forward", `--port=${fromPort}:${toPort}`, "--udid", this.udid]);
|
|
38758
38764
|
}
|
|
38759
38765
|
async info() {
|
|
38760
|
-
|
|
38766
|
+
const fs9f2 = require("node:fs");
|
|
38767
|
+
fs9f2.appendFileSync("debug-9f3919.log", JSON.stringify({ sessionId: "9f3919", location: "iosClient.ts:info:entry", message: "info called (working command for comparison)", data: { udid: this.udid, usbmuxdAddress: this._usbmuxdAddress }, timestamp: Date.now(), hypothesisId: "E" }) + "\n");
|
|
38768
|
+
const result = await this.runIosCommand(["info", "--udid", this.udid]);
|
|
38769
|
+
fs9f2.appendFileSync("debug-9f3919.log", JSON.stringify({ sessionId: "9f3919", location: "iosClient.ts:info:result", message: "info completed (working command for comparison)", data: { exitCode: result.exitCode, hasOutput: result.output.length > 0, stderr: result.raw.stderr.substring(0, 500) }, timestamp: Date.now(), hypothesisId: "E" }) + "\n");
|
|
38770
|
+
return result;
|
|
38761
38771
|
}
|
|
38762
38772
|
async installApp(ipaPath) {
|
|
38763
|
-
|
|
38773
|
+
const fs9f = require("node:fs");
|
|
38774
|
+
const path9f = require("node:path");
|
|
38775
|
+
const lockdownApple = path9f.join(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
|
|
38776
|
+
const lockdownCustom = process.env.LOCKDOWN_WINDOWS_PATH || "";
|
|
38777
|
+
const appleSysCfgPath = path9f.join(lockdownApple, "SystemConfiguration.plist");
|
|
38778
|
+
const customSysCfgPath = lockdownCustom ? path9f.join(lockdownCustom, "SystemConfiguration.plist") : "";
|
|
38779
|
+
const appleDevPath = path9f.join(lockdownApple, this.udid + ".plist");
|
|
38780
|
+
const customDevPath = lockdownCustom ? path9f.join(lockdownCustom, this.udid + ".plist") : "";
|
|
38781
|
+
const readPlistBuid = (p) => {
|
|
38782
|
+
try {
|
|
38783
|
+
const c = fs9f.readFileSync(p, "utf8");
|
|
38784
|
+
const m = c.match(/SystemBUID<\/key>\s*<string>([^<]+)<\/string>/);
|
|
38785
|
+
return m ? m[1] : "NOT_FOUND_IN_XML";
|
|
38786
|
+
} catch (e) {
|
|
38787
|
+
return "READ_ERROR:" + e.message;
|
|
38788
|
+
}
|
|
38789
|
+
};
|
|
38790
|
+
const readPlistHostId = (p) => {
|
|
38791
|
+
try {
|
|
38792
|
+
const c = fs9f.readFileSync(p, "utf8");
|
|
38793
|
+
const m = c.match(/HostID<\/key>\s*<string>([^<]+)<\/string>/);
|
|
38794
|
+
return m ? m[1] : "NOT_FOUND_IN_XML";
|
|
38795
|
+
} catch (e) {
|
|
38796
|
+
return "READ_ERROR:" + e.message;
|
|
38797
|
+
}
|
|
38798
|
+
};
|
|
38799
|
+
const appleBuid = readPlistBuid(appleSysCfgPath);
|
|
38800
|
+
const customBuid = customSysCfgPath ? readPlistBuid(customSysCfgPath) : "N/A";
|
|
38801
|
+
const appleHostId = readPlistHostId(appleDevPath);
|
|
38802
|
+
const customHostId = customDevPath ? readPlistHostId(customDevPath) : "N/A";
|
|
38803
|
+
const buidMatch = appleBuid === customBuid;
|
|
38804
|
+
fs9f.appendFileSync(path9f.join(process.cwd(), "debug-9f3919.log"), JSON.stringify({ sessionId: "9f3919", location: "iosClient.ts:installApp:lockdown-buid-compare", message: "SystemBUID and HostID comparison", data: { appleBuid, customBuid, buidMatch, appleHostId, customHostId, hostIdMatch: appleHostId === customHostId, usbmuxdAddress: this._usbmuxdAddress }, timestamp: Date.now(), hypothesisId: "F" }) + "\n");
|
|
38805
|
+
const result = await this.runIosCommand(["install", `--path=${ipaPath}`, "--udid", this.udid]);
|
|
38806
|
+
fs9f.appendFileSync(path9f.join(process.cwd(), "debug-9f3919.log"), JSON.stringify({ sessionId: "9f3919", location: "iosClient.ts:installApp:result", message: "installApp completed", data: { exitCode: result.exitCode, stderr: result.raw.stderr.substring(0, 2e3), stdout: result.raw.stdout.substring(0, 2e3) }, timestamp: Date.now(), hypothesisId: "A" }) + "\n");
|
|
38807
|
+
return result;
|
|
38764
38808
|
}
|
|
38765
38809
|
async uninstallApp(bundleId) {
|
|
38766
38810
|
return this.runIosCommand(["uninstall", bundleId, "--udid", this.udid]);
|