How yahuli/follow-in-fediverse works
Main Components
• UI Components: Distinctly mark out the Popup and Options interfaces. These are implemented as Vue components (src/Popup.vue, src/Option.vue) with corresponding TypeScript files (src/popup.ts, src/option.ts) to control UI logic and user interaction.
• Scripts and Core Logic:
• Background Script: Located in src/scripts/background.ts, it handles background tasks like listening for extension events and facilitating communication between components.
• Content Script: Found in src/scripts/content.ts, it interacts with the actual webpage, capturing context-specific data (like user profile data) and sending messages to the background script.
• Server/Communication Layer: The src/server.ts file acts as an abstraction layer to interact with external Fediverse servers.
• Fediverse API Integrations: In src/softwares, you find separate modules for each supported Fediverse platform (mastodon, misskey, pixelfed, fedibird). These modules encapsulate API specifics and make it easier for the extension to interact with multiple backends reliably.
• Utility Functions: The src/utils folder (e.g., chrome.ts) contains helper functions to interact with browser APIs or abstract common logic.
Relationships and Interactions
• Detail how the Popup and Options UIs send/receive data from the Background Script.
• Communication flows from the Content Script (which detects a user's profile on another server) to the Background Script and then to the Server/Software modules.
• How the Server/Software modules interact with external Fediverse APIs, and how the Background Script aggregates data and sends responses back to the UI components.
• Role of configuration management (user settings saved via the Options page) and how that configuration affects API calls made through the server integration layer.
Architectural Patterns & Design Principles
• Separation of Concerns: Clearly show the separation between UI (Popup/Options), background processes (scripts), and API integration (softwares).
• Modular Design: Emphasize the “softwares” directory that abstracts support for different Fediverse platforms via individual modules.
Relevant Technologies and Tools
• Vue.js: For building the Popup and Options interfaces.
• TypeScript: Used throughout the project for tooling and type safety.
• Vite: The build tool (configured via vite.config.ts) that bundles the extension.
• Chrome Extension APIs: Implicit through files like chrome.ts and the extension manifest.
• Localization: Handle multiple language support via the public/_locales directories.