diff --git a/.github/ISSUE_TEMPLATE/bug_report_en.yaml b/.github/ISSUE_TEMPLATE/bug_report_en.yaml index 043ef521c..7b62702d6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_en.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report_en.yaml @@ -14,7 +14,9 @@ body: attributes: label: "Problem Description" description: "What problem occurred? What is the expected normal behavior?" - placeholder: "e.g., When clicking the download button on YouTube page, the script throws a 404 error, expected to show a download window" + placeholder: + "e.g., When clicking the download button on YouTube page, the script throws a 404 error, expected to show a + download window" validations: required: true @@ -37,7 +39,9 @@ body: id: scriptcat-version attributes: label: ScriptCat Version - description: You can view it by clicking on the ScriptCat popup window. If possible, please use the latest version as your issue may have already been resolved + description: + You can view it by clicking on the ScriptCat popup window. If possible, please use the latest version as your + issue may have already been resolved placeholder: e.g., v0.17.0 validations: required: true diff --git a/.github/ISSUE_TEMPLATE/feature_request_en.md b/.github/ISSUE_TEMPLATE/feature_request_en.md index 995a35b67..d5194e850 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_en.md +++ b/.github/ISSUE_TEMPLATE/feature_request_en.md @@ -12,7 +12,8 @@ Please clearly describe the feature you want: ### Use Case -In what situations is this feature needed? (e.g., when processing specific websites, improving operational efficiency, etc.) +In what situations is this feature needed? (e.g., when processing specific websites, improving operational efficiency, +etc.) ### Additional Information diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 1bebf61b1..69901b700 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -9,22 +9,28 @@ When performing a code review, respond in Chinese. ScriptCat is a sophisticated browser extension that executes user scripts with a unique multi-process architecture: ### Core Components -- **Service Worker** (`src/service_worker.ts`) - Main background process handling script management, installations, and chrome APIs + +- **Service Worker** (`src/service_worker.ts`) - Main background process handling script management, installations, and + chrome APIs - **Offscreen** (`src/offscreen.ts`) - Isolated background environment for running background/scheduled scripts - **Sandbox** (`src/sandbox.ts`) - Secure execution environment inside offscreen for script isolation - **Content Scripts** (`src/content.ts`) - Injected into web pages to execute user scripts - **Inject Scripts** (`src/inject.ts`) - Runs in page context with access to page globals ### Message Passing System + ScriptCat uses a sophisticated message passing architecture (`packages/message/`): + - **ExtensionMessage** - Chrome extension runtime messages between service worker/content/pages - **WindowMessage** - PostMessage-based communication between offscreen/sandbox - **CustomEventMessage** - CustomEvent-based communication between content/inject scripts - **MessageQueue** - Cross-environment event broadcasting system -Key pattern: All communication flows through Service Worker → Offscreen → Sandbox for background scripts, or Service Worker → Content → Inject for page scripts. +Key pattern: All communication flows through Service Worker → Offscreen → Sandbox for background scripts, or Service +Worker → Content → Inject for page scripts. ### Script Execution Flow + 1. **Page Scripts**: Service Worker registers with `chrome.userScripts` → injected into pages 2. **Background Scripts**: Service Worker → Offscreen → Sandbox execution 3. **Scheduled Scripts**: Cron-based execution in Sandbox environment @@ -32,6 +38,7 @@ Key pattern: All communication flows through Service Worker → Offscreen → Sa ## Key Development Patterns ### Path Aliases + ```typescript "@App": "./src/" "@Packages": "./packages/" @@ -39,24 +46,30 @@ Key pattern: All communication flows through Service Worker → Offscreen → Sa ``` ### Repository Pattern + All data access uses DAO classes extending `Repo` base class: + ```typescript // Example: ScriptDAO, ResourceDAO, SubscribeDAO export class ScriptDAO extends Repo