Skip to content

Commit

Permalink
chore: Bumped axios and using @steilerdev/axios-har-tracker fork beca…
Browse files Browse the repository at this point in the history
…use PR is not getting locked at
  • Loading branch information
Frank Steiler committed Nov 24, 2023
1 parent fbf4fd6 commit adc03b2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 50 deletions.
39 changes: 15 additions & 24 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@
"dependencies": {
"@backtrace/node": "^0.1.0",
"@foxt/js-srp": "^0.0.3-patch1",
"@steilerdev/axios-har-tracker": "^0.6.0",
"ajv": "^8.12.0",
"axios": "^1.2.2",
"axios-har-tracker": "^0.5.1",
"axios": "^1.6.2",
"chalk": "^5.0.0",
"cli-progress": "^3.11.2",
"commander": "^11.0.0",
Expand Down
27 changes: 3 additions & 24 deletions app/src/lib/resources/network-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {HEADER_KEYS, SigninResponse, COOKIE_KEYS, TrustResponse, SetupResponse,
import {Cookie} from "tough-cookie";
import {iCPSError} from "../../app/error/error.js";
import {RESOURCES_ERR} from "../../app/error/error-codes.js";
import {AxiosHarTracker} from "axios-har-tracker";
import {AxiosHarTracker} from "@steilerdev/axios-har-tracker";
import PQueue from "p-queue";
import {Resources} from "./main.js";
import {iCPSAppOptions} from "../../app/factory.js";
Expand Down Expand Up @@ -244,8 +244,7 @@ export class NetworkManager {
});

if (resources.enableNetworkCapture) {
this._harTracker = new AxiosHarTracker(this._axios as any);
this.resetHarTracker(this._harTracker);
this._harTracker = new AxiosHarTracker(this._axios as any, {name: Resources.PackageInfo.name, version: Resources.PackageInfo.version});
}

this._headerJar = new HeaderJar(this._axios);
Expand Down Expand Up @@ -274,30 +273,10 @@ export class NetworkManager {

if (Resources.manager().enableNetworkCapture) {
await this.writeHarFile();
this.resetHarTracker(this._harTracker);
this._harTracker.resetHar();
}
}

/**
* Resets the generated HAR file to make sure it does not grow too much while reusing the same instance
* Unfortunately the relevant members are private, so we have to cast it to any
* @param tracker - The AxiosHarTracker instance to reset
*/
resetHarTracker(tracker: AxiosHarTracker) {
(tracker as any).generatedHar = {
log: {
version: `1.2`,
creator: {
name: Resources.PackageInfo.name,
version: Resources.PackageInfo.version,
},
pages: [],
entries: [],
},
};
(tracker as any).newEntry = (this._harTracker as any).generateNewEntry();
}

/**
* Settles the rate limiter queue
* @see {@link settleQueue}
Expand Down

0 comments on commit adc03b2

Please sign in to comment.