Skip to content

Commit

Permalink
Merge pull request #724 from mbektas/fix-cli-remote-url-launch-persist
Browse files Browse the repository at this point in the history
persist previously launched remote session data when launched from CLI
  • Loading branch information
mbektas authored Oct 28, 2023
2 parents a771ebb + 3450ca2 commit 66d6b04
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/main/config/sessionconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
userSettings
} from './settings';
import { ICLIArguments } from '../tokens';
import { appData } from './appdata';

export class SessionConfig {
x: number = 0;
Expand Down Expand Up @@ -118,10 +119,26 @@ export class SessionConfig {
const strArg = arg.toString();
if (/^https?:\/\//.test(strArg)) {
const remoteURL = strArg;
const persistSessionData = cliArgs.persistSessionData === true;
let partition: string = undefined;

if (persistSessionData) {
const existing = appData.recentSessions.find(recentSession => {
return recentSession.remoteURL === remoteURL;
});
if (
existing &&
existing.persistSessionData &&
existing?.partition?.startsWith('persist:')
) {
partition = existing.partition;
}
}

return SessionConfig.createRemote(
remoteURL,
cliArgs.persistSessionData === true,
undefined
persistSessionData,
partition
);
}
}
Expand Down

0 comments on commit 66d6b04

Please sign in to comment.