@lvce-editor/main-process 6.37.6 → 6.37.8

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.
@@ -4749,6 +4749,7 @@ const getCorsResponseHeaders = (responseHeaders = {}) => {
4749
4749
 
4750
4750
  const ClipBoardRead = 'clipboard-read';
4751
4751
  const ClipBoardSanitizedWrite = 'clipboard-sanitized-write';
4752
+ const FileSystem = 'fileSystem';
4752
4753
  const FullScreen = 'fullscreen';
4753
4754
  const GeoLocation = 'geolocation';
4754
4755
  const Media = 'media';
@@ -6439,12 +6440,12 @@ const resolveWithTimeout = async (fetcher, favicons) => {
6439
6440
  clearTimeout(timeout);
6440
6441
  }
6441
6442
  };
6442
- const resolveFavicon = async (event, favicons) => {
6443
+ const resolveFavicon = async (webContents, favicons) => {
6443
6444
  const dataUrl = favicons.find(favicon => favicon.startsWith('data:'));
6444
6445
  if (dataUrl) {
6445
6446
  return [dataUrl];
6446
6447
  }
6447
- const sessionFavicon = await resolveWithTimeout((url, options) => event.sender.session.fetch(url, options), favicons);
6448
+ const sessionFavicon = await resolveWithTimeout((url, options) => webContents.session.fetch(url, options), favicons);
6448
6449
  if (sessionFavicon) {
6449
6450
  return [sessionFavicon];
6450
6451
  }
@@ -6459,14 +6460,14 @@ const resolveNetworkFavicon = async favicons => {
6459
6460
  const networkFavicon = await resolveWithTimeout((url, options) => fetch(url, options), favicons);
6460
6461
  return networkFavicon ? [networkFavicon] : [];
6461
6462
  };
6462
- const handler$5 = async (event, favicons) => {
6463
- const pageUrl = event.sender.getURL();
6463
+ const handler$5 = async (_event, favicons, _webContentsId, webContents) => {
6464
+ const pageUrl = webContents.getURL();
6464
6465
  if (favicons.length > 0) {
6465
- set(event.sender, pageUrl);
6466
+ set(webContents, pageUrl);
6466
6467
  }
6467
- const resolvedFavicons = await resolveFavicon(event, favicons);
6468
+ const resolvedFavicons = await resolveFavicon(webContents, favicons);
6468
6469
  return {
6469
- messages: event.sender.getURL() === pageUrl ? [['handlePageFaviconUpdated', resolvedFavicons]] : [],
6470
+ messages: webContents.getURL() === pageUrl ? [['handlePageFaviconUpdated', resolvedFavicons]] : [],
6470
6471
  result: undefined
6471
6472
  };
6472
6473
  };
@@ -6487,7 +6488,7 @@ const attach$6 = (webContents, listener) => {
6487
6488
  const detach$4 = (webContents, listener) => {
6488
6489
  webContents.off(DidNavigate, listener);
6489
6490
  };
6490
- const loadDefaultFavicon = async (event, url) => {
6491
+ const loadDefaultFavicon = async (webContents, url) => {
6491
6492
  let faviconUrl;
6492
6493
  try {
6493
6494
  const parsedUrl = new URL(url);
@@ -6498,17 +6499,17 @@ const loadDefaultFavicon = async (event, url) => {
6498
6499
  } catch {
6499
6500
  return [];
6500
6501
  }
6501
- if (has(event.sender, url)) {
6502
+ if (has(webContents, url)) {
6502
6503
  return [];
6503
6504
  }
6504
6505
  const favicons = await resolveNetworkFavicon([faviconUrl]);
6505
- if (favicons.length === 0 || event.sender.getURL() !== url) {
6506
+ if (favicons.length === 0 || webContents.getURL() !== url) {
6506
6507
  return [];
6507
6508
  }
6508
6509
  return favicons;
6509
6510
  };
6510
- const handler$4 = async (event, url, _httpResponseCode, _httpStatusText, _webContentsId) => {
6511
- const favicons = await loadDefaultFavicon(event, url);
6511
+ const handler$4 = async (_event, url, _httpResponseCode, _httpStatusText, _webContentsId, webContents) => {
6512
+ const favicons = await loadDefaultFavicon(webContents, url);
6512
6513
  const messages = favicons.length > 0 ? [['handleDidNavigate', url], ['handlePageFaviconUpdated', favicons]] : [['handleDidNavigate', url]];
6513
6514
  return {
6514
6515
  messages,
@@ -6789,6 +6790,7 @@ const isAllowedPermission = permission => {
6789
6790
  switch (permission) {
6790
6791
  case ClipBoardRead:
6791
6792
  case ClipBoardSanitizedWrite:
6793
+ case FileSystem:
6792
6794
  case FullScreen:
6793
6795
  case GeoLocation:
6794
6796
  case WindowPlacement:
@@ -6797,6 +6799,9 @@ const isAllowedPermission = permission => {
6797
6799
  return false;
6798
6800
  }
6799
6801
  };
6802
+ const handleFileSystemAccessRestricted = (_event, _details, callback) => {
6803
+ callback('allow');
6804
+ };
6800
6805
  const handlePermissionRequest = (webContents, permission, callback, details) => {
6801
6806
  callback(isAllowedPermission(permission));
6802
6807
  };
@@ -6810,6 +6815,7 @@ const createSession = () => {
6810
6815
  });
6811
6816
  session.setPermissionRequestHandler(handlePermissionRequest);
6812
6817
  session.setPermissionCheckHandler(handlePermissionCheck);
6818
+ session.on('file-system-access-restricted', handleFileSystemAccessRestricted);
6813
6819
  session.webRequest.onBeforeRequest(filter, handleBeforeRequest);
6814
6820
  // session.webRequest.addSessionChromeExtensions(session)
6815
6821
  return session;
@@ -6913,7 +6919,7 @@ const attachEventListenersToWebContents = (webContentsId, webContents, browserWi
6913
6919
  };
6914
6920
  const wrappedListener = (...args) => {
6915
6921
  // @ts-ignore
6916
- const handlerResult = value.handler(...args, webContentsId);
6922
+ const handlerResult = value.handler(...args, webContentsId, webContents);
6917
6923
  if (handlerResult instanceof Promise) {
6918
6924
  return handleAsyncResult(handlerResult);
6919
6925
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.37.6",
3
+ "version": "6.37.8",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"