Skip to content

Commit a69c569

Browse files
author
stephanbuettig
committed
merge: resolve package.json/package-lock.json conflicts with upstream
Upstream bumped fast-xml-parser to ^5.7.0. Kept our fflate ^0.8.2 addition and regenerated package-lock.json.
2 parents 7b2e958 + 9f4d921 commit a69c569

23 files changed

Lines changed: 508 additions & 128 deletions

automation/webpack.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export default merge(common, {
168168
],
169169
'connect-src': [
170170
"'self'", 'data:',
171-
'http://127.0.0.1:45456', 'http://127.0.0.1:45457', 'ws://127.0.0.1:45456',
171+
'http://127.0.0.1:45456', 'http://127.0.0.1:45457', 'ws://127.0.0.1:45456', 'ws://127.0.0.1:45457',
172172
'https://*.httptoolkit.tech', 'https://*.ingest.us.sentry.io'
173173
],
174174
'report-uri': CSP_REPORT_URL,

package-lock.json

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

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"deserialize-error": "0.0.3",
9494
"dompurify": "^3.4.0",
9595
"fast-json-patch": "^3.1.1",
96-
"fast-xml-parser": "^5.5.7",
96+
"fast-xml-parser": "^5.7.0",
9797
"fflate": "^0.8.2",
9898
"graphql": "^15.8.0",
9999
"har-validator": "^5.1.3",
@@ -144,7 +144,6 @@
144144
"typesafe-get": "^2.1.1",
145145
"typescript": "^5.9.3",
146146
"ua-parser-js": "^0.7.33",
147-
"uuid": "^3.3.2",
148147
"xml-beautifier": "^0.4.0",
149148
"yaml": "^1.10.3"
150149
},

src/errors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as Sentry from '@sentry/browser';
2-
import * as uuid from 'uuid/v4';
32

43
import { UI_VERSION, serverVersion, desktopVersion } from './services/service-versions';
54
import { ApiError } from './services/server-api-types';
@@ -58,7 +57,7 @@ export function initSentry(dsn: string | undefined) {
5857
// We use a random id to distinguish between many errors in one session vs
5958
// one error in many sessions. This isn't persisted and can't be used to
6059
// identify anybody between sessions.
61-
const randomId = uuid();
60+
const randomId = crypto.randomUUID();
6261
Sentry.getCurrentScope().setUser({
6362
id: randomId,
6463
username: `anon-${randomId}`

src/model/account/account-store.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@ export class AccountStore {
100100
: undefined;
101101
}
102102

103+
// Expose the JWT directly, for delegating auth to remote services (e.g. HTK local server
104+
// for MCP, public endpoint cloud server).
105+
get userJwt(): string {
106+
if (this.isLoggedIn && this.accountDataLastUpdated !== Infinity) {
107+
// We read accountDataLastUpdated just to set up a subscription, so this will
108+
// re-calculate on each JWT update, since we can't observe localStorage directly.
109+
// It's never actually Infinity.
110+
111+
const jwt = localStorage.getItem('last_jwt');
112+
if (!jwt) throw new Error("No JWT found for logged in user");
113+
return jwt;
114+
} else {
115+
throw new Error("Can't get JWT for logged out user");
116+
}
117+
}
118+
103119
private updateUser = flow(function * (this: AccountStore) {
104120
this.user = yield getLatestUserData();
105121
this.accountDataLastUpdated = Date.now();

src/model/rules/rule-creation.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as _ from 'lodash';
2-
import * as uuid from 'uuid/v4'
32
import { observable } from 'mobx';
43
import {
54
matchers,
@@ -46,7 +45,7 @@ import * as RtcRule from './definitions/rtc-rule-definitions';
4645

4746
export function getNewRule(rulesStore: RulesStore): HtkRule {
4847
return observable({
49-
id: uuid(),
48+
id: crypto.randomUUID(),
5049
type: 'http', // New rules default to HTTP (i.e. they show HTTP step options)
5150
activated: true,
5251
matchers: [],
@@ -146,7 +145,7 @@ function buildRequestMatchers(request: HtkRequest) {
146145

147146
export function buildRuleFromRequest(rulesStore: RulesStore, request: HtkRequest): HtkRule {
148147
return {
149-
id: uuid(),
148+
id: crypto.randomUUID(),
150149
type: 'http',
151150
activated: true,
152151
matchers: buildRequestMatchers(request),
@@ -187,7 +186,7 @@ export function buildRuleFromExchange(exchange: HttpExchangeView): HtkRule {
187186
}
188187

189188
return {
190-
id: uuid(),
189+
id: crypto.randomUUID(),
191190
type: 'http',
192191
activated: true,
193192
matchers: buildRequestMatchers(exchange.request),

src/model/rules/rules-store.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as _ from 'lodash';
22

33
import {
4-
requestSteps,
54
MOCKTTP_PARAM_REF,
65
PassThroughStepConnectionOptions,
76
ProxySetting,
87
RuleParameterReference,
9-
ProxySettingSource,
10-
webSocketSteps
8+
ProxySettingSource
119
} from 'mockttp';
1210
import * as MockRTC from 'mockrtc';
1311

@@ -17,11 +15,9 @@ import {
1715
flow,
1816
computed,
1917
observe,
20-
when,
2118
reaction,
2219
runInAction
2320
} from 'mobx';
24-
import * as uuid from 'uuid/v4';
2521
import * as serializr from 'serializr';
2622
import { encode as encodeBase64, decode as decodeBase64 } from 'base64-arraybuffer';
2723
import * as semver from 'semver';
@@ -681,7 +677,7 @@ export class RulesStore {
681677
const targetItem = targetParent.items[targetIndex];
682678

683679
targetParent.items[targetIndex] = {
684-
id: uuid(),
680+
id: crypto.randomUUID(),
685681
title: "New group",
686682
items: [
687683
targetItem,

src/model/rules/rules-structure.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as _ from 'lodash';
2-
import * as uuid from 'uuid/v4'
32
import { observable } from 'mobx';
43

54
import { HtkRule } from './rules';
@@ -167,7 +166,7 @@ export function cloneRule<R extends HtkRule>(rule: R): R {
167166
return observable({
168167
...rule, // All handler/matcher/checker state is immutable
169168
matchers: [...rule.matchers], // Except the matcher array itself
170-
id: uuid() // And we need a different rule id
169+
id: crypto.randomUUID() // And we need a different rule id
171170
});
172171
};
173172

@@ -176,7 +175,7 @@ export function cloneRuleGroup<G extends HtkRuleGroup>(group: HtkRuleGroup): G {
176175
...group,
177176
items: group.items.map(i => cloneItem(i)),
178177
collapsed: true,
179-
id: uuid()
178+
id: crypto.randomUUID()
180179
} as G;
181180
}
182181

src/model/send/send-store.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as _ from 'lodash';
22
import { action, flow, observable, runInAction } from 'mobx';
3-
import * as uuid from 'uuid/v4';
43
import {
54
MOCKTTP_PARAM_REF,
65
ProxySetting,
@@ -77,7 +76,7 @@ export class SendStore {
7776
@action.bound
7877
addRequestInput(requestInput = new RequestInput()): RequestInput {
7978
const newSendRequest = observable({
80-
id: uuid(),
79+
id: crypto.randomUUID(),
8180
request: requestInput,
8281
sentExchange: undefined
8382
});
@@ -154,7 +153,7 @@ export class SendStore {
154153
sendRequest.pendingSend.promise.then(clearPending, clearPending);
155154
});
156155

157-
const exchangeId = uuid();
156+
const exchangeId = crypto.randomUUID();
158157

159158
const passthroughOptions = this.rulesStore.activePassthroughOptions;
160159

src/model/tls/failed-tls-connection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import * as uuid from 'uuid/v4';
2-
31
import { InputTlsFailure } from '../../types';
42
import { HTKEventBase } from '../events/event-base';
53

@@ -15,7 +13,7 @@ export class FailedTlsConnection extends HTKEventBase {
1513
.join('\n');
1614
}
1715

18-
readonly id = uuid();
16+
readonly id = crypto.randomUUID();
1917

2018
readonly upstreamHostname = this.failureEvent.tlsMetadata.sniHostname ??
2119
this.failureEvent.destination?.hostname ??

0 commit comments

Comments
 (0)