How zero-peak/zeroomega works
Project Identification
• ZeroOmega is a browser proxy management extension – a fork of SwitchyOmega – that supports building as a Chrome/Chromium extension and also as a Firefox Addon using the WebExtension API.
• Its primary purpose is to let users manage and quickly switch among multiple proxy profiles, including generating PAC (Proxy Auto-Config) scripts.
Main Components
• Build & Deployment:
– “omega-build”: Contains Grunt build files and package configurations that orchestrate installing dependencies and linking each module.
• PAC Generator Module:
– “omega-pac”: A standalone module that handles the profile model and compiles profiles into PAC scripts. It also includes a test suite.
• Core Options Manager (Backend Logic):
– “omega-target”: Contains browser-independent logic for managing options and applying profiles. It provides the abstract “OmegaTarget” base classes that can be subclassed.
• Web Configuration Interface:
– “omega-web”: A web-based configuration interface (in Angular) that uses components like controllers, views (jade/less files), and integrates with the backend logic via an external script (omega_target_web.js) that implements browser-dependent communication.
• Browser/Environment Specific Targets:
– “omega-target-chromium-extension”: Contains Chromium/Firefox-specific code—including background scripts, manifest files, and browser API integrations. This target extends the core classes with the required methods, e.g., via an implementation of the omega_target_web module.
• Localization Support:
– “omega-locales”: Holds message catalogs for many languages, which feeds into the user interface components.
Recommended Interaction & Data Flow
• The web UI (from the “omega-web” module) interacts with a browser-specific backend (omega-target and its target-specific implementations from “omega-target-chromium-extension”) by way of the custom angular module (omega_target_web.js).
• The PAC generation functionality is separate in “omega-pac” but operates on the same profiles/options data managed by “omega-target” (or via communication from the UI).
• The build pipeline (omega-build) ties these modules together, ensuring that when a target is built (for example, a Chromium extension), all modules (UI, backend logic, PAC generator) are correctly integrated.
Important Architectural Patterns & Design Principles
• Layered/MVC Approach – The project separates concerns by providing:
• A core business logic (omega-target) managing options/profiles,
• A standalone PAC generator (omega-pac) module,
• A specialized web-based presentation layer (omega-web),
• And environment-specific extensions (omega-target-chromium-extension).
• Modularity & Reusability – Each module has well-defined responsibilities and interacts through clear interfaces (such as the omega_target_web angular module example).
• Extensibility – The use of abstract base classes in “omega-target” and extended subclasses in target folders allow for easy addition of new browser targets.
• Build Automation – The Grunt-based build process ensures modules are linked, tested, and packaged consistently.