Skip to content

Commit

Permalink
Merge pull request #566 from mbektas/fix-client-app-multi-window-issues
Browse files Browse the repository at this point in the history
fix multiple session issues with client app mode
  • Loading branch information
mbektas authored Feb 6, 2023
2 parents 7ac929b + 40d673b commit 428b314
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/labview/labview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ export class LabView implements IDisposable {
} else {
partition = `partition-${Date.now()}`;
}
} else if (
this._wsSettings.getValue(SettingType.frontEndMode) ===
FrontEndMode.ClientApp
) {
/*
use a dedicated partition (session) for client app mode, even though PDF
rendering doesn't work. without a dedicated session, intercepting buffer
protocol doesn't work since it is listening on the session object.
TODO: remove support for Client App mode.
*/
partition = `partition-${Date.now()}`;
}
this._view = new BrowserView({
webPreferences: {
Expand Down Expand Up @@ -334,8 +345,9 @@ export class LabView implements IDisposable {

private _unregisterBrowserEventHandlers() {
if (
!this._parent.window.isDestroyed() &&
this._wsSettings.getValue(SettingType.frontEndMode) ==
FrontEndMode.ClientApp
FrontEndMode.ClientApp
) {
this._view.webContents.session.protocol.uninterceptProtocol('http');
this._view.webContents.session.protocol.uninterceptProtocol('https');
Expand Down Expand Up @@ -446,7 +458,7 @@ export class LabView implements IDisposable {
): void {
if (req.url.startsWith(this.desktopAppAssetsPrefix)) {
this._handleDesktopAppAssetRequest(req, callback);
} else {
} else if (req.url.startsWith(this._sessionConfig.url.origin)) {
this._handleRemoteAssetRequest(req, callback);
}
}
Expand Down

0 comments on commit 428b314

Please sign in to comment.