@lvce-editor/main-process 6.37.13 → 6.37.15

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.
@@ -1,7 +1,7 @@
1
1
  import * as Electron from 'electron';
2
- import Electron__default, { dialog, app, clipboard, BrowserWindow, MessageChannelMain, Menu, shell, desktopCapturer, contentTracing, net, netLog, powerSaveBlocker, safeStorage, screen, webContents, WebContentsView } from 'electron';
2
+ import Electron__default, { dialog, app, clipboard, BrowserWindow, MessageChannelMain, Menu, safeStorage, shell, desktopCapturer, contentTracing, net, netLog, powerSaveBlocker, screen, webContents, WebContentsView } from 'electron';
3
3
  import process$1 from 'node:process';
4
- import { fileURLToPath } from 'node:url';
4
+ import { fileURLToPath, pathToFileURL } from 'node:url';
5
5
  import { inspect } from 'node:util';
6
6
  import { spawn } from 'node:child_process';
7
7
  import { Console } from 'node:console';
@@ -1657,7 +1657,7 @@ const setExitCode = code => {
1657
1657
  number(code);
1658
1658
  process.exitCode = code;
1659
1659
  };
1660
- const exit$1 = code => {
1660
+ const exit$2 = code => {
1661
1661
  number(code);
1662
1662
  process.exit(code);
1663
1663
  };
@@ -1722,7 +1722,7 @@ const handleUncaughtExceptionMonitor = (error$1, origin) => {
1722
1722
  error(prettyError.codeFrame);
1723
1723
  error(prettyError.stack);
1724
1724
  if (BrowserWindow.getAllWindows().length === 0) {
1725
- exit$1(Error$3);
1725
+ exit$2(Error$3);
1726
1726
  }
1727
1727
  };
1728
1728
 
@@ -1733,11 +1733,11 @@ const handleUnhandledRejection = (reason, promise) => {
1733
1733
  // @ts-ignore
1734
1734
  `[main process] unhandled rejection: ${prettyError.type}: ${prettyError.message}\n\n${prettyError.codeFrame}\n\n${prettyError.stack}\n`);
1735
1735
  if (BrowserWindow.getAllWindows().length === 0) {
1736
- exit$1(Error$3);
1736
+ exit$2(Error$3);
1737
1737
  }
1738
1738
  };
1739
1739
 
1740
- const exit = code => {
1740
+ const exit$1 = code => {
1741
1741
  if (code === undefined) {
1742
1742
  app.quit();
1743
1743
  return;
@@ -3552,11 +3552,11 @@ const requiresSocket = () => {
3552
3552
  };
3553
3553
 
3554
3554
  const handleChildError = error => {
3555
- exit$1(Error$3);
3555
+ exit$2(Error$3);
3556
3556
  };
3557
3557
  const handleChildExit = code => {
3558
3558
  info(`[main process] shared process exited with code ${code}`);
3559
- exit$1(code);
3559
+ exit$2(code);
3560
3560
  };
3561
3561
  const handleChildDisconnect = () => {
3562
3562
  info('[main process] shared process disconnected');
@@ -3659,7 +3659,7 @@ const handleCliArgs = async parsedArgs => {
3659
3659
  handleError(error);
3660
3660
  }
3661
3661
  } finally {
3662
- exit();
3662
+ exit$1();
3663
3663
  }
3664
3664
  };
3665
3665
 
@@ -3680,6 +3680,12 @@ const whenReady = () => {
3680
3680
  const appendCommandLineSwitch = (commandLineSwitch, value) => {
3681
3681
  app.commandLine.appendSwitch(commandLineSwitch, value);
3682
3682
  };
3683
+ const relaunch = options => {
3684
+ app.relaunch(options);
3685
+ };
3686
+ const exit = code => {
3687
+ app.exit(code);
3688
+ };
3683
3689
  const isPackagedDeb = () => {
3684
3690
  return app.isPackaged && process.platform === 'linux' && !process.env.APPIMAGE;
3685
3691
  };
@@ -3810,6 +3816,36 @@ const handleBeforeQuit = () => {
3810
3816
  setShutDown();
3811
3817
  };
3812
3818
 
3819
+ const Base64 = 'base64';
3820
+
3821
+ const isEncryptionAvailable = () => {
3822
+ return safeStorage.isEncryptionAvailable();
3823
+ };
3824
+ const encrypt = plainText => {
3825
+ return safeStorage.encryptString(plainText).toString(Base64);
3826
+ };
3827
+ const decrypt = encrypted => {
3828
+ const buffer = Buffer.from(encrypted, Base64);
3829
+ return safeStorage.decryptString(buffer);
3830
+ };
3831
+
3832
+ const hasPasswordStoreArgument = argv => {
3833
+ return argv.some(argument => argument === '--password-store' || argument.startsWith('--password-store='));
3834
+ };
3835
+ const ensurePersistentSecretStorage = argv => {
3836
+ if (!isLinux || isEncryptionAvailable()) {
3837
+ return true;
3838
+ }
3839
+ if (hasPasswordStoreArgument(argv)) {
3840
+ throw new Error('Persistent secret storage is unavailable');
3841
+ }
3842
+ relaunch({
3843
+ args: ['--password-store=basic', ...argv.slice(1)]
3844
+ });
3845
+ exit(Success);
3846
+ return false;
3847
+ };
3848
+
3813
3849
  const handleReady = async (parsedArgs, workingDirectory) => {
3814
3850
  await invoke('HandleElectronReady.handleElectronReady', parsedArgs, workingDirectory);
3815
3851
  };
@@ -4235,7 +4271,7 @@ const schedule = parsedCliArgs => {
4235
4271
  if (!parsedCliArgs[Wait10Seconds]) {
4236
4272
  return false;
4237
4273
  }
4238
- setTimeout(exit, exitDelay);
4274
+ setTimeout(exit$1, exitDelay);
4239
4275
  return true;
4240
4276
  };
4241
4277
 
@@ -4271,7 +4307,7 @@ const hydrate = async argv => {
4271
4307
  if (!isPromptMode$1) {
4272
4308
  const hasLock = requestSingleInstanceLock(argv);
4273
4309
  if (!hasLock) {
4274
- exit();
4310
+ exit$1();
4275
4311
  return;
4276
4312
  }
4277
4313
  }
@@ -4283,7 +4319,7 @@ const hydrate = async argv => {
4283
4319
  detached: true,
4284
4320
  stdio: 'ignore'
4285
4321
  });
4286
- exit$1(Success);
4322
+ exit$2(Success);
4287
4323
  }
4288
4324
 
4289
4325
  // command line switches
@@ -4298,6 +4334,9 @@ const hydrate = async argv => {
4298
4334
  on(WebContentsCreated, handleWebContentsCreated);
4299
4335
  on(SecondInstance, handleSecondInstance);
4300
4336
  await whenReady();
4337
+ if (!ensurePersistentSecretStorage(argv)) {
4338
+ return;
4339
+ }
4301
4340
  mark(AppReady);
4302
4341
  await handleReady(parsedCliArgs, cwd());
4303
4342
  };
@@ -5546,7 +5585,7 @@ const takeWorkerHeapSnapshot = async (windowId, workerName) => {
5546
5585
  electronDebugger.off('message', handleMessage);
5547
5586
  }
5548
5587
  success = true;
5549
- return filePath;
5588
+ return pathToFileURL(filePath).href;
5550
5589
  } finally {
5551
5590
  try {
5552
5591
  if (fileDescriptor !== undefined) {
@@ -5835,26 +5874,6 @@ const stop = id => {
5835
5874
  powerSaveBlocker.stop(id);
5836
5875
  };
5837
5876
 
5838
- const Base64 = 'base64';
5839
-
5840
- const ensureEncryptionAvailable = () => {
5841
- if (!safeStorage.isEncryptionAvailable() && isLinux) {
5842
- safeStorage.setUsePlainTextEncryption(true);
5843
- }
5844
- };
5845
- const isEncryptionAvailable = () => {
5846
- return safeStorage.isEncryptionAvailable();
5847
- };
5848
- const encrypt = plainText => {
5849
- ensureEncryptionAvailable();
5850
- return safeStorage.encryptString(plainText).toString(Base64);
5851
- };
5852
- const decrypt = encrypted => {
5853
- ensureEncryptionAvailable();
5854
- const buffer = Buffer.from(encrypted, Base64);
5855
- return safeStorage.decryptString(buffer);
5856
- };
5857
-
5858
5877
  const getWidth = () => {
5859
5878
  const primaryDisplay = screen.getPrimaryDisplay();
5860
5879
  return primaryDisplay.bounds.width;
@@ -7854,7 +7873,7 @@ const commandMap = {
7854
7873
  'ElectronWindow.getZoom': getZoom,
7855
7874
  'ElectronWindowGpuInfo.open': open,
7856
7875
  'ElectronWindowProcessExplorer.open2': open2,
7857
- 'Exit.exit': exit,
7876
+ 'Exit.exit': exit$1,
7858
7877
  'GetWindowId.getWindowId': getWindowId,
7859
7878
  'HandleElectronMessagePort.handleElectronMessagePort': handleElectronMessagePort,
7860
7879
  'IpcParent.create': create$1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.37.13",
3
+ "version": "6.37.15",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"