Skip to content

Commit

Permalink
Merge branch 'main' into cmead/enable-more-web-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
testlabauto committed Sep 30, 2024
2 parents e66b284 + 659e073 commit 2218705
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 18 deletions.
12 changes: 4 additions & 8 deletions build/secrets/.secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": "build/secrets/.secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
},
{
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
},
Expand Down Expand Up @@ -905,23 +901,23 @@
"filename": "src/vs/server/node/webClientServer.ts",
"hashed_secret": "66e26ed510af41f1d322d1ebda4389302f4a03c7",
"is_verified": false,
"line_number": 445,
"line_number": 450,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "src/vs/server/node/webClientServer.ts",
"hashed_secret": "f769de45d1747b634dfe3d7eb842f6967c4c5e98",
"is_verified": false,
"line_number": 445,
"line_number": 450,
"is_secret": false
},
{
"type": "Base64 High Entropy String",
"filename": "src/vs/server/node/webClientServer.ts",
"hashed_secret": "93f2efffc36c6e096cdb21d6aadb7087dc0d7478",
"is_verified": false,
"line_number": 452,
"line_number": 457,
"is_secret": false
}
],
Expand Down Expand Up @@ -1912,5 +1908,5 @@
}
]
},
"generated_at": "2024-09-11T23:58:52Z"
"generated_at": "2024-09-26T21:49:10Z"
}
7 changes: 6 additions & 1 deletion src/vs/server/node/webClientServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ export class WebClientServer {
}
// --- PWB Start: Server proxy support ---
if (kProxyRegex.test(pathname)) {
const path: string = pathname.replace('/proxy/', 'http://0.0.0.0:');
let path: string = pathname.replace('/proxy/', 'http://0.0.0.0:');

// Append query string if it exists
if (parsedUrl.search) {
path = path.concat(parsedUrl.search);
}

return this._proxyServer.web(req, res, {
ignorePath: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { localize } from 'vs/nls';
import { FileAccess } from 'vs/base/common/network';
import { join } from 'vs/base/common/path';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { ILogService } from 'vs/platform/log/common/log';
Expand Down Expand Up @@ -649,6 +650,7 @@ class PositronHelpService extends Disposable implements IPositronHelpService {
sourceUrl.protocol = proxyServerOriginUrl.protocol;
sourceUrl.hostname = proxyServerOriginUrl.hostname;
sourceUrl.port = proxyServerOriginUrl.port;
sourceUrl.pathname = join(proxyServerOriginUrl.pathname, targetUrl.pathname);

// Basically this can't happen.
if (!session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ActivityItemStream {
/**
* Gets the ActivityItemStream array.
*/
private activityItemStreams: ActivityItemStream[] = [];
private activityItemStreams: this[] = [];

/**
* Gets the ANSIOutput that is processing this ActivityItemStream.
Expand Down Expand Up @@ -47,12 +47,17 @@ export class ActivityItemStream {

/**
* Constructor.
*
* Never to be called directly.
* Internally, use `newActivityItemStream()` instead.
* Externally, use `ActivityItemOutputStream` or `ActivityItemErrorStream` constructors instead.
*
* @param id The identifier.
* @param parentId The parent identifier.
* @param when The date.
* @param text The text.
*/
constructor(
protected constructor(
readonly id: string,
readonly parentId: string,
readonly when: Date,
Expand All @@ -70,9 +75,7 @@ export class ActivityItemStream {
* @param activityItemStream The ActivityItemStream to add.
* @returns The remainder ActivityItemStream, or undefined.
*/
public addActivityItemStream(
activityItemStream: ActivityItemStream
): ActivityItemStream | undefined {
public addActivityItemStream(activityItemStream: this): this | undefined {
// If this ActivityItemStream is terminated, copy its styles to the ActivityItemStream being
// added and return it as the remainder ActivityItemStream to be processed.
if (this.terminated) {
Expand All @@ -95,7 +98,7 @@ export class ActivityItemStream {
const remainderText = activityItemStream.text.substring(newlineIndex + 1);

// Add an ActivityItemStream with the text containing the newline.
this.activityItemStreams.push(new ActivityItemStream(
this.activityItemStreams.push(this.newActivityItemStream(
activityItemStream.id,
activityItemStream.parentId,
activityItemStream.when,
Expand All @@ -116,7 +119,7 @@ export class ActivityItemStream {
}

// Create the remainder ActivityItemStream.
activityItemStream = new ActivityItemStream(
activityItemStream = this.newActivityItemStream(
activityItemStream.id,
activityItemStream.parentId,
activityItemStream.when,
Expand Down Expand Up @@ -153,15 +156,53 @@ export class ActivityItemStream {
}
}

/**
* Polymorphic constructor for internal creation of new `ActivityItemStream`s
*
* Uses polymorphic `this` to actually return extension class types, like
* `ActivityItemOutputStream` and `ActivityItemErrorStream`.
*
* Note that we have to manually cast `this.constructor()` to the right type, as otherwise
* it is just a generic `Function`.
* https://github.com/microsoft/TypeScript/issues/3841
* https://stackoverflow.com/questions/64638771/how-can-i-create-a-new-instance-of-a-class-using-this-from-within-method
*
* @param id The identifier.
* @param parentId The parent identifier.
* @param when The date.
* @param text The text.
* @returns A newly constructed activity item stream of type `this`.
*/
private newActivityItemStream(
id: string,
parentId: string,
when: Date,
text: string
): this {
const constructor = (
this.constructor as
new (id: string, parentId: string, when: Date, text: string) => this
);
return new constructor(id, parentId, when, text);
}

//#endregion Private Methods
}

/**
* ActivityItemOutputStream class.
*/
export class ActivityItemOutputStream extends ActivityItemStream { }
export class ActivityItemOutputStream extends ActivityItemStream {
constructor(id: string, parentId: string, when: Date, text: string) {
super(id, parentId, when, text);
}
}

/**
* ActivityItemErrorStream class.
*/
export class ActivityItemErrorStream extends ActivityItemStream { }
export class ActivityItemErrorStream extends ActivityItemStream {
constructor(id: string, parentId: string, when: Date, text: string) {
super(id, parentId, when, text);
}
}

0 comments on commit 2218705

Please sign in to comment.