How oashalal/lg-native works
lg-native is a Linux Electron client for the live Legion game site, with local interface patches while the site remains authoritative for API and authentication. The main workflow loads a channel in an account-specific browser session, mediates site requests and versioned asset caching, then applies compatible patches and exposes their LGX runtime to the page. Separate branches cover multi-account lifecycle, native window features, and patch network permissions. The source index and excerpts establish the main wiring; less-sampled native and preload details are represented at directory level, with undocumented links omitted.
Main entry points: app.ts Electron app · engine.ts Patch engine · lgx.ts LGX page API · page-bridge.ts Page bridge
Components 21
Electron shell
- Electron app
src/main/app.ts - IPC channels
src/main/ipc/channels.ts - Page bridge
src/main/ipc/page-bridge.ts - Preload bridges
src/preload
Site networking
- Origin handling
src/main/net/origin.ts - Patch network policy
src/main/net/network-policy.ts - Asset cache
src/main/net/cache.ts
Patch platform
- Patch manifest schema
src/shared/manifest.ts - Patch engine
src/main/patching/engine.ts - Compatibility checks
src/main/patching/compat.ts - Patch settings
src/main/patching/settings.ts - Patch reports
src/main/patching/report-log.ts - Local patches
patches
Page runtime
- LGX page API
src/runtime/lgx.ts - Patch UI helpers
src/runtime/ui.ts - World channel
src/runtime/channel.ts - Runtime fetch
src/runtime/net.ts
Accounts and native
- Account registry
src/main/accounts/index.ts - Native features
src/main/native
Other components
- Player
- Legion site
Connections 23
- Player → Electron app: opens client
README.md - Electron app → Legion site: loads channel
README.md - Electron app → Asset cache: reads and writes
src/main/app.ts - Electron app → Origin handling: restores origin
src/main/app.ts - Electron app → Patch engine: applies patches
src/main/app.ts - Electron app → Compatibility checks: checks versions
src/main/app.ts - Electron app → Patch settings: loads overrides
src/main/app.ts - Electron app → Patch reports: records outcomes
src/main/app.ts - Electron app → Account registry: manages profiles
src/main/app.ts - Patch engine → Patch manifest schema: uses schema
src/main/patching/engine.ts - Patch engine → Compatibility checks: checks compatibility
src/main/patching/engine.ts - Patch engine → Local patches: executes patch code
- Patch engine → LGX page API: injects runtime
src/main/patching/engine.ts - LGX page API → Patch UI helpers: creates helpers
src/runtime/lgx.ts - Electron app → IPC channels: registers handlers
src/main/app.ts - Electron app → Page bridge: uses bridge gates
src/main/app.ts - Electron app → Preload bridges: configures preload
- Preload bridges → Page bridge: exposes page API
- LGX page API → Page bridge: requests reports
- Runtime fetch → Patch network policy: validates fetches
- Player → Account registry: selects profile
- Electron app → Native features: creates native UI
- Electron app → Legion site: intercepts requests
src/main/app.ts