@bryce3310687963/android-toolkit 1.0.55 → 1.0.56
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/README.md +6 -0
- package/dist/index.cjs +12 -4
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +12 -4
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -883,9 +883,16 @@ async function adbExec(ctx, args, options = {}) {
|
|
|
883
883
|
const startedAt = Date.now();
|
|
884
884
|
try {
|
|
885
885
|
const { stdout } = await execAdbWithRetry(adbPath, args, options);
|
|
886
|
-
Logger.useTemplate().adbExec({ duration: Logger.duration(startedAt), args: compactArgs(args) });
|
|
886
|
+
Logger.useTemplate().adbExec({ duration: Logger.duration(startedAt), args: options.sensitive ? "[REDACTED]" : compactArgs(args) });
|
|
887
887
|
return stdout;
|
|
888
888
|
} catch (error) {
|
|
889
|
+
if (options.sensitive) {
|
|
890
|
+
throw new CrawlerError({
|
|
891
|
+
message: "ADB command failed (sensitive content omitted)",
|
|
892
|
+
code: isAdbUnavailableError(error) ? Code.AdbUnavailable : Code.AutomationFailed,
|
|
893
|
+
context: { adbPath }
|
|
894
|
+
});
|
|
895
|
+
}
|
|
889
896
|
if (isAdbUnavailableError(error)) {
|
|
890
897
|
throw new CrawlerError({
|
|
891
898
|
message: `adb_unavailable: ${error?.message || String(error)}`,
|
|
@@ -914,7 +921,8 @@ async function writeCacheFile(ctx, options = {}) {
|
|
|
914
921
|
].join(" && ");
|
|
915
922
|
await Device.adbShell(ctx, [`su -c ${shellQuoteForRemote(command)}`], {
|
|
916
923
|
timeoutMs: Number(options.timeoutMs || 1e4),
|
|
917
|
-
maxBuffer: Number(options.maxBuffer || 1024)
|
|
924
|
+
maxBuffer: Number(options.maxBuffer || 1024),
|
|
925
|
+
sensitive: true
|
|
918
926
|
});
|
|
919
927
|
return filePath;
|
|
920
928
|
}
|
|
@@ -1238,8 +1246,8 @@ async function execAdbWithRetry(adbPath, args, options = {}) {
|
|
|
1238
1246
|
label: options.label || "adb",
|
|
1239
1247
|
attempt,
|
|
1240
1248
|
attempts,
|
|
1241
|
-
args: compactArgs(args),
|
|
1242
|
-
message: error?.message || String(error)
|
|
1249
|
+
args: options.sensitive ? "[REDACTED]" : compactArgs(args),
|
|
1250
|
+
message: options.sensitive ? "sensitive ADB command failed" : error?.message || String(error)
|
|
1243
1251
|
});
|
|
1244
1252
|
await sleep(delayMs * attempt);
|
|
1245
1253
|
}
|