From 3450ca20763e91bb75c1e6191ac6c3c8dda39184 Mon Sep 17 00:00:00 2001 From: Mehmet Bektas Date: Fri, 27 Oct 2023 09:44:14 -0700 Subject: [PATCH] persist previously launched session data --- src/main/config/sessionconfig.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/config/sessionconfig.ts b/src/main/config/sessionconfig.ts index 5dbcf572..e51c8fc2 100644 --- a/src/main/config/sessionconfig.ts +++ b/src/main/config/sessionconfig.ts @@ -11,6 +11,7 @@ import { userSettings } from './settings'; import { ICLIArguments } from '../tokens'; +import { appData } from './appdata'; export class SessionConfig { x: number = 0; @@ -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 ); } }