How besuper/twitchnosub works
Main Components
• Extension Core: Identify the common logic that is used regardless of the browser. This is mostly found in files like src/app.js and perhaps shared scripts like src/twitchnosub.js.
• Browser-Specific Components:
– Chrome Component: Under src/chrome, you have chrome/app.js (and a corresponding manifest.json file in the root for Chrome).
– Firefox Component: Under src/firefox, which includes firefox/app.js and additional Firefox-specific files (e.g., twitchnosub.js, patch files).
• Userscript Component: Located in userscript/twitchnosub.user.js indicates an alternative injection method outside of the traditional extension framework.
• Tooling/Patching Functionality: There’s a tools directory (with tools/patch.js) and a script (src/patch_amazonworker.js) that hints at some dynamic adjustments or fixes possibly related to external worker scripts.
Relationships and Interactions
• The core extension logic (src/app.js and shared files) provides general functionality, whereas the browser-specific folders (src/chrome and src/firefox) adapt this logic with APIs and browser-specific customization.
• The manifest files (manifest.json and firefox-manifest.json) are key configuration files driving the extension behavior in each environment.
• The userscript version offers a lightweight alternative, perhaps for injecting functionality directly onto pages.
• Tools and patch files suggest that some pre-deployment processing or runtime patching is involved.
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly segments common logic from browser-specific implementations.
• Modular Design: Each browser has its dedicated folder, and the existence of a tools directory suggests that any build or patching operations are handled in isolation.
• Multi-Platform Support: The architecture is purposefully created to handle differences between Chromium-based browsers and Firefox while sharing a base functionality.
Relevant Technologies/Frameworks
• JavaScript is the core language used.
• Browser Extension APIs (evident from the manifest and the designated directories for Chrome and Firefox).
• Build/patch tools captured under the tools folder, which might use Node.js or a similar runtime (as indicated by package.json).
• The file tree shows a .github folder, indicating that GitHub workflows or issue templates might also be a part of this project’s overall ecosystem for development and collaboration.