@lvce-editor/main-process 6.37.14 → 6.37.16

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,5 +1,5 @@
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
4
  import { fileURLToPath, pathToFileURL } from 'node:url';
5
5
  import { inspect } from 'node:util';
@@ -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,46 @@ const handleBeforeQuit = () => {
3810
3816
  setShutDown();
3811
3817
  };
3812
3818
 
3819
+ const Base64 = 'base64';
3820
+
3821
+ const getSelectedStorageBackend = () => {
3822
+ return safeStorage.getSelectedStorageBackend();
3823
+ };
3824
+ const isEncryptionAvailable = () => {
3825
+ return safeStorage.isEncryptionAvailable();
3826
+ };
3827
+ const setUsePlainTextEncryption = usePlainText => {
3828
+ safeStorage.setUsePlainTextEncryption(usePlainText);
3829
+ };
3830
+ const encrypt = plainText => {
3831
+ return safeStorage.encryptString(plainText).toString(Base64);
3832
+ };
3833
+ const decrypt = encrypted => {
3834
+ const buffer = Buffer.from(encrypted, Base64);
3835
+ return safeStorage.decryptString(buffer);
3836
+ };
3837
+
3838
+ const hasPasswordStoreArgument = argv => {
3839
+ return argv.some(argument => argument === '--password-store' || argument.startsWith('--password-store='));
3840
+ };
3841
+ const ensurePersistentSecretStorage = argv => {
3842
+ if (!isLinux || isEncryptionAvailable()) {
3843
+ return true;
3844
+ }
3845
+ if (getSelectedStorageBackend() === 'basic_text') {
3846
+ setUsePlainTextEncryption(true);
3847
+ return true;
3848
+ }
3849
+ if (hasPasswordStoreArgument(argv)) {
3850
+ throw new Error('Persistent secret storage is unavailable');
3851
+ }
3852
+ relaunch({
3853
+ args: ['--password-store=basic', ...argv.slice(1)]
3854
+ });
3855
+ exit(Success);
3856
+ return false;
3857
+ };
3858
+
3813
3859
  const handleReady = async (parsedArgs, workingDirectory) => {
3814
3860
  await invoke('HandleElectronReady.handleElectronReady', parsedArgs, workingDirectory);
3815
3861
  };
@@ -4235,7 +4281,7 @@ const schedule = parsedCliArgs => {
4235
4281
  if (!parsedCliArgs[Wait10Seconds]) {
4236
4282
  return false;
4237
4283
  }
4238
- setTimeout(exit, exitDelay);
4284
+ setTimeout(exit$1, exitDelay);
4239
4285
  return true;
4240
4286
  };
4241
4287
 
@@ -4271,7 +4317,7 @@ const hydrate = async argv => {
4271
4317
  if (!isPromptMode$1) {
4272
4318
  const hasLock = requestSingleInstanceLock(argv);
4273
4319
  if (!hasLock) {
4274
- exit();
4320
+ exit$1();
4275
4321
  return;
4276
4322
  }
4277
4323
  }
@@ -4283,7 +4329,7 @@ const hydrate = async argv => {
4283
4329
  detached: true,
4284
4330
  stdio: 'ignore'
4285
4331
  });
4286
- exit$1(Success);
4332
+ exit$2(Success);
4287
4333
  }
4288
4334
 
4289
4335
  // command line switches
@@ -4298,6 +4344,9 @@ const hydrate = async argv => {
4298
4344
  on(WebContentsCreated, handleWebContentsCreated);
4299
4345
  on(SecondInstance, handleSecondInstance);
4300
4346
  await whenReady();
4347
+ if (!ensurePersistentSecretStorage(argv)) {
4348
+ return;
4349
+ }
4301
4350
  mark(AppReady);
4302
4351
  await handleReady(parsedCliArgs, cwd());
4303
4352
  };
@@ -5835,26 +5884,6 @@ const stop = id => {
5835
5884
  powerSaveBlocker.stop(id);
5836
5885
  };
5837
5886
 
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
5887
  const getWidth = () => {
5859
5888
  const primaryDisplay = screen.getPrimaryDisplay();
5860
5889
  return primaryDisplay.bounds.width;
@@ -7854,7 +7883,7 @@ const commandMap = {
7854
7883
  'ElectronWindow.getZoom': getZoom,
7855
7884
  'ElectronWindowGpuInfo.open': open,
7856
7885
  'ElectronWindowProcessExplorer.open2': open2,
7857
- 'Exit.exit': exit,
7886
+ 'Exit.exit': exit$1,
7858
7887
  'GetWindowId.getWindowId': getWindowId,
7859
7888
  'HandleElectronMessagePort.handleElectronMessagePort': handleElectronMessagePort,
7860
7889
  '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.14",
3
+ "version": "6.37.16",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"