Skip to content

Commit 3385534

Browse files
fix compilation issues
1 parent 1bfd76d commit 3385534

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
"prepublish": "npx tsc",
1010
"lint": "eslint '**/*.js' --fix",
1111
"prettier": "prettier '**/*.js' --write --single-quote",
12+
"clear-cache": "rm -rf $HOME/.cache/appium-interceptor-plugin",
1213
"uninstall": "export APPIUM_HOME=/tmp/some-temp-dir && (appium plugin uninstall appium-interceptor || exit 0)",
1314
"install-plugin": "export APPIUM_HOME=/tmp/some-temp-dir && npm run build && appium plugin install --source=local $(pwd)",
14-
"reinstall-plugin": "export APPIUM_HOME=/tmp/some-temp-dir && (appium plugin uninstall appium-interceptor || exit 0) && npm run install-plugin"
15+
"reinstall-plugin": "export APPIUM_HOME=/tmp/some-temp-dir && (appium plugin uninstall appium-interceptor || exit 0) && npm run install-plugin",
16+
"run-server": "export APPIUM_HOME=/tmp/some-temp-dir && appium server -ka 800 --use-plugins=appium-interceptor -pa /wd/hub "
1517
},
1618
"contributors": [
1719
{

src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class AppiumInterceptorPlugin extends BasePlugin {
6060
const proxy = proxyCache.get(sessionId);
6161
if (proxy) {
6262
const adb = driver.sessions[sessionId]?.adb;
63-
await configureWifiProxy(adb, proxy.getDeviceUDID(), false);
63+
await configureWifiProxy(adb, proxy.deviceUDID, false);
6464
await cleanUpProxyServer(proxy);
6565
}
6666
return next();
@@ -72,7 +72,7 @@ export class AppiumInterceptorPlugin extends BasePlugin {
7272
const proxy = proxyCache.get(sessionId);
7373
if (proxy) {
7474
const adb = driver.sessions[sessionId]?.adb;
75-
await configureWifiProxy(adb, proxy.getDeviceUDID(), false);
75+
await configureWifiProxy(adb, proxy.deviceUDID, false);
7676
await cleanUpProxyServer(proxy);
7777
}
7878
}

src/utils/adb.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@ export async function configureWifiProxy(
3232
proxy?: Proxy
3333
): Promise<string> {
3434
try {
35-
const host = proxy ? `${proxy.getIp()}:${proxy.getPort()}` : ':0';
35+
const host = proxy ? `${proxy.ip}:${proxy.port}` : ':0';
3636

3737
if (realDevice && proxy) {
38-
await adbExecWithDevice(adb, udid, [
39-
'reverse',
40-
`tcp:${proxy.getPort()}`,
41-
`tcp:${proxy.getPort()}`,
42-
]);
38+
await adbExecWithDevice(adb, udid, ['reverse', `tcp:${proxy.port}`, `tcp:${proxy.port}`]);
4339
}
4440

4541
return await adbExecWithDevice(adb, udid, [

src/utils/proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export async function setupProxyServer(
139139
export async function cleanUpProxyServer(proxy: Proxy) {
140140
await proxy.stop();
141141
// @ts-ignore
142-
fs.rmdirSync(proxy.getCertificatePath(), { recursive: true, force: true });
142+
fs.rmdirSync(proxy.certificatePath, { recursive: true, force: true });
143143
}
144144

145145
function prepareCertificate(sessionId: string) {

0 commit comments

Comments
 (0)