How Wand-Enhancer Disables Updates: Patching the Electron Main Process
Wand-Enhancer disables updates by injecting a code patch that overrides the ACTION_CHECK_FOR_UPDATE handler in Wand’s Electron index.js, forcing it to return null instead of fetching update metadata.
Wand-Enhancer is an open-source modification framework for the Wand application that enables users to customize behavior through runtime patches. One of its most requested features prevents the application from automatically checking for or downloading updates. This functionality is implemented by rewriting the internal update-checking mechanism at the source code level before the application launches.
How the Disable Updates Patch Works
The disable updates feature operates by intercepting and neutralizing Wand’s built-in automatic update system. Rather than blocking network requests at the firewall level, Wand-Enhancer modifies the application’s underlying JavaScript to eliminate the update check entirely.
Targeting the Update Handler
Wand’s update mechanism relies on an internal event handler registered for the ACTION_CHECK_FOR_UPDATE action. In a standard Electron application structure, this handler resides in the main process file (index.js). When triggered, this handler initiates a network request to the update feed URL to check for new versions.
According to the source code in WandEnhancer/Core/EnhancerConfig.cs, the patch specifically targets the registration of this handler using a regex pattern that matches the registerHandler("ACTION_CHECK_FOR_UPDATE"...) call. Once located, the patch replaces the original implementation with a stub function that discards the update URL and terminates the check early.
The Patch Implementation in EnhancerConfig.cs
The core logic resides in the EPatchType.DisableUpdates entry defined at lines 188-200 of EnhancerConfig.cs. This PatchEntry object contains two critical components:
Target: A regex pattern that locates the handler registration inindex.jsPatch: The replacement code that substitutes the original handler body
When Wand-Enhancer executes its patching pipeline, it enumerates all active PatchEntry objects from GetInstance(), reads the target ASAR archive, applies the regex replacement to index.js, and rebuilds the package. The modified application binary now contains the disabled update logic permanently embedded in the source.
Code-Level Implementation Details
The transformation occurs at the JavaScript level within Wand’s main process code. Here is the specific change introduced by the enhancer:
Original Update Check Code
Before patching, Wand’s index.js contains a handler that actively processes update checks:
registerHandler("ACTION_CHECK_FOR_UPDATE", (e) => {
// original implementation that contacts the update server
expectUpdateFeedUrl(e, (url) => fetch(url).then(...));
});
Patched Null Handler
Wand-Enhancer replaces this with a stub that immediately returns null, preventing any network activity:
registerHandler("ACTION_CHECK_FOR_UPDATE",
(e => expectUpdateFeedUrl(e, (e => null)))
);
This modification short-circuits the update flow. The expectUpdateFeedUrl function receives the event but passes a lambda that returns null instead of the actual URL, causing the update check to fail silently without alerting the user or triggering download dialogs.
User Interface and Localization
Users control this feature through the Patch Vectors settings panel. The toggle is defined in WandEnhancer/View/Popups/PatchVectorsPopup.xaml at line 36:
<TextBlock Grid.Row="2" Grid.Column="0"
VerticalAlignment="Center"
Text="{DynamicResource pv_disable_updates}" />
The pv_disable_updates resource key maps to localized strings stored in the WandEnhancer/Locale/*.xaml files. When enabled, the patcher includes the DisableUpdates patch in its execution sequence during the next application launch. The EPatchType enumeration in Constants.cs defines this as a valid configuration option, allowing the patch pipeline to recognize and apply it alongside other modifications.
ASAR Rebuilding and Persistence
The patching process modifies Wand’s application archive (ASAR) directly. After applying the regex substitution to index.js, Wand-Enhancer repackages the archive so that the changes persist across application restarts. This local modification approach requires no external network interception or background services, making it reliable and portable.
Because the patch alters the source code rather than runtime memory, the disable updates feature remains active even if Wand is restarted or the system is rebooted. Users must explicitly toggle the setting off in the Patch Vectors popup and re-patch to restore automatic updates.
Summary
- Wand-Enhancer disables updates by patching the
ACTION_CHECK_FOR_UPDATEhandler in Wand’s Electron main process (index.js). - The
PatchEntrydefined inWandEnhancer/Core/EnhancerConfig.cs(lines 188-200) replaces the update check with a null-returning stub. - Users enable the feature via a toggle in
PatchVectorsPopup.xamllabeled by localized resources (pv_disable_updates). - The modification persists by rebuilding the ASAR archive with the patched
index.jsincluded.
Frequently Asked Questions
Does disabling updates affect Wand’s ability to sync data?
No. The patch specifically targets the ACTION_CHECK_FOR_UPDATE handler responsible for version checking and binary updates. Data synchronization, cloud saves, and other network-dependent features use separate handlers and continue to function normally because the patch only modifies the update feed URL resolution to return null.
Can I re-enable automatic updates after disabling them?
Yes. Navigate to the Patch Vectors popup in the Wand-Enhancer interface, uncheck the “Disable updates” option, and restart the patcher. The tool will rebuild the ASAR archive using the original Wand source files, restoring the native expectUpdateFeedUrl behavior and allowing the application to check for updates again.
Is this patch applied to memory or the filesystem?
The patch is applied to the filesystem within Wand’s ASAR archive. Unlike runtime memory patches that require the enhancer to remain running, this modification rewrites the actual index.js source code on disk. Consequently, Wand operates with updates disabled even if Wand-Enhancer is closed, until the user explicitly re-patches with the setting disabled.
What happens if Wand updates itself outside of the enhancer?
If Wand’s auto-updater executes before Wand-Enhancer patches the application, the original update mechanism will function normally until the next time you run the enhancer. To maintain the disabled state, you should run Wand-Enhancer’s patcher after every official Wand update to ensure the ACTION_CHECK_FOR_UPDATE handler remains overridden with the null stub.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →