File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
packages/electron-chrome-web-store/src/browser Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ function getExtensionInstallStatus(
5959 }
6060
6161 if ( manifest ) {
62- if ( manifest . manifest_version < 2 ) {
62+ if ( manifest . manifest_version < state . minimumManifestVersion ) {
6363 return ExtensionInstallStatus . DEPRECATED_MANIFEST_VERSION
6464 }
6565 }
@@ -268,7 +268,9 @@ export function registerWebStoreApi(webStoreState: WebStoreState) {
268268 } )
269269
270270 handle ( 'chromeWebstore.getMV2DeprecationStatus' , async ( ) => {
271- return MV2DeprecationStatus . INACTIVE
271+ return webStoreState . minimumManifestVersion > 2
272+ ? MV2DeprecationStatus . SOFT_DISABLE
273+ : MV2DeprecationStatus . INACTIVE
272274 } )
273275
274276 handle ( 'chromeWebstore.getReferrerChain' , async ( ) => {
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ interface ElectronChromeWebStoreOptions {
5656 */
5757 autoUpdate ?: boolean
5858
59+ /**
60+ * Minimum supported version of Chrome extensions.
61+ * Defaults to 3.
62+ */
63+ minimumManifestVersion ?: number
64+
5965 beforeInstall ?: BeforeInstall
6066}
6167
@@ -72,6 +78,8 @@ export async function installChromeWebStore(opts: ElectronChromeWebStoreOptions
7278 const allowUnpackedExtensions =
7379 typeof opts . allowUnpackedExtensions === 'boolean' ? opts . allowUnpackedExtensions : false
7480 const autoUpdate = typeof opts . autoUpdate === 'boolean' ? opts . autoUpdate : true
81+ const minimumManifestVersion =
82+ typeof opts . minimumManifestVersion === 'number' ? opts . minimumManifestVersion : 3
7583 const beforeInstall = typeof opts . beforeInstall === 'function' ? opts . beforeInstall : undefined
7684
7785 const webStoreState : WebStoreState = {
@@ -80,6 +88,7 @@ export async function installChromeWebStore(opts: ElectronChromeWebStoreOptions
8088 installing : new Set ( ) ,
8189 allowlist : opts . allowlist ? new Set ( opts . allowlist ) : undefined ,
8290 denylist : opts . denylist ? new Set ( opts . denylist ) : undefined ,
91+ minimumManifestVersion,
8392 beforeInstall,
8493 }
8594
Original file line number Diff line number Diff line change @@ -19,5 +19,6 @@ export interface WebStoreState {
1919 installing : Set < ExtensionId >
2020 allowlist ?: Set < ExtensionId >
2121 denylist ?: Set < ExtensionId >
22+ minimumManifestVersion : number
2223 beforeInstall ?: BeforeInstall
2324}
You can’t perform that action at this time.
0 commit comments