Skip to content

About

An in-memory Electron mod loader, built to simplify Discord modding.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

electron-hook

A Rust library for loading mods into Electron applications without patching any files.

This project was designed to ease some pain points with modding Discord, but it can be used for most Electron applications.

For some real-life uses of electron-hook, check out:

Installation

Add this to your Cargo.toml:

[dependencies]
electron-hook = "0.2.0"

[lib]
crate-type = ["cdylib"]

And in your lib.rs:

pub use electron_hook::*;

When you build your project with --lib it will generate a .dll, .so, or .dylib, which you can pass to electron_hook::launch.

On macOS, the target app must allow DYLD environment variables and disable library validation. The launcher keeps the installed app untouched, exposes the original archive through a cache alias, and supports both arm64 and x86_64 native builds.

Usage

For a better example, check out the Documentation

electron_hook::launch(&electron_executable, &library_path, &asar_path, vec![], true);

Bootstraps that need positive startup confirmation can opt into a readiness timeout:

use std::time::Duration;

electron_hook::launch_with_options(
    &electron_executable,
    &library_path,
    &asar_path,
    vec![],
    true,
    &electron_hook::LaunchOptions {
        ready_timeout: Some(Duration::from_secs(10)),
    },
);

On macOS, Electron-Hook sets MODLOADER_READY_FILE when this option is configured. The injected bootstrap must create that file after startup succeeds.

The macOS hook removes itself from DYLD_INSERT_LIBRARIES before Electron spawns helper processes. A bootstrap that supports relaunch or update-and-restart must route the new app process back through MODLOADER_EXECUTABLE.

About

An in-memory Electron mod loader, built to simplify Discord modding.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages