Skip to content

Commit 7030d96

Browse files
committed
refactor: rename browser routing subresources config
Shorten the browserRouting allowlist field to subresources so the direct-to-VM configuration reads more cleanly without changing behavior. Made-with: Cursor
1 parent 2082705 commit 7030d96

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

examples/browser-routing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async function main() {
44
const kernel = new Kernel({
55
browserRouting: {
66
enabled: true,
7-
directToVMSubresources: ['computer'],
7+
subresources: ['computer'],
88
},
99
});
1010

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export class Kernel {
330330
options.browserRouting?.enabled ?
331331
createRoutingFetch(this.rawFetch, {
332332
apiBaseURL: this.baseURL,
333-
directToVMSubresources: options.browserRouting.directToVMSubresources ?? [],
333+
subresources: options.browserRouting.subresources ?? [],
334334
cache: this.browserRouteCache,
335335
})
336336
: this.rawFetch;

src/lib/browser-routing.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type BrowserRoute = {
99

1010
export interface BrowserRoutingOptions {
1111
enabled?: boolean;
12-
directToVMSubresources?: string[] | undefined;
12+
subresources?: string[] | undefined;
1313
cache?: BrowserRouteCache | undefined;
1414
}
1515

@@ -41,15 +41,15 @@ export function createRoutingFetch(
4141
innerFetch: Fetch,
4242
{
4343
apiBaseURL,
44-
directToVMSubresources,
44+
subresources,
4545
cache,
4646
}: {
4747
apiBaseURL: string;
48-
directToVMSubresources: Iterable<string>;
48+
subresources: Iterable<string>;
4949
cache: BrowserRouteCache;
5050
},
5151
): Fetch {
52-
const allowed = new Set([...directToVMSubresources].map((value) => value.trim()).filter(Boolean));
52+
const allowed = new Set([...subresources].map((value) => value.trim()).filter(Boolean));
5353
const apiOrigin = new URL(apiBaseURL).origin;
5454

5555
return async (input, init) => {

tests/lib/browser-routing.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('browser routing', () => {
1111
baseURL: 'https://api.example/',
1212
browserRouting: {
1313
enabled: true,
14-
directToVMSubresources: ['process', 'curl'],
14+
subresources: ['process', 'curl'],
1515
},
1616
fetch: async (input, init?: RequestInit) => {
1717
const url = normalizeURL(input);
@@ -48,7 +48,7 @@ describe('browser routing', () => {
4848
baseURL: 'https://api.example/',
4949
browserRouting: {
5050
enabled: true,
51-
directToVMSubresources: ['computer'],
51+
subresources: ['computer'],
5252
},
5353
fetch: async (input) => {
5454
const url = normalizeURL(input);
@@ -77,7 +77,7 @@ describe('browser routing', () => {
7777
baseURL: 'https://api.example/',
7878
browserRouting: {
7979
enabled: true,
80-
directToVMSubresources: ['process'],
80+
subresources: ['process'],
8181
},
8282
fetch: async (input) => {
8383
const url = normalizeURL(input);
@@ -110,7 +110,7 @@ describe('browser routing', () => {
110110
baseURL: 'https://api.example/',
111111
browserRouting: {
112112
enabled: true,
113-
directToVMSubresources: ['process'],
113+
subresources: ['process'],
114114
},
115115
fetch: async (input) => {
116116
const url = normalizeURL(input);

0 commit comments

Comments
 (0)