Skip to content

Conversation

iamEvanYT
Copy link
Contributor

@iamEvanYT iamEvanYT commented Apr 22, 2025

Summary

This PR makes it possible for users to create a custom extensions management system (Install, Uninstall, Enable & Disable)


Changes

  • Added an afterInstall option to installChromeWebStore(), which allows the users to specifically track extensions installed via the webstore.
  • Added an afterUninstall option to installChromeWebStore(), which allows the users to specifically track extensions uninstalled via the webstore
  • Added an overrideExtensionInstallStatus option to installChromeWebStore(), which allows the users to override the extension state passed to the webstore. (eg: Disabled, Blacklisted, Corrupted, etc)

Why?

These changes allowed me to implement a custom extension management system here, while maintaining the state with electron-chrome-web-store.


closes #116

✅ By sending this pull request, I agree to the Contributor License Agreement of this project.

@Kilian
Copy link
Contributor

Kilian commented Apr 23, 2025

Would it also be possible to add an uninstall(<id>) api to remove extensions through a custom extensions management system? ( #118 )

@iamEvanYT
Copy link
Contributor Author

Would it also be possible to add an uninstall(<id>) api to remove extensions through a custom extensions management system? ( #118 )

I think this already exists from this commit.

@Kilian
Copy link
Contributor

Kilian commented Apr 23, 2025

yes, sweet!

Co-authored-by: Sam Maddock <[email protected]>
Copy link
Owner

@samuelmaddock samuelmaddock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, I'd recommend breaking up each API addition into separate PRs. That way feedback for one doesn't need to block the others.

Comment on lines +356 to +358
queueMicrotask(() => {
webStoreState.afterUninstall?.({ id })
})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the queueMicrotask needed?

Suggested change
queueMicrotask(() => {
webStoreState.afterUninstall?.({ id })
})
webStoreState.afterUninstall?.({ id })

session: webStoreState.session,
extensionsPath: webStoreState.extensionsPath,
}
await webStoreState.customSetExtensionEnabled(id, details, enabled)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to setExtensionEnabled and add documentation referencing chrome.management.setEnabled

@@ -50,6 +50,23 @@ function getExtensionInstallStatus(
extensionId: ExtensionId,
manifest?: chrome.runtime.Manifest,
) {
if (state.overrideExtensionInstallStatus) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to getExtensionInstallStatus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[electron-chrome-web-store] installed callback
3 participants