How santony760/sotoscribe works
Project Type and Purpose
• Project type: Browser extension (Microsoft Edge/Chrome) for capturing and editing user workflows entirely in the browser.
• Purpose:
– Inject scripts into web pages to record clicks, text entry, navigations, and screenshots.
– Provide a popup UI to start/stop recording.
– Open an editor UI in a new tab to review/edit/export the recorded steps (PDF / SharePoint embed).
– All data lives in memory—no external calls or persistent storage.
Main Architectural Components
A. manifest.json
– Declares extension metadata, permissions, script registrations (content scripts, background script, popup, editor).
B. Background Script (background.js)
– Event-driven service worker (MV3) or persistent page (MV2) listening for messages/triggers.
– Manages in-memory store of recorded events.
– Orchestrates starting/stopping recording and opening the editor tab.
C. Content Scripts (content.js + screenshot.js)
– Injected into every page (via permissions: activeTab, scripting).
– Listens for DOM events (clicks, form inputs, navigation).
– Captures screenshots using chrome.tabs.captureVisibleTab (screenshot.js).
– Sends event objects (action, screenshot blob, metadata) to background.
D. Popup UI (popup.html + popup.js)
– “Start Recording” / “Stop Recording” buttons.
– Sends messages to background to toggle recording state.
– Displays recording badge.
E. Editor UI (editor.html + editor.js + screenshot.js)
– Opens in a new tab when recording stops.
– Reads the in-memory workflow data via chrome.runtime messaging or injection.
– Renders a step list with screenshots and editable text.
– Provides image-editing (blurring, annotations) via screenshot.js.
– Supports PDF export (e.g., jsPDF or html2canvas) and SharePoint embed code generation.
F. Assets
Data Flows and Interactions
2. Popup sends message → Background toggles recording ON → Background injects content scripts (if needed) and notifies them to begin capturing.
3. Content scripts intercept user events → capture metadata + screenshot → send event payloads to Background.
4. Background appends events to its in-memory list.
5. User clicks “Stop Recording” in Popup → message to Background → Background opens editor.html in a new tab, passing the events list.
6. Editor UI fetches events → displays steps, allows edits → on export, runs PDF / SharePoint-embed logic locally → clears memory when done or on tab close.
Architectural Patterns and Principles
• MV3 Extension Pattern: Separate background service, content scripts, and UI pages.
• Message-Passing Architecture: All data flows via chrome.runtime.sendMessage / onMessage.
• In-Memory Event Store: Ephemeral storage ensures no data persists beyond session.
• Client-Only Processing: All processing (screenshot, PDF export, image editing) in the browser.