Skip to content

Commit 25f39de

Browse files
committed
Small code quality tweaks for Chrome & FF interceptors
1 parent 27d2e52 commit 25f39de

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/interceptors/fresh-chrome.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { HtkConfig } from '../config';
1010
import { getAvailableBrowsers, launchBrowser, BrowserInstance } from '../browsers';
1111
import { delay } from '../util';
1212
import { HideChromeWarningServer } from '../hide-chrome-warning-server';
13+
import { Interceptor } from '.';
1314

1415
const readFile = promisify(fs.readFile);
1516

@@ -25,7 +26,7 @@ const getChromeBrowserName = async (config: HtkConfig): Promise<string | undefin
2526
.value()[0];
2627
};
2728

28-
export class FreshChrome {
29+
export class FreshChrome implements Interceptor {
2930
id = 'fresh-chrome';
3031
version = '1.0.0';
3132

@@ -42,7 +43,7 @@ export class FreshChrome {
4243
async activate(proxyPort: number) {
4344
if (this.isActive(proxyPort)) return;
4445

45-
const certificatePem = await readFile(path.join(this.config.configPath, 'ca.pem'), 'utf8');
46+
const certificatePem = await readFile(this.config.https.certPath, 'utf8');
4647
const spkiFingerprint = generateSPKIFingerprint(certificatePem);
4748

4849
const hideWarningServer = new HideChromeWarningServer();

src/interceptors/fresh-firefox.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { HtkConfig } from '../config';
99
import { getAvailableBrowsers, launchBrowser, BrowserInstance } from '../browsers';
1010
import { CertCheckServer } from '../cert-check-server';
1111
import { delay } from '../util';
12+
import { Interceptor } from '.';
1213

1314
const deleteFolder = promisify(rimraf);
1415
const readFile = promisify(fs.readFile);
@@ -21,7 +22,7 @@ const FIREFOX_PREF_REGEX = /\w+_pref\("([^"]+)", (.*)\);/
2122

2223
let browsers: _.Dictionary<BrowserInstance> = {};
2324

24-
export class FreshFirefox {
25+
export class FreshFirefox implements Interceptor {
2526
id = 'fresh-firefox';
2627
version = '1.0.0';
2728

@@ -32,9 +33,9 @@ export class FreshFirefox {
3233
}
3334

3435
async isActivable() {
35-
const browsers = await getAvailableBrowsers(this.config.configPath);
36+
const availableBrowsers = await getAvailableBrowsers(this.config.configPath);
3637

37-
return _(browsers)
38+
return _(availableBrowsers)
3839
.map(b => b.name)
3940
.includes('firefox')
4041

0 commit comments

Comments
 (0)