livedesk 0.1.606 → 0.1.607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/bin/livedesk-client.js +95 -49
- package/client/package.json +1 -1
- package/client/src/runtime/client-runtime-server.js +16 -8
- package/electron/main.mjs +83 -54
- package/package.json +2 -2
- package/web/dist/app.webmanifest +1 -1
- package/web/dist/assets/{LiveDeskApp-BoS9GSoS.js → LiveDeskApp-Dw86X0VP.js} +3 -3
- package/web/dist/assets/{index-BGB-rcGS.js → index-C4QRbhif.js} +2 -2
- package/web/dist/index.html +1 -1
- package/web/dist/livedesk-build-evidence.json +16 -16
- package/web/dist/sw.js +1 -1
|
@@ -80,11 +80,12 @@ const RETIRED_CLIENT_MODEL_SINGLE_OPTIONS = new Set(['--ai', '--no-ai', '--fake-
|
|
|
80
80
|
const RETIRED_CLIENT_MODEL_VALUE_OPTION = '--ai-model';
|
|
81
81
|
let activeAgentProcess = null;
|
|
82
82
|
let roleRestartRequest = null;
|
|
83
|
-
let agentRestartRequest = null;
|
|
84
|
-
let linuxVideoAccelerationStatus = null;
|
|
85
|
-
let discoveryWakeController = new AbortController();
|
|
86
|
-
let networkChangeMonitor = null;
|
|
87
|
-
|
|
83
|
+
let agentRestartRequest = null;
|
|
84
|
+
let linuxVideoAccelerationStatus = null;
|
|
85
|
+
let discoveryWakeController = new AbortController();
|
|
86
|
+
let networkChangeMonitor = null;
|
|
87
|
+
let desktopMainAuthSession = null;
|
|
88
|
+
const sessionRefreshesInFlight = new WeakMap();
|
|
88
89
|
const disposeAgentTerminationHandlers = installAgentTerminationHandlers({
|
|
89
90
|
getAgentProcess: () => activeAgentProcess
|
|
90
91
|
});
|
|
@@ -1097,8 +1098,11 @@ export function clearCachedHubTarget() {
|
|
|
1097
1098
|
}
|
|
1098
1099
|
}
|
|
1099
1100
|
|
|
1100
|
-
function readSavedSessionFromFile() {
|
|
1101
|
-
|
|
1101
|
+
function readSavedSessionFromFile() {
|
|
1102
|
+
if (isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) {
|
|
1103
|
+
return desktopMainAuthSession;
|
|
1104
|
+
}
|
|
1105
|
+
for (const path of [preferredClientAuthPath(), CLIENT_AUTH_PATH, UNIFIED_CLIENT_AUTH_PATH]) {
|
|
1102
1106
|
try {
|
|
1103
1107
|
const state = JSON.parse(readFileSync(path, 'utf8'));
|
|
1104
1108
|
const raw = state?.[CLIENT_AUTH_STORAGE_KEY];
|
|
@@ -1113,20 +1117,43 @@ function readSavedSessionFromFile() {
|
|
|
1113
1117
|
return null;
|
|
1114
1118
|
}
|
|
1115
1119
|
|
|
1116
|
-
function writeSavedSessionToFile(session) {
|
|
1117
|
-
const normalized = normalizeRuntimeAuthSession(session, { requireRefreshToken: true });
|
|
1118
|
-
if (!normalized.ok) {
|
|
1119
|
-
return false;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1120
|
+
function writeSavedSessionToFile(session) {
|
|
1121
|
+
const normalized = normalizeRuntimeAuthSession(session, { requireRefreshToken: true });
|
|
1122
|
+
if (!normalized.ok) {
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1125
|
+
if (isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) {
|
|
1126
|
+
return Boolean(desktopMainAuthSession?.access_token);
|
|
1127
|
+
}
|
|
1128
|
+
const storage = createFileStorage(preferredClientAuthPath());
|
|
1122
1129
|
storage.setItem(CLIENT_AUTH_STORAGE_KEY, JSON.stringify({ ...session, ...normalized.session }));
|
|
1123
1130
|
return true;
|
|
1124
1131
|
}
|
|
1125
1132
|
|
|
1126
|
-
function clearSavedSession() {
|
|
1127
|
-
|
|
1128
|
-
rmSync(
|
|
1129
|
-
}
|
|
1133
|
+
function clearSavedSession() {
|
|
1134
|
+
desktopMainAuthSession = null;
|
|
1135
|
+
rmSync(CLIENT_AUTH_PATH, { force: true });
|
|
1136
|
+
rmSync(UNIFIED_CLIENT_AUTH_PATH, { force: true });
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
export function acceptDesktopMainAuthSession(session) {
|
|
1140
|
+
if (!isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) return null;
|
|
1141
|
+
const normalized = normalizeRuntimeAuthSession(session, { requireRefreshToken: true });
|
|
1142
|
+
if (!normalized.ok) return null;
|
|
1143
|
+
desktopMainAuthSession = {
|
|
1144
|
+
...session,
|
|
1145
|
+
...normalized.session,
|
|
1146
|
+
user: {
|
|
1147
|
+
...(session?.user && typeof session.user === 'object' ? session.user : {}),
|
|
1148
|
+
...normalized.session.user
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
return desktopMainAuthSession;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
export function clearDesktopMainAuthSession() {
|
|
1155
|
+
desktopMainAuthSession = null;
|
|
1156
|
+
}
|
|
1130
1157
|
|
|
1131
1158
|
export async function fetchSupabaseWithDeadline(
|
|
1132
1159
|
input,
|
|
@@ -1167,22 +1194,28 @@ export async function fetchSupabaseWithDeadline(
|
|
|
1167
1194
|
}
|
|
1168
1195
|
}
|
|
1169
1196
|
|
|
1170
|
-
async function createSupabaseClient() {
|
|
1171
|
-
const { createClient } = await import('@supabase/supabase-js');
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1197
|
+
export async function createSupabaseClient() {
|
|
1198
|
+
const { createClient } = await import('@supabase/supabase-js');
|
|
1199
|
+
const desktopMainOwnsAuth = isTruthy(process.env.LIVEDESK_DESKTOP_HOST);
|
|
1200
|
+
return createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, {
|
|
1201
|
+
global: {
|
|
1202
|
+
fetch: fetchSupabaseWithDeadline
|
|
1203
|
+
},
|
|
1204
|
+
...(desktopMainOwnsAuth ? {
|
|
1205
|
+
// Electron Main rotates and encrypts the refresh token. The local
|
|
1206
|
+
// runtime receives only the current in-memory session and asks this
|
|
1207
|
+
// client to attach its access token to database requests.
|
|
1208
|
+
accessToken: async () => desktopMainAuthSession?.access_token || null
|
|
1209
|
+
} : { auth: {
|
|
1210
|
+
autoRefreshToken: false,
|
|
1211
|
+
persistSession: true,
|
|
1212
|
+
detectSessionInUrl: false,
|
|
1213
|
+
flowType: 'pkce',
|
|
1214
|
+
storageKey: CLIENT_AUTH_STORAGE_KEY,
|
|
1215
|
+
storage: createFileStorage(preferredClientAuthPath())
|
|
1216
|
+
} })
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1186
1219
|
|
|
1187
1220
|
function getNestedErrorCode(error) {
|
|
1188
1221
|
let cursor = error;
|
|
@@ -1313,8 +1346,12 @@ async function recoverRotatedSession(supabase, previousSession) {
|
|
|
1313
1346
|
return null;
|
|
1314
1347
|
}
|
|
1315
1348
|
|
|
1316
|
-
async function refreshSessionIfNeededCore(supabase) {
|
|
1317
|
-
|
|
1349
|
+
async function refreshSessionIfNeededCore(supabase) {
|
|
1350
|
+
if (isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) {
|
|
1351
|
+
const normalized = normalizeRuntimeAuthSession(desktopMainAuthSession, { requireRefreshToken: true });
|
|
1352
|
+
return normalized.ok ? desktopMainAuthSession : null;
|
|
1353
|
+
}
|
|
1354
|
+
let existingSession = null;
|
|
1318
1355
|
try {
|
|
1319
1356
|
const { data: existing } = await supabase.auth.getSession();
|
|
1320
1357
|
existingSession = existing?.session || null;
|
|
@@ -1382,12 +1419,17 @@ function openBrowser(url) {
|
|
|
1382
1419
|
spawn(command, [launchUrl.toString()], { detached: true, stdio: 'ignore' }).unref();
|
|
1383
1420
|
}
|
|
1384
1421
|
|
|
1385
|
-
async function activateSupabaseSession(supabase, session) {
|
|
1386
|
-
const normalized = normalizeRuntimeAuthSession(session, { requireRefreshToken: true });
|
|
1387
|
-
if (!normalized.ok) {
|
|
1388
|
-
throw new Error(normalized.error);
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1422
|
+
async function activateSupabaseSession(supabase, session) {
|
|
1423
|
+
const normalized = normalizeRuntimeAuthSession(session, { requireRefreshToken: true });
|
|
1424
|
+
if (!normalized.ok) {
|
|
1425
|
+
throw new Error(normalized.error);
|
|
1426
|
+
}
|
|
1427
|
+
if (isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) {
|
|
1428
|
+
const activeSession = acceptDesktopMainAuthSession(session);
|
|
1429
|
+
if (!activeSession) throw new Error('desktop-main-session-required');
|
|
1430
|
+
return activeSession;
|
|
1431
|
+
}
|
|
1432
|
+
const { data: current } = await supabase.auth.getSession();
|
|
1391
1433
|
if (current?.session?.access_token === normalized.session.access_token) {
|
|
1392
1434
|
const activeSession = current.session;
|
|
1393
1435
|
if (!writeSavedSessionToFile(activeSession)) {
|
|
@@ -3173,7 +3215,7 @@ async function startConnectionChoiceServer(supabase, options = {}) {
|
|
|
3173
3215
|
|
|
3174
3216
|
if (requestUrl.pathname === '/logout') {
|
|
3175
3217
|
try {
|
|
3176
|
-
await supabase.auth.signOut();
|
|
3218
|
+
await supabase.auth.signOut({ scope: 'local' });
|
|
3177
3219
|
} catch {
|
|
3178
3220
|
}
|
|
3179
3221
|
clearSavedSession();
|
|
@@ -3410,10 +3452,13 @@ async function chooseClientConnection(supabase, options = {}) {
|
|
|
3410
3452
|
roleVersion: process.env.LIVEDESK_ROLE_VERSION,
|
|
3411
3453
|
savedSession: options.savedSession,
|
|
3412
3454
|
loadSavedSession: options.loadSavedSession,
|
|
3413
|
-
initialChoice: options.initialChoice,
|
|
3414
|
-
initialChoiceMessage: options.initialChoiceMessage,
|
|
3415
|
-
|
|
3416
|
-
|
|
3455
|
+
initialChoice: options.initialChoice,
|
|
3456
|
+
initialChoiceMessage: options.initialChoiceMessage,
|
|
3457
|
+
onAuthSessionAccepted: acceptDesktopMainAuthSession,
|
|
3458
|
+
onAuthSessionCleared: clearDesktopMainAuthSession,
|
|
3459
|
+
beginGoogleSignIn: async redirectTo => {
|
|
3460
|
+
if (isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) throw new Error('desktop-main-auth-required');
|
|
3461
|
+
const activeSupabase = await getSupabase();
|
|
3417
3462
|
if (!activeSupabase?.auth) throw new Error('supabase-session-required');
|
|
3418
3463
|
const { data, error } = await activeSupabase.auth.signInWithOAuth({
|
|
3419
3464
|
provider: 'google',
|
|
@@ -3426,9 +3471,10 @@ async function chooseClientConnection(supabase, options = {}) {
|
|
|
3426
3471
|
if (error) throw error;
|
|
3427
3472
|
if (!data?.url) throw new Error('google-authorization-url-missing');
|
|
3428
3473
|
return { url: data.url };
|
|
3429
|
-
},
|
|
3430
|
-
exchangeGoogleCode: async code => {
|
|
3431
|
-
|
|
3474
|
+
},
|
|
3475
|
+
exchangeGoogleCode: async code => {
|
|
3476
|
+
if (isTruthy(process.env.LIVEDESK_DESKTOP_HOST)) throw new Error('desktop-main-auth-required');
|
|
3477
|
+
const activeSupabase = await getSupabase();
|
|
3432
3478
|
if (!activeSupabase?.auth) throw new Error('supabase-session-required');
|
|
3433
3479
|
const { data, error } = await activeSupabase.auth.exchangeCodeForSession(code);
|
|
3434
3480
|
if (error) throw error;
|
package/client/package.json
CHANGED
|
@@ -979,9 +979,13 @@ function writeSavedSession(session) {
|
|
|
979
979
|
return true;
|
|
980
980
|
}
|
|
981
981
|
|
|
982
|
-
function clearSavedSession() {
|
|
983
|
-
|
|
984
|
-
}
|
|
982
|
+
function clearSavedSession() {
|
|
983
|
+
if (process.env.LIVEDESK_DESKTOP_HOST === '1') {
|
|
984
|
+
rmSync(CLIENT_AUTH_PATH, { force: true });
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
writePrivateJsonAtomic(CLIENT_AUTH_PATH, {});
|
|
988
|
+
}
|
|
985
989
|
|
|
986
990
|
function readBody(req) {
|
|
987
991
|
return new Promise((resolveBody, reject) => {
|
|
@@ -1316,8 +1320,11 @@ export function createClientRuntimeServer(options = {}) {
|
|
|
1316
1320
|
runtime.emit('client.auth.session', { result: state.auth.lastResult, error: message });
|
|
1317
1321
|
};
|
|
1318
1322
|
|
|
1319
|
-
const complete = (choice, message = 'Client credentials accepted. Finding the Hub.') => {
|
|
1320
|
-
|
|
1323
|
+
const complete = (choice, message = 'Client credentials accepted. Finding the Hub.') => {
|
|
1324
|
+
if (choice?.session?.access_token) {
|
|
1325
|
+
options.onAuthSessionAccepted?.(choice.session);
|
|
1326
|
+
}
|
|
1327
|
+
lastChoice = choice || lastChoice;
|
|
1321
1328
|
if (completed) {
|
|
1322
1329
|
if (choice?.session?.access_token) {
|
|
1323
1330
|
const accountProfile = readClientAccountProfile(choice.session);
|
|
@@ -1634,9 +1641,10 @@ export function createClientRuntimeServer(options = {}) {
|
|
|
1634
1641
|
respondJson(200, { ok: true, authenticated: true, persisted: true, role: 'client' });
|
|
1635
1642
|
return;
|
|
1636
1643
|
}
|
|
1637
|
-
if (pathname === '/api/auth/session' && req.method === 'DELETE') {
|
|
1638
|
-
clearSavedSession();
|
|
1639
|
-
|
|
1644
|
+
if (pathname === '/api/auth/session' && req.method === 'DELETE') {
|
|
1645
|
+
clearSavedSession();
|
|
1646
|
+
options.onAuthSessionCleared?.();
|
|
1647
|
+
loggedOut = true;
|
|
1640
1648
|
completed = false;
|
|
1641
1649
|
lastChoice = null;
|
|
1642
1650
|
state.manager = '';
|
package/electron/main.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { spawn } from 'node:child_process';
|
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
7
|
import { createProductUpdateManager } from './update-manager.mjs';
|
|
8
8
|
import { createRecurringProductUpdateOwner } from './recurring-update-owner.mjs';
|
|
9
|
-
import { createPkceAuthorizationUrl, exchangePkceCode, fetchSupabaseUser, parsePkceCallbackUrl, refreshSupabaseSession } from './oauth-pkce.mjs';
|
|
9
|
+
import { AUTH_REQUEST_TIMEOUT_MS, createPkceAuthorizationUrl, exchangePkceCode, fetchSupabaseUser, parsePkceCallbackUrl, refreshSupabaseSession } from './oauth-pkce.mjs';
|
|
10
10
|
import { getRuntimeAuthEnvironment, resolveDesktopAuthConfig, resolveDesktopBuildFlavor } from './auth-config.mjs';
|
|
11
11
|
import { createBoundedDesktopLogger } from './bounded-desktop-log.mjs';
|
|
12
12
|
import {
|
|
@@ -671,46 +671,59 @@ async function prepareRuntimeForUpdateInstall() {
|
|
|
671
671
|
throw new Error('desktop-update-install-already-started');
|
|
672
672
|
}
|
|
673
673
|
updateInstallSequenceStarted = true;
|
|
674
|
-
isQuitting = true;
|
|
675
|
-
recurringProductUpdates?.stop();
|
|
676
|
-
try {
|
|
677
|
-
await
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
674
|
+
isQuitting = true;
|
|
675
|
+
recurringProductUpdates?.stop();
|
|
676
|
+
try {
|
|
677
|
+
await quiesceDesktopAuthOwner('desktop-update-install');
|
|
678
|
+
await stopRuntime();
|
|
679
|
+
} catch (error) {
|
|
680
|
+
updateInstallSequenceStarted = false;
|
|
681
|
+
isQuitting = false;
|
|
682
|
+
scheduleDesktopAuthRefresh(readEncryptedSession());
|
|
683
|
+
throw error;
|
|
684
|
+
}
|
|
683
685
|
}
|
|
684
686
|
|
|
685
687
|
async function recoverRuntimeAfterUpdateInstallError(error) {
|
|
686
688
|
log(`desktop update install launch failed after runtime drain: ${error?.message || error}`);
|
|
687
|
-
updateInstallSequenceStarted = false;
|
|
688
|
-
isQuitting = false;
|
|
689
|
-
|
|
689
|
+
updateInstallSequenceStarted = false;
|
|
690
|
+
isQuitting = false;
|
|
691
|
+
scheduleDesktopAuthRefresh(readEncryptedSession());
|
|
692
|
+
if (!runtimeChild) {
|
|
690
693
|
startRuntime();
|
|
691
694
|
const ready = await waitForRuntime();
|
|
692
695
|
if (ready) mainWindow?.loadURL(LOCAL_RUNTIME_URL);
|
|
693
696
|
}
|
|
694
697
|
}
|
|
695
698
|
|
|
696
|
-
async function syncSessionToRuntime(session) {
|
|
697
|
-
const normalized = normalizeSession(session);
|
|
698
|
-
if (!normalized) throw new Error('oauth-session-invalid');
|
|
699
|
-
const
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
699
|
+
async function syncSessionToRuntime(session) {
|
|
700
|
+
const normalized = normalizeSession(session);
|
|
701
|
+
if (!normalized) throw new Error('oauth-session-invalid');
|
|
702
|
+
const deadline = Date.now() + AUTH_REQUEST_TIMEOUT_MS + 2_500;
|
|
703
|
+
const csrfToken = await getRuntimeCsrfToken(Math.min(deadline, Date.now() + 2_500));
|
|
704
|
+
const response = await fetchBeforeRuntimeDeadline(
|
|
705
|
+
fetch,
|
|
706
|
+
`${LOCAL_RUNTIME_URL}api/auth/session`,
|
|
707
|
+
{
|
|
708
|
+
method: 'POST',
|
|
709
|
+
headers: {
|
|
710
|
+
'Content-Type': 'application/json',
|
|
711
|
+
...(csrfToken ? { 'X-LiveDesk-CSRF': csrfToken } : {})
|
|
712
|
+
},
|
|
713
|
+
body: JSON.stringify({
|
|
714
|
+
accessToken: normalized.access_token,
|
|
715
|
+
refreshToken: normalized.refresh_token,
|
|
716
|
+
expiresAt: normalized.expires_at,
|
|
717
|
+
userId: normalized.user?.id,
|
|
718
|
+
user: { id: normalized.user?.id, email: normalized.user?.email }
|
|
719
|
+
})
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
deadline,
|
|
723
|
+
maxDurationMs: Math.min(AUTH_REQUEST_TIMEOUT_MS, remainingRuntimeDeadlineMs(deadline)),
|
|
724
|
+
label: 'runtime-auth-sync-deadline'
|
|
725
|
+
}
|
|
726
|
+
);
|
|
714
727
|
if (!response.ok) {
|
|
715
728
|
const payload = await response.json().catch(() => ({}));
|
|
716
729
|
throw new Error(String(payload?.error || `runtime-session-sync-failed:${response.status}`));
|
|
@@ -854,18 +867,29 @@ async function restoreEncryptedSessionOwned({ syncRuntime = true } = {}) {
|
|
|
854
867
|
return session;
|
|
855
868
|
}
|
|
856
869
|
|
|
857
|
-
async function restoreEncryptedSession(options = {}) {
|
|
858
|
-
if (desktopSessionRestorePromise) return desktopSessionRestorePromise;
|
|
859
|
-
|
|
870
|
+
async function restoreEncryptedSession(options = {}) {
|
|
871
|
+
if (desktopSessionRestorePromise) return desktopSessionRestorePromise;
|
|
872
|
+
if (isQuitting) return readEncryptedSession();
|
|
873
|
+
const operation = restoreEncryptedSessionOwned(options);
|
|
860
874
|
desktopSessionRestorePromise = operation;
|
|
861
875
|
try {
|
|
862
876
|
return await operation;
|
|
863
877
|
} finally {
|
|
864
878
|
if (desktopSessionRestorePromise === operation) desktopSessionRestorePromise = null;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
async function
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
async function quiesceDesktopAuthOwner(reason = 'application-exit') {
|
|
883
|
+
clearDesktopAuthRefreshTimer();
|
|
884
|
+
while (desktopSessionRestorePromise) {
|
|
885
|
+
const pending = desktopSessionRestorePromise;
|
|
886
|
+
log(`waiting for secure auth owner before ${reason}`);
|
|
887
|
+
await pending;
|
|
888
|
+
if (desktopSessionRestorePromise === pending) break;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
async function signOutDesktopSession() {
|
|
869
893
|
desktopSessionEpoch += 1;
|
|
870
894
|
desktopAuthInvalidationGuard.observeSuccess();
|
|
871
895
|
clearEncryptedSession();
|
|
@@ -1071,19 +1095,21 @@ function registerIpc() {
|
|
|
1071
1095
|
if (quitSequenceStarted || updateInstallSequenceStarted) {
|
|
1072
1096
|
return { ok: false, error: 'application-exit-already-started' };
|
|
1073
1097
|
}
|
|
1074
|
-
quitSequenceStarted = true;
|
|
1075
|
-
isQuitting = true;
|
|
1076
|
-
try {
|
|
1077
|
-
await
|
|
1098
|
+
quitSequenceStarted = true;
|
|
1099
|
+
isQuitting = true;
|
|
1100
|
+
try {
|
|
1101
|
+
await quiesceDesktopAuthOwner('application-restart');
|
|
1102
|
+
await stopRuntime();
|
|
1078
1103
|
await desktopClipboardOwner?.close();
|
|
1079
1104
|
await closeDesktopLog();
|
|
1080
1105
|
app.relaunch();
|
|
1081
1106
|
app.exit(0);
|
|
1082
1107
|
return { ok: true };
|
|
1083
|
-
} catch (error) {
|
|
1084
|
-
isQuitting = false;
|
|
1085
|
-
quitSequenceStarted = false;
|
|
1086
|
-
|
|
1108
|
+
} catch (error) {
|
|
1109
|
+
isQuitting = false;
|
|
1110
|
+
quitSequenceStarted = false;
|
|
1111
|
+
scheduleDesktopAuthRefresh(readEncryptedSession());
|
|
1112
|
+
updateTray('Runtime cleanup blocked');
|
|
1087
1113
|
log(`runtime cleanup blocked application restart: ${error?.message || error}`);
|
|
1088
1114
|
if (!runtimeChild) {
|
|
1089
1115
|
startRuntime();
|
|
@@ -1277,19 +1303,22 @@ if (!app.requestSingleInstanceLock()) {
|
|
|
1277
1303
|
if (quitSequenceStarted) return;
|
|
1278
1304
|
event.preventDefault();
|
|
1279
1305
|
recurringProductUpdates?.stop();
|
|
1280
|
-
quitSequenceStarted = true;
|
|
1281
|
-
isQuitting = true;
|
|
1282
|
-
void
|
|
1283
|
-
return
|
|
1306
|
+
quitSequenceStarted = true;
|
|
1307
|
+
isQuitting = true;
|
|
1308
|
+
void quiesceDesktopAuthOwner('application-quit').then(() => {
|
|
1309
|
+
return stopRuntime();
|
|
1310
|
+
}).then(() => {
|
|
1311
|
+
return desktopClipboardOwner?.close();
|
|
1284
1312
|
}).then(() => {
|
|
1285
1313
|
return closeDesktopLog();
|
|
1286
1314
|
}).then(() => {
|
|
1287
1315
|
app.quit();
|
|
1288
1316
|
}).catch(error => {
|
|
1289
|
-
isQuitting = false;
|
|
1290
|
-
quitSequenceStarted = false;
|
|
1291
|
-
updateInstallSequenceStarted = false;
|
|
1292
|
-
|
|
1317
|
+
isQuitting = false;
|
|
1318
|
+
quitSequenceStarted = false;
|
|
1319
|
+
updateInstallSequenceStarted = false;
|
|
1320
|
+
scheduleDesktopAuthRefresh(readEncryptedSession());
|
|
1321
|
+
updateTray('Runtime cleanup blocked');
|
|
1293
1322
|
log(`runtime cleanup blocked application quit: ${error?.message || error}`);
|
|
1294
1323
|
});
|
|
1295
1324
|
});
|
package/package.json
CHANGED
package/web/dist/app.webmanifest
CHANGED