Skip to content

Commit dafd67c

Browse files
authored
chore: cleanup and minor fixes + update requestly-core version (#112)
* fix: sentry init should not be run in a render process. was leading to annoying error logs * fix: adb Buffer to UInt8Array casting was breaking for some reason. Just using UInt8Array for now, needs to be tested * chore: cleanup and package updates
1 parent 92c1c2f commit dafd67c

File tree

9 files changed

+1847
-643
lines changed

9 files changed

+1847
-643
lines changed

package-lock.json

Lines changed: 1758 additions & 548 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,8 @@
242242
"sass-loader": "^12.2.0",
243243
"style-loader": "^3.3.0",
244244
"terser-webpack-plugin": "^5.2.4",
245-
"ts-jest": "^27.0.5",
246245
"ts-loader": "^9.2.6",
247-
"typescript": "^4.9.5",
246+
"typescript": "^5.6.3",
248247
"url-loader": "^4.1.1",
249248
"webpack": "^5.58.2",
250249
"webpack-bundle-analyzer": "^4.5.0",
@@ -255,10 +254,10 @@
255254
"dependencies": {
256255
"@devicefarmer/adbkit": "^3.2.6",
257256
"@electron/remote": "^2.1.2",
258-
"@requestly/requestly-core": "^1.0.4",
257+
"@requestly/requestly-core": "^1.0.5",
259258
"@requestly/requestly-proxy": "^1.3.2",
260259
"@sentry/browser": "^6.13.3",
261-
"@sentry/electron": "^2.5.4",
260+
"@sentry/electron": "^5.6.0",
262261
"address": "^2.0.3",
263262
"assert": "^2.0.0",
264263
"async": "^3.2.1",
@@ -306,8 +305,8 @@
306305
"yargs": "^17.2.1"
307306
},
308307
"devEngines": {
309-
"node": ">=14.x",
310-
"npm": ">=7.x"
308+
"node": ">=20.x",
309+
"npm": ">=9.x"
311310
},
312311
"browserslist": [],
313312
"prettier": {

src/main/actions/startBackgroundProcess.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable */
12
import { enable as enableWebContents } from "@electron/remote/main";
23
/** Babel */
34
require("core-js/stable");

src/main/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
1+
/* eslint-disable */
22
/* eslint global-require: off, no-console: off, promise/always-return: off */
33

44
/**
@@ -277,7 +277,6 @@ const createWindow = async () => {
277277
case 0:
278278
// Set flag to check next iteration
279279
trackEventViaWebApp(webAppWindow, EVENTS.QUIT_APP)
280-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
281280
// @ts-expect-error
282281
global.isQuitActionConfirmed = true;
283282
// Calling app.quit() would again invoke this function
Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,86 @@
1-
import { ISource, SSLProxyingJsonObj } from "lib/storage/types/ssl-proxying";
2-
import BaseConfigFetcher from "renderer/lib/proxy-interface/base";
3-
// TODO: @sahil fix this by adding type.d.ts file
4-
//@ts-ignore
5-
import { RULE_PROCESSOR } from "@requestly/requestly-core";
1+
// import { ISource, SSLProxyingJsonObj } from "lib/storage/types/ssl-proxying";
2+
// import BaseConfigFetcher from "renderer/lib/proxy-interface/base";
3+
// // TODO: @sahil fix this by adding type.d.ts file
4+
// //@ts-ignore
5+
// import { RULE_PROCESSOR } from "@requestly/requestly-core";
66

7-
class SSLProxyingManager {
8-
configFetcher: BaseConfigFetcher;
7+
// class SSLProxyingManager {
8+
// configFetcher: BaseConfigFetcher;
99

10-
constructor(configFetcher: BaseConfigFetcher) {
11-
this.configFetcher = configFetcher;
12-
}
10+
// constructor(configFetcher: BaseConfigFetcher) {
11+
// this.configFetcher = configFetcher;
12+
// }
1313

14-
isSslProxyingActive = (urlOrigin: string): boolean => {
15-
const config: SSLProxyingJsonObj = this.configFetcher.getConfig();
14+
// isSslProxyingActive = (urlOrigin: string): boolean => {
15+
// const config: SSLProxyingJsonObj = this.configFetcher.getConfig();
1616

17-
if (config.enabledAll === false) {
18-
const inclusionListSuccess: boolean = this.checkStatusWithInclusionList(
19-
config,
20-
urlOrigin
21-
);
22-
if (inclusionListSuccess) {
23-
console.log(`${urlOrigin} inclusion List`);
24-
return true;
25-
}
17+
// if (config.enabledAll === false) {
18+
// const inclusionListSuccess: boolean = this.checkStatusWithInclusionList(
19+
// config,
20+
// urlOrigin
21+
// );
22+
// if (inclusionListSuccess) {
23+
// console.log(`${urlOrigin} inclusion List`);
24+
// return true;
25+
// }
2626

27-
return false;
28-
} else {
29-
const exclusionListSuccess: boolean = this.checkStatusWithExclusionList(
30-
config,
31-
urlOrigin
32-
);
33-
if (exclusionListSuccess) {
34-
console.log(`${urlOrigin} exclusion List`);
35-
return false;
36-
}
27+
// return false;
28+
// } else {
29+
// const exclusionListSuccess: boolean = this.checkStatusWithExclusionList(
30+
// config,
31+
// urlOrigin
32+
// );
33+
// if (exclusionListSuccess) {
34+
// console.log(`${urlOrigin} exclusion List`);
35+
// return false;
36+
// }
3737

38-
return true;
39-
}
40-
};
38+
// return true;
39+
// }
40+
// };
4141

42-
checkStatusWithInclusionList = (
43-
config: SSLProxyingJsonObj,
44-
urlOrigin: string
45-
): boolean => {
46-
const inclusionListSources: ISource[] = Object.values(
47-
config.inclusionList || {}
48-
);
49-
return this.checkStatusWithList(inclusionListSources, urlOrigin);
50-
};
42+
// checkStatusWithInclusionList = (
43+
// config: SSLProxyingJsonObj,
44+
// urlOrigin: string
45+
// ): boolean => {
46+
// const inclusionListSources: ISource[] = Object.values(
47+
// config.inclusionList || {}
48+
// );
49+
// return this.checkStatusWithList(inclusionListSources, urlOrigin);
50+
// };
5151

52-
checkStatusWithExclusionList = (
53-
config: SSLProxyingJsonObj,
54-
urlOrigin: string
55-
): boolean => {
56-
const exclusionListSources: ISource[] = Object.values(
57-
config.exclusionList || {}
58-
);
59-
return this.checkStatusWithList(exclusionListSources, urlOrigin);
60-
};
52+
// checkStatusWithExclusionList = (
53+
// config: SSLProxyingJsonObj,
54+
// urlOrigin: string
55+
// ): boolean => {
56+
// const exclusionListSources: ISource[] = Object.values(
57+
// config.exclusionList || {}
58+
// );
59+
// return this.checkStatusWithList(exclusionListSources, urlOrigin);
60+
// };
6161

62-
checkStatusWithList = (
63-
sourceObjs: ISource[] = [],
64-
urlOrigin: string = ""
65-
): boolean => {
66-
return sourceObjs.some((sourceObj) =>
67-
this.checkStatusForSource(sourceObj, urlOrigin)
68-
);
69-
};
62+
// checkStatusWithList = (
63+
// sourceObjs: ISource[] = [],
64+
// urlOrigin: string = ""
65+
// ): boolean => {
66+
// return sourceObjs.some((sourceObj) =>
67+
// this.checkStatusForSource(sourceObj, urlOrigin)
68+
// );
69+
// };
7070

71-
checkStatusForSource = (
72-
sourceObject: ISource,
73-
urlOrigin: string
74-
): boolean => {
75-
const result = RULE_PROCESSOR.RuleMatcher.matchUrlWithRuleSource(
76-
sourceObject,
77-
urlOrigin
78-
);
79-
if (result === "") {
80-
return true;
81-
}
82-
return false;
83-
};
84-
}
71+
// checkStatusForSource = (
72+
// sourceObject: ISource,
73+
// urlOrigin: string
74+
// ): boolean => {
75+
// const result = RULE_PROCESSOR.RuleMatcher.matchUrlWithRuleSource(
76+
// sourceObject,
77+
// urlOrigin
78+
// );
79+
// if (result === "") {
80+
// return true;
81+
// }
82+
// return false;
83+
// };
84+
// }
8585

86-
export default SSLProxyingManager;
86+
// export default SSLProxyingManager;

src/renderer/actions/apps/mobile/adb-commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export async function hasCertInstalled(
5151
// Wait until it's clear that the read is successful
5252
const data = await new Promise<Buffer>((resolve, reject) => {
5353
// eslint-disable-next-line no-shadow
54-
const data: Buffer[] = [];
55-
certStream.on("data", (d: Buffer) => data.push(d));
54+
const data: Uint8Array[] = [];
55+
certStream.on("data", (d: Uint8Array) => data.push(d));
5656
certStream.on("end", () => resolve(Buffer.concat(data)));
5757

5858
certStream.on("error", reject);

src/renderer/actions/initEventHandlers.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@
22
import "core-js/stable";
33
import "regenerator-runtime/runtime";
44
// CORE
5-
import { ipcMain, ipcRenderer, shell } from "electron";
5+
import { ipcRenderer, shell } from "electron";
66
// ACTION
77
import startProxyServer from "./proxy/startProxyServer";
88
import getProxyConfig from "./proxy/getProxyConfig";
9-
import {
10-
areAppsActivatable,
11-
activateApp,
12-
deactivateApp,
13-
isAppActivatable,
14-
} from "./apps";
9+
import { activateApp, deactivateApp, isAppActivatable } from "./apps";
1510
import saveRootCert from "./saveRootCert";
1611
// STATE MANAGEMENT
1712
import { setState } from "./stateManagement";

src/renderer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ initGroupsCache();
2020
initEventHandlers();
2121
initAppManager();
2222

23-
import "../utils/sentryInit";
23+
// import "../utils/sentryInit";

src/utils/sentryInit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const preferenceManager = require("../renderer/utils/userPreferencesManager");
22
const isMain = process.type === "browser";
33

44
const { init } = isMain
5-
? require("@sentry/electron/dist/main")
6-
: require("@sentry/electron/dist/renderer");
5+
? require("@sentry/electron/main")
6+
: require("@sentry/electron/renderer");
77

88
let isErrorTrackingEnabled;
99

0 commit comments

Comments
 (0)