mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-05 14:10:18 +08:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30eca830d9 | ||
|
|
3b7bfa10fd | ||
|
|
b238175f18 | ||
|
|
8f00096a9f | ||
|
|
9f498a85d0 | ||
|
|
e014b913d2 | ||
|
|
f38ceae3fb | ||
|
|
089635c8bf | ||
|
|
dc5a8a5ff4 | ||
|
|
476ddb63c3 | ||
|
|
c6b51171a1 | ||
|
|
d4287970bc | ||
|
|
b20fdc9b96 | ||
|
|
5b10331022 | ||
|
|
3ec858eb9f |
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/node:2": {
|
"ghcr.io/devcontainers/features/node:2": {
|
||||||
"version": "24.21.0",
|
"version": "24.22.0",
|
||||||
"pnpmVersion": "12.11.2"
|
"pnpmVersion": "12.11.2"
|
||||||
},
|
},
|
||||||
"ghcr.io/devcontainers/features/rust:1": {
|
"ghcr.io/devcontainers/features/rust:1": {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ This is a **dispatcher agent** that routes your request to the appropriate speci
|
|||||||
|
|
||||||
- **Creating new workflows**: Routes to `create` prompt
|
- **Creating new workflows**: Routes to `create` prompt
|
||||||
- **Updating existing workflows**: Routes to `update` prompt
|
- **Updating existing workflows**: Routes to `update` prompt
|
||||||
- **Debugging workflows**: Routes to `debug` prompt
|
- **Diagnosis, patching, and active debugging**: Routes to `debug-agentic-workflow` for the local-first strategy, evidence triage and live gates
|
||||||
- **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt
|
- **Upgrading workflows**: Routes to `upgrade-agentic-workflows` prompt
|
||||||
- **Creating report-generating workflows**: Routes to `report` prompt — consult this whenever the workflow posts status updates, audits, analyses, or any structured output as issues, discussions, or comments
|
- **Creating report-generating workflows**: Routes to `report` prompt — consult this whenever the workflow posts status updates, audits, analyses, or any structured output as issues, discussions, or comments
|
||||||
- **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt
|
- **Creating shared components**: Routes to `create-shared-agentic-workflow` prompt
|
||||||
@@ -31,6 +31,7 @@ This is a **dispatcher agent** that routes your request to the appropriate speci
|
|||||||
- **CLI commands and triggering workflows**: Routes to `cli-commands` guide — consult this whenever the user asks how to run, compile, debug, or manage workflows from the command line, or when they need the MCP tool equivalent of a `gh aw` command
|
- **CLI commands and triggering workflows**: Routes to `cli-commands` guide — consult this whenever the user asks how to run, compile, debug, or manage workflows from the command line, or when they need the MCP tool equivalent of a `gh aw` command
|
||||||
- **Reducing token consumption / cost optimization**: Routes to `token-optimization` guide — consult this whenever the user asks how to reduce token usage, lower costs, speed up workflows, or measure the impact of prompt changes with experiments
|
- **Reducing token consumption / cost optimization**: Routes to `token-optimization` guide — consult this whenever the user asks how to reduce token usage, lower costs, speed up workflows, or measure the impact of prompt changes with experiments
|
||||||
- **Choosing workflow architectures and design patterns**: Routes to `patterns` guide — consult this whenever the user asks for strategy, architecture, operating models, or pattern selection for agentic workflows
|
- **Choosing workflow architectures and design patterns**: Routes to `patterns` guide — consult this whenever the user asks for strategy, architecture, operating models, or pattern selection for agentic workflows
|
||||||
|
- **Git-backed work queues**: Routes to `work-queue` instructions for producers, dispatchers, workers, observers, deployment and recovery
|
||||||
|
|
||||||
Workflows may optionally include:
|
Workflows may optionally include:
|
||||||
|
|
||||||
@@ -47,7 +48,8 @@ Workflows may optionally include:
|
|||||||
## Problems This Solves
|
## Problems This Solves
|
||||||
|
|
||||||
- **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions
|
- **Workflow Creation**: Design secure, validated agentic workflows with proper triggers, tools, and permissions
|
||||||
- **Workflow Debugging**: Analyze logs, identify missing tools, investigate failures, and fix configuration issues
|
- **Diagnosis and Patching**: Analyze evidence and produce regression-backed fixes without requiring live runs
|
||||||
|
- **Active Debugging**: Run bounded edit/test/run/audit loops where permitted, stopping on dispatch 403 responses
|
||||||
- **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes
|
- **Version Upgrades**: Migrate workflows to new gh-aw versions, apply codemods, fix breaking changes
|
||||||
- **Component Design**: Create reusable shared workflow components that wrap MCP servers
|
- **Component Design**: Create reusable shared workflow components that wrap MCP servers
|
||||||
|
|
||||||
@@ -83,11 +85,14 @@ When you interact with this agent, it will:
|
|||||||
- "Update the PR reviewer to use discussions instead of issues"
|
- "Update the PR reviewer to use discussions instead of issues"
|
||||||
- "Improve the prompt for the weekly-research workflow"
|
- "Improve the prompt for the weekly-research workflow"
|
||||||
|
|
||||||
### Debug Workflow
|
### Diagnose, Patch, or Debug a Workflow
|
||||||
**Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
|
**Load when**: User needs to investigate, audit, debug, or understand a workflow, troubleshoot issues, analyze logs, or fix errors
|
||||||
|
|
||||||
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-agentic-workflow.md`
|
**Prompt file**: `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/debug-agentic-workflow.md`
|
||||||
|
|
||||||
|
The shared strategy distinguishes diagnosis/patching from permitted active debug
|
||||||
|
loops using explicit live gates and includes existing-run evidence triage.
|
||||||
|
|
||||||
**Use cases**:
|
**Use cases**:
|
||||||
- "Why is this workflow failing?"
|
- "Why is this workflow failing?"
|
||||||
- "Analyze the logs for workflow X"
|
- "Analyze the logs for workflow X"
|
||||||
@@ -180,6 +185,15 @@ When you interact with this agent, it will:
|
|||||||
|
|
||||||
## Instructions
|
## Instructions
|
||||||
|
|
||||||
|
### Work Queue
|
||||||
|
|
||||||
|
For queue design, deployment, inspection or recovery, load
|
||||||
|
`https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/work-queue.md`.
|
||||||
|
Also load it after the primary create/update/debug/upgrade prompt whenever a
|
||||||
|
workflow uses `tools.work-queue`. Load linked developer docs and specifications
|
||||||
|
only when needed; do not substitute lightweight WorkQueueOps backlog guidance
|
||||||
|
for the Git-backed protocol.
|
||||||
|
|
||||||
When a user interacts with you:
|
When a user interacts with you:
|
||||||
|
|
||||||
1. **Identify the task type** from the user's request
|
1. **Identify the task type** from the user's request
|
||||||
@@ -196,7 +210,7 @@ gh aw init
|
|||||||
# Generate the lock file for a workflow
|
# Generate the lock file for a workflow
|
||||||
gh aw compile [workflow-name]
|
gh aw compile [workflow-name]
|
||||||
|
|
||||||
# Trigger a workflow on demand (preferred over gh workflow run)
|
# Only where permitted and human-validated under debug-agentic-workflow.md:
|
||||||
gh aw run <workflow-name> # interactive input collection
|
gh aw run <workflow-name> # interactive input collection
|
||||||
gh aw run <workflow-name> --ref main # run on a specific branch
|
gh aw run <workflow-name> --ref main # run on a specific branch
|
||||||
|
|
||||||
@@ -229,5 +243,5 @@ gh aw compile --validate
|
|||||||
- Follow security best practices: minimal permissions, explicit network access, no template injection
|
- Follow security best practices: minimal permissions, explicit network access, no template injection
|
||||||
- **Network configuration**: Use ecosystem identifiers (`node`, `python`, `go`, etc.) or explicit FQDNs in `network.allowed`. Bare shorthands like `npm` or `pypi` are **not** valid. See `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/network.md` for the full list of valid ecosystem identifiers and domain patterns.
|
- **Network configuration**: Use ecosystem identifiers (`node`, `python`, `go`, etc.) or explicit FQDNs in `network.allowed`. Bare shorthands like `npm` or `pypi` are **not** valid. See `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/network.md` for the full list of valid ecosystem identifiers and domain patterns.
|
||||||
- **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself.
|
- **Single-file output**: When creating a workflow, produce exactly **one** workflow `.md` file. Do not create separate documentation files (architecture docs, runbooks, usage guides, etc.). If documentation is needed, add a brief `## Usage` section inside the workflow file itself.
|
||||||
- **Triggering runs**: Always use `gh aw run <workflow-name>` to trigger a workflow on demand — not `gh workflow run <file>.lock.yml`. `gh aw run` handles workflow resolution by short name, input parsing and validation, and correct run-tracking for agentic workflows. Use `--ref <branch>` to run on a specific branch.
|
- **Triggering runs**: Only where permitted and human-validated under `debug-agentic-workflow.md`, prefer `gh aw run <workflow-name>` over `gh workflow run <file>.lock.yml` for workflow resolution, input validation and run-tracking. Use the reviewed remote ref; explicit no-dispatch rules override user requests.
|
||||||
- **CLI commands reference**: For a complete guide on all `gh aw` commands and their MCP tool equivalents (for restricted environments), see `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/cli-commands.md`
|
- **CLI commands reference**: For a complete guide on all `gh aw` commands and their MCP tool equivalents (for restricted environments), see `https://raw.githubusercontent.com/github/gh-aw/main/.github/aw/cli-commands.md`
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
"version": "v9.0.0",
|
"version": "v9.0.0",
|
||||||
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
|
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
|
||||||
},
|
},
|
||||||
"github/gh-aw-actions/setup@v0.89.21": {
|
"github/gh-aw-actions/setup@v0.92.0": {
|
||||||
"repo": "github/gh-aw-actions/setup",
|
"repo": "github/gh-aw-actions/setup",
|
||||||
"version": "v0.89.21",
|
"version": "v0.92.0",
|
||||||
"sha": "924af5fdc64061cfbf66fb584c8b07e2ac230c60"
|
"sha": "458b269006dcf88e3b5496b6fbecabe4b9a0f954"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"containers": {
|
"containers": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: agentic-workflows
|
name: agentic-workflows
|
||||||
description: Route gh-aw workflow design/create/debug/upgrade requests to the right prompts.
|
description: Route gh-aw design, creation, diagnosis, patching, active debugging, and upgrade requests to the right strategies.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Agentic Workflows Router
|
# Agentic Workflows Router
|
||||||
@@ -19,6 +19,7 @@ Load these files from `github/gh-aw` (they are not available locally).
|
|||||||
- `.github/aw/agent-runtime-instructions.md`
|
- `.github/aw/agent-runtime-instructions.md`
|
||||||
- `.github/aw/agentic-chat.md`
|
- `.github/aw/agentic-chat.md`
|
||||||
- `.github/aw/agentic-workflows-mcp.md`
|
- `.github/aw/agentic-workflows-mcp.md`
|
||||||
|
- `.github/aw/analyzing-runs.md`
|
||||||
- `.github/aw/asciicharts.md`
|
- `.github/aw/asciicharts.md`
|
||||||
- `.github/aw/campaign.md`
|
- `.github/aw/campaign.md`
|
||||||
- `.github/aw/charts-trending.md`
|
- `.github/aw/charts-trending.md`
|
||||||
@@ -31,6 +32,8 @@ Load these files from `github/gh-aw` (they are not available locally).
|
|||||||
- `.github/aw/create-agentic-workflow.md`
|
- `.github/aw/create-agentic-workflow.md`
|
||||||
- `.github/aw/create-shared-agentic-workflow.md`
|
- `.github/aw/create-shared-agentic-workflow.md`
|
||||||
- `.github/aw/debug-agentic-workflow.md`
|
- `.github/aw/debug-agentic-workflow.md`
|
||||||
|
- `.github/aw/debug-model-engine-misconfiguration.md`
|
||||||
|
- `.github/aw/debug-security-review.md`
|
||||||
- `.github/aw/dependabot.md`
|
- `.github/aw/dependabot.md`
|
||||||
- `.github/aw/deployment-status.md`
|
- `.github/aw/deployment-status.md`
|
||||||
- `.github/aw/designer-mappings.md`
|
- `.github/aw/designer-mappings.md`
|
||||||
@@ -46,6 +49,7 @@ Load these files from `github/gh-aw` (they are not available locally).
|
|||||||
- `.github/aw/instructions.md`
|
- `.github/aw/instructions.md`
|
||||||
- `.github/aw/intent.md`
|
- `.github/aw/intent.md`
|
||||||
- `.github/aw/jobs.md`
|
- `.github/aw/jobs.md`
|
||||||
|
- `.github/aw/ledger.md`
|
||||||
- `.github/aw/linter-workflows.md`
|
- `.github/aw/linter-workflows.md`
|
||||||
- `.github/aw/llms.md`
|
- `.github/aw/llms.md`
|
||||||
- `.github/aw/loop.md`
|
- `.github/aw/loop.md`
|
||||||
@@ -87,6 +91,7 @@ Load these files from `github/gh-aw` (they are not available locally).
|
|||||||
- `.github/aw/update-agentic-workflow.md`
|
- `.github/aw/update-agentic-workflow.md`
|
||||||
- `.github/aw/upgrade-agentic-workflows.md`
|
- `.github/aw/upgrade-agentic-workflows.md`
|
||||||
- `.github/aw/visual-regression.md`
|
- `.github/aw/visual-regression.md`
|
||||||
|
- `.github/aw/work-queue.md`
|
||||||
- `.github/aw/workflow-constraints.md`
|
- `.github/aw/workflow-constraints.md`
|
||||||
- `.github/aw/workflow-editing.md`
|
- `.github/aw/workflow-editing.md`
|
||||||
- `.github/aw/workflow-patterns.md`
|
- `.github/aw/workflow-patterns.md`
|
||||||
@@ -96,7 +101,8 @@ After loading the matching workflow prompt or skill, follow it directly:
|
|||||||
- Create new workflows: `.github/aw/create-agentic-workflow.md`
|
- Create new workflows: `.github/aw/create-agentic-workflow.md`
|
||||||
- Configure or add declarative engines: `.github/aw/configure-agentic-engine.md`
|
- Configure or add declarative engines: `.github/aw/configure-agentic-engine.md`
|
||||||
- Update existing workflows: `.github/aw/update-agentic-workflow.md`
|
- Update existing workflows: `.github/aw/update-agentic-workflow.md`
|
||||||
- Debug, audit, or investigate workflows: `.github/aw/debug-agentic-workflow.md`
|
- Diagnose, patch, audit, or actively debug workflows: `.github/aw/debug-agentic-workflow.md` (local-first strategy, evidence triage and live gates)
|
||||||
|
- AWF model/endpoint 400s, silent cross-family sub-agent failures, `model: auto` failures, install-step 404s after a version pin, or questions about version fields: go directly to [Model and engine misconfiguration](../../aw/debug-agentic-workflow.md#model-and-engine-misconfiguration) before suggesting model changes.
|
||||||
- Upgrade workflows and fix deprecations: `.github/aw/upgrade-agentic-workflows.md`
|
- Upgrade workflows and fix deprecations: `.github/aw/upgrade-agentic-workflows.md`
|
||||||
- Create shared components or MCP wrappers: `.github/aw/create-shared-agentic-workflow.md`
|
- Create shared components or MCP wrappers: `.github/aw/create-shared-agentic-workflow.md`
|
||||||
- Create report-generating workflows: `.github/aw/report.md`
|
- Create report-generating workflows: `.github/aw/report.md`
|
||||||
@@ -105,8 +111,11 @@ After loading the matching workflow prompt or skill, follow it directly:
|
|||||||
- Render compact markdown charts: `.github/aw/asciicharts.md`
|
- Render compact markdown charts: `.github/aw/asciicharts.md`
|
||||||
- Map CLI commands to MCP usage: `.github/aw/cli-commands.md`
|
- Map CLI commands to MCP usage: `.github/aw/cli-commands.md`
|
||||||
- Choose workflow architecture and patterns: `.github/aw/patterns.md`
|
- Choose workflow architecture and patterns: `.github/aw/patterns.md`
|
||||||
|
- Design, deploy, inspect or recover a Git-backed work queue: `.github/aw/work-queue.md`
|
||||||
- Optimize token usage and cost: `.github/aw/token-optimization.md`
|
- Optimize token usage and cost: `.github/aw/token-optimization.md`
|
||||||
- Design long-running multi-agent research workflows: `.github/aw/multi-agent-research.md`
|
- Design long-running multi-agent research workflows: `.github/aw/multi-agent-research.md`
|
||||||
- Add skills or agent plugins requested by the user (`skills:` / `plugins:` frontmatter, never on-the-fly installs): `.github/aw/skills.md`
|
- Add skills or agent plugins requested by the user (`skills:` / `plugins:` frontmatter, never on-the-fly installs): `.github/aw/skills.md`
|
||||||
|
|
||||||
When the task involves OTEL, OTLP, traces, observability backends, or telemetry-driven analysis, also read and follow `skills/otel-queries/SKILL.md` after loading the matching workflow prompt or skill.
|
When the task involves OTEL, OTLP, traces, observability backends, or telemetry-driven analysis, also read and follow `skills/otel-queries/SKILL.md` after loading the matching workflow prompt or skill.
|
||||||
|
|
||||||
|
When creating, updating, diagnosing or upgrading a workflow that uses `tools.work-queue`, also load `.github/aw/work-queue.md` after the primary prompt. Load deployment docs, operator reference or specification only when that task needs them.
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
@@ -185,7 +185,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Pnpm Cache
|
- name: Pnpm Cache
|
||||||
@@ -282,7 +282,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Pnpm Cache
|
- name: Pnpm Cache
|
||||||
@@ -426,7 +426,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Pnpm Cache
|
- name: Pnpm Cache
|
||||||
@@ -524,7 +524,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6.1.0
|
- uses: pnpm/action-setup@v6.1.0
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
|
|||||||
@@ -31,6 +31,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Install gh-aw extension
|
- name: Install gh-aw extension
|
||||||
uses: github/gh-aw-actions/setup-cli@924af5fdc64061cfbf66fb584c8b07e2ac230c60 # v0.89.21
|
uses: github/gh-aw-actions/setup-cli@458b269006dcf88e3b5496b6fbecabe4b9a0f954 # v0.92.0
|
||||||
with:
|
with:
|
||||||
version: v0.89.15
|
version: v0.89.15
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ jobs:
|
|||||||
if: github.event.inputs[matrix.input] == 'true'
|
if: github.event.inputs[matrix.input] == 'true'
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Pnpm Cache
|
- name: Pnpm Cache
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
- uses: actions/setup-node@v7
|
- uses: actions/setup-node@v7
|
||||||
if: steps.check_frontend.outputs.frontend == 'true'
|
if: steps.check_frontend.outputs.frontend == 'true'
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Restore pnpm cache
|
- name: Restore pnpm cache
|
||||||
@@ -138,7 +138,7 @@ jobs:
|
|||||||
- uses: actions/setup-node@v7
|
- uses: actions/setup-node@v7
|
||||||
if: steps.check_inputs.outputs.contract == 'true'
|
if: steps.check_inputs.outputs.contract == 'true'
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
|
|||||||
+323
-160
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ on:
|
|||||||
roles: all
|
roles: all
|
||||||
skip-roles: [admin, maintainer, write]
|
skip-roles: [admin, maintainer, write]
|
||||||
skip-bots: [dependabot, renovate]
|
skip-bots: [dependabot, renovate]
|
||||||
pull_request_target:
|
pull_request:
|
||||||
# reopened is intentionally excluded: reopens carry no new implementation
|
# reopened is intentionally excluded: reopens carry no new implementation
|
||||||
# evidence (the rerun-stability policy handles them), and a manual
|
# evidence (the rerun-stability policy handles them), and a manual
|
||||||
# workflow_dispatch remains available when a re-review is wanted.
|
# workflow_dispatch remains available when a re-review is wanted.
|
||||||
@@ -26,6 +26,7 @@ max-daily-ai-credits: 5000
|
|||||||
permissions:
|
permissions:
|
||||||
issues: read
|
issues: read
|
||||||
pull-requests: read
|
pull-requests: read
|
||||||
|
copilot-requests: none
|
||||||
|
|
||||||
pre-agent-steps:
|
pre-agent-steps:
|
||||||
- name: Make Copilot quota exhaustion non-blocking
|
- name: Make Copilot quota exhaustion non-blocking
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
@@ -331,7 +331,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v6
|
uses: pnpm/action-setup@v6
|
||||||
@@ -466,7 +466,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
@@ -547,7 +547,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
@@ -573,7 +573,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
@@ -638,7 +638,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v6
|
uses: pnpm/action-setup@v6
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
@@ -39,7 +39,7 @@ jobs:
|
|||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v7
|
uses: actions/setup-node@v7
|
||||||
with:
|
with:
|
||||||
node-version: '24.21.0'
|
node-version: '24.22.0'
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v6
|
- uses: pnpm/action-setup@v6
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
nodejs 24.21.0
|
nodejs 24.22.0
|
||||||
pnpm 12.11.2
|
pnpm 12.11.2
|
||||||
rust 1.99.0
|
rust 1.99.0
|
||||||
|
|||||||
Generated
+1
-1
@@ -7492,7 +7492,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-plugin-mihomo"
|
name = "tauri-plugin-mihomo"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo?branch=main#7a03d16f4d39b1bb885b7babe66b9e153e34b615"
|
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo?rev=7a03d16f4d39b1bb885b7babe66b9e153e34b615#7a03d16f4d39b1bb885b7babe66b9e153e34b615"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"clashmap",
|
"clashmap",
|
||||||
|
|||||||
+7
-2
@@ -3,8 +3,13 @@
|
|||||||
<details>
|
<details>
|
||||||
<summary><strong> 🐞 修复问题 </strong></summary>
|
<summary><strong> 🐞 修复问题 </strong></summary>
|
||||||
|
|
||||||
- 修复通过 URL 导入订阅时,即使导入的订阅并非当前使用的订阅,也会重新加载当前配置的问题
|
- 修复通过 URL 导入订阅时,即使导入的订阅并非当前使用的订阅,也会重新加载当前配置
|
||||||
- 修复「首页」网站测速失败后卡片一直显示测试中的问题
|
- 修复 首页 网站测速失败后卡片一直显示测试中
|
||||||
|
- 修复 代理 页展开分组后不显示最新测速结果,需切换节点才刷新
|
||||||
|
|
||||||
|
**🐧 Linux**
|
||||||
|
|
||||||
|
- Linux:修复 deb/rpm 安装包错误包含多余的 `frontend-contract` 可执行文件,导致下游重新打包失败的问题
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
|
//! Linux-only termination signal bridge.
|
||||||
|
//!
|
||||||
|
//! Upstream Tauri delivers session-end and termination events to the app on
|
||||||
|
//! Windows and macOS, but has no equivalent on Linux: a desktop session may
|
||||||
|
//! end without any window or run event reaching the process. Linux builds
|
||||||
|
//! keep this crate to listen for SIGTERM, SIGINT and SIGHUP and forward them
|
||||||
|
//! to the app quit flow, so system proxy and TUN cleanup still runs before
|
||||||
|
//! the process dies. Non-Linux builds compile this crate to nothing and must
|
||||||
|
//! not depend on it.
|
||||||
|
|
||||||
|
#![cfg(target_os = "linux")]
|
||||||
|
|
||||||
use std::sync::{
|
use std::sync::{
|
||||||
OnceLock,
|
OnceLock,
|
||||||
atomic::{AtomicBool, Ordering},
|
atomic::{AtomicBool, Ordering},
|
||||||
@@ -5,20 +17,13 @@ use std::sync::{
|
|||||||
|
|
||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging};
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
mod unix;
|
mod unix;
|
||||||
#[cfg(windows)]
|
|
||||||
mod windows;
|
|
||||||
|
|
||||||
pub(crate) static RUNTIME: OnceLock<Option<tokio::runtime::Runtime>> = OnceLock::new();
|
pub(crate) static RUNTIME: OnceLock<Option<tokio::runtime::Runtime>> = OnceLock::new();
|
||||||
pub(crate) static SHUTDOWN_LATCH: ShutdownLatch = ShutdownLatch::new();
|
pub(crate) static SHUTDOWN_LATCH: ShutdownLatch = ShutdownLatch::new();
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
/// Serializes signal-triggered cleanups: a signal arriving while a quit
|
||||||
pub enum ShutdownOutcome {
|
/// attempt is still in flight is dropped instead of overlapping it.
|
||||||
Committed,
|
|
||||||
Canceled,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) struct ShutdownLatch {
|
pub(crate) struct ShutdownLatch {
|
||||||
is_cleaning_up: AtomicBool,
|
is_cleaning_up: AtomicBool,
|
||||||
}
|
}
|
||||||
@@ -36,17 +41,18 @@ impl ShutdownLatch {
|
|||||||
.is_ok()
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finish(&self, outcome: ShutdownOutcome) {
|
fn finish(&self) {
|
||||||
if matches!(outcome, ShutdownOutcome::Canceled) {
|
self.is_cleaning_up.store(false, Ordering::Release);
|
||||||
self.is_cleaning_up.store(false, Ordering::Release);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Spawns the Linux signal loop on a dedicated runtime so it survives the
|
||||||
|
/// teardown of any app-owned runtime. The handler runs once per accepted
|
||||||
|
/// signal; the quit flow it invokes owns the exit-or-cancel decision.
|
||||||
pub fn register<F, Fut>(f: F)
|
pub fn register<F, Fut>(f: F)
|
||||||
where
|
where
|
||||||
F: Fn() -> Fut + Send + Sync + 'static,
|
F: Fn() -> Fut + Send + Sync + 'static,
|
||||||
Fut: Future<Output = ShutdownOutcome> + Send + 'static,
|
Fut: Future<Output = ()> + Send + 'static,
|
||||||
{
|
{
|
||||||
RUNTIME.get_or_init(|| match tokio::runtime::Runtime::new() {
|
RUNTIME.get_or_init(|| match tokio::runtime::Runtime::new() {
|
||||||
Ok(rt) => Some(rt),
|
Ok(rt) => Some(rt),
|
||||||
@@ -61,36 +67,22 @@ where
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
unix::register(f);
|
unix::register(f);
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
windows::register(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{ShutdownLatch, ShutdownOutcome};
|
use super::ShutdownLatch;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn canceled_shutdown_releases_latch_and_permits_next_attempt() {
|
fn finished_attempt_releases_latch_for_the_next_signal() {
|
||||||
let latch = ShutdownLatch::new();
|
let latch = ShutdownLatch::new();
|
||||||
|
|
||||||
assert!(latch.try_begin());
|
assert!(latch.try_begin());
|
||||||
assert!(!latch.try_begin());
|
assert!(!latch.try_begin());
|
||||||
|
|
||||||
latch.finish(ShutdownOutcome::Canceled);
|
latch.finish();
|
||||||
|
|
||||||
assert!(latch.try_begin());
|
assert!(latch.try_begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn committed_shutdown_retains_latch_and_suppresses_repeats() {
|
|
||||||
let latch = ShutdownLatch::new();
|
|
||||||
|
|
||||||
assert!(latch.try_begin());
|
|
||||||
latch.finish(ShutdownOutcome::Committed);
|
|
||||||
|
|
||||||
assert!(!latch.try_begin());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
use clash_verge_logging::{Type, logging};
|
use clash_verge_logging::{Type, logging};
|
||||||
use tokio::signal::unix::{SignalKind, signal};
|
use tokio::signal::unix::{SignalKind, signal};
|
||||||
|
|
||||||
use crate::{RUNTIME, SHUTDOWN_LATCH, ShutdownOutcome};
|
use crate::{RUNTIME, SHUTDOWN_LATCH};
|
||||||
|
|
||||||
pub fn register<F, Fut>(f: F)
|
pub fn register<F, Fut>(f: F)
|
||||||
where
|
where
|
||||||
F: Fn() -> Fut + Send + Sync + 'static,
|
F: Fn() -> Fut + Send + Sync + 'static,
|
||||||
Fut: Future<Output = ShutdownOutcome> + Send + 'static,
|
Fut: Future<Output = ()> + Send + 'static,
|
||||||
{
|
{
|
||||||
if let Some(Some(rt)) = RUNTIME.get() {
|
if let Some(Some(rt)) = RUNTIME.get() {
|
||||||
rt.spawn(async move {
|
rt.spawn(async move {
|
||||||
@@ -60,7 +60,8 @@ where
|
|||||||
}
|
}
|
||||||
logging!(info, Type::SystemSignal, "Caught signal {}", signal_name);
|
logging!(info, Type::SystemSignal, "Caught signal {}", signal_name);
|
||||||
|
|
||||||
SHUTDOWN_LATCH.finish(f().await);
|
f().await;
|
||||||
|
SHUTDOWN_LATCH.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
use clash_verge_logging::{Type, logging};
|
|
||||||
use tokio::signal::windows;
|
|
||||||
|
|
||||||
use crate::{RUNTIME, SHUTDOWN_LATCH, ShutdownOutcome};
|
|
||||||
|
|
||||||
pub fn register<F, Fut>(f: F)
|
|
||||||
where
|
|
||||||
F: Fn() -> Fut + Send + Sync + 'static,
|
|
||||||
Fut: Future<Output = ShutdownOutcome> + Send + 'static,
|
|
||||||
{
|
|
||||||
if let Some(Some(rt)) = RUNTIME.get() {
|
|
||||||
rt.spawn(async move {
|
|
||||||
let mut ctrl_c = match windows::ctrl_c() {
|
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => {
|
|
||||||
logging!(error, Type::SystemSignal, "Failed to register Ctrl+C: {}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut ctrl_close = match windows::ctrl_close() {
|
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => {
|
|
||||||
logging!(error, Type::SystemSignal, "Failed to register Ctrl+Close: {}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut ctrl_shutdown = match windows::ctrl_shutdown() {
|
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => {
|
|
||||||
logging!(error, Type::SystemSignal, "Failed to register Ctrl+Shutdown: {}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut ctrl_logoff = match windows::ctrl_logoff() {
|
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => {
|
|
||||||
logging!(error, Type::SystemSignal, "Failed to register Ctrl+Logoff: {}", e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
loop {
|
|
||||||
let signal_name;
|
|
||||||
tokio::select! {
|
|
||||||
_ = ctrl_c.recv() => {
|
|
||||||
signal_name = "Ctrl+C";
|
|
||||||
}
|
|
||||||
_ = ctrl_close.recv() => {
|
|
||||||
signal_name = "Ctrl+Close";
|
|
||||||
}
|
|
||||||
_ = ctrl_shutdown.recv() => {
|
|
||||||
signal_name = "Ctrl+Shutdown";
|
|
||||||
}
|
|
||||||
_ = ctrl_logoff.recv() => {
|
|
||||||
signal_name = "Ctrl+Logoff";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !SHUTDOWN_LATCH.try_begin() {
|
|
||||||
logging!(
|
|
||||||
info,
|
|
||||||
Type::SystemSignal,
|
|
||||||
"Already shutting down, ignoring repeated signal: {}",
|
|
||||||
signal_name
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
logging!(info, Type::SystemSignal, "Caught Windows signal: {}", signal_name);
|
|
||||||
|
|
||||||
SHUTDOWN_LATCH.finish(f().await);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
logging!(
|
|
||||||
error,
|
|
||||||
Type::SystemSignal,
|
|
||||||
"register shutdown signal failed, RUNTIME is not available"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+5
-5
@@ -75,11 +75,11 @@
|
|||||||
"monaco-yaml": "^5.5.1",
|
"monaco-yaml": "^5.5.1",
|
||||||
"nanoid": "^6.0.1",
|
"nanoid": "^6.0.1",
|
||||||
"qrcode.react": "^4.2.0",
|
"qrcode.react": "^4.2.0",
|
||||||
"react": "19.3.0",
|
"react": "19.3.1",
|
||||||
"react-dom": "19.3.0",
|
"react-dom": "19.3.1",
|
||||||
"react-error-boundary": "6.1.6",
|
"react-error-boundary": "6.1.6",
|
||||||
"react-hook-form": "^7.88.0",
|
"react-hook-form": "^7.88.0",
|
||||||
"react-i18next": "17.0.15",
|
"react-i18next": "17.0.18",
|
||||||
"react-markdown": "10.1.0",
|
"react-markdown": "10.1.0",
|
||||||
"react-router": "^8.4.0",
|
"react-router": "^8.4.0",
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
"https-proxy-agent": "^9.1.0",
|
"https-proxy-agent": "^9.1.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"jiti": "^2.7.0",
|
"jiti": "^2.7.0",
|
||||||
"knip": "6.39.0",
|
"knip": "6.41.0",
|
||||||
"lint-staged": "^17.5.1",
|
"lint-staged": "^17.5.1",
|
||||||
"sass": "^1.104.1",
|
"sass": "^1.104.1",
|
||||||
"tar": "^7.5.22",
|
"tar": "^7.5.22",
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
"vite": "^8.3.0",
|
"vite": "^8.3.0",
|
||||||
"vite-plugin-svgr": "^5.2.0",
|
"vite-plugin-svgr": "^5.2.0",
|
||||||
"vitest": "^5.0.1",
|
"vitest": "^5.0.1",
|
||||||
"webdriverio": "10.0.0",
|
"webdriverio": "10.0.2",
|
||||||
"ws": "8.22.0"
|
"ws": "8.22.0"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|||||||
Generated
+252
-248
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,17 @@
|
|||||||
"matchManagers": ["npm"],
|
"matchManagers": ["npm"],
|
||||||
"groupName": "npm dependencies"
|
"groupName": "npm dependencies"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "Update Tauri npm packages and Cargo crates together so frontend and backend stay in sync",
|
||||||
|
"matchPackageNames": [
|
||||||
|
"@tauri-apps/**",
|
||||||
|
"@wdio/tauri-service",
|
||||||
|
"tauri",
|
||||||
|
"tauri-*"
|
||||||
|
],
|
||||||
|
"groupName": "tauri",
|
||||||
|
"addLabels": ["tauri"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"description": "Group all GitHub Actions updates into a single PR",
|
"description": "Group all GitHub Actions updates into a single PR",
|
||||||
"matchManagers": ["github-actions"],
|
"matchManagers": ["github-actions"],
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ try {
|
|||||||
'run',
|
'run',
|
||||||
'-p',
|
'-p',
|
||||||
'clash-verge',
|
'clash-verge',
|
||||||
'--bin',
|
'--example',
|
||||||
'frontend-contract',
|
'frontend-contract',
|
||||||
'--locked',
|
'--locked',
|
||||||
'-q',
|
'-q',
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ tauri-build = { version = "2.7.1", features = [] }
|
|||||||
clash-verge-draft = { workspace = true }
|
clash-verge-draft = { workspace = true }
|
||||||
clash-verge-media-unlock = { workspace = true }
|
clash-verge-media-unlock = { workspace = true }
|
||||||
clash-verge-logging = { workspace = true }
|
clash-verge-logging = { workspace = true }
|
||||||
clash-verge-signal = { workspace = true }
|
|
||||||
clash-verge-i18n = { workspace = true }
|
clash-verge-i18n = { workspace = true }
|
||||||
clash-verge-limiter = { workspace = true }
|
clash-verge-limiter = { workspace = true }
|
||||||
tauri-plugin-clash-verge-sysinfo = { workspace = true }
|
tauri-plugin-clash-verge-sysinfo = { workspace = true }
|
||||||
@@ -97,7 +96,7 @@ backon = { version = "1.6.0", features = ["tokio-sleep"] }
|
|||||||
tauri-plugin-http = "2.8.0"
|
tauri-plugin-http = "2.8.0"
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tauri-plugin-devtools = { version = "2.2.2", optional = true }
|
tauri-plugin-devtools = { version = "2.2.2", optional = true }
|
||||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", branch = "main" }
|
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "7a03d16f4d39b1bb885b7babe66b9e153e34b615" }
|
||||||
async-trait = "0.1.92"
|
async-trait = "0.1.92"
|
||||||
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", tag = "v2.7.6", version = "2.7.6", features = [
|
clash_verge_service_ipc = { git = "https://github.com/clash-verge-rev/clash-verge-service-ipc.git", tag = "v2.7.6", version = "2.7.6", features = [
|
||||||
"client",
|
"client",
|
||||||
@@ -116,6 +115,10 @@ specta-typescript = "=0.0.12"
|
|||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "0.2.190"
|
libc = "0.2.190"
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "linux")'.dependencies]
|
||||||
|
# Upstream has no session-end signal support on Linux; see crates/clash-verge-signal.
|
||||||
|
clash-verge-signal = { workspace = true }
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
tauri-plugin-wdio-webdriver = { version = "=1.4.0", optional = true }
|
tauri-plugin-wdio-webdriver = { version = "=1.4.0", optional = true }
|
||||||
objc2 = "0.6.5"
|
objc2 = "0.6.5"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// Dev-only target: Tauri ships everything under src/bin/ to /usr/bin in deb/rpm
|
||||||
|
// bundles (PR #8131), so this generator must stay an example, never a bin.
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut args = std::env::args_os().skip(1);
|
let mut args = std::env::args_os().skip(1);
|
||||||
let output = args
|
let output = args
|
||||||
@@ -282,7 +282,9 @@ async fn handle_validation_failure(
|
|||||||
) -> CmdResult<ValidationOutcome> {
|
) -> CmdResult<ValidationOutcome> {
|
||||||
logging!(warn, Type::Cmd, "配置验证失败: {}", outcome);
|
logging!(warn, Type::Cmd, "配置验证失败: {}", outcome);
|
||||||
discard_and_restore(current_profile).await?;
|
discard_and_restore(current_profile).await?;
|
||||||
handle_validation_notice(&outcome, ValidationNoticeTarget::Runtime, "运行时配置");
|
if !matches!(outcome, ValidationOutcome::Busy) {
|
||||||
|
handle_validation_notice(&outcome, ValidationNoticeTarget::Runtime, "运行时配置");
|
||||||
|
}
|
||||||
Ok(outcome)
|
Ok(outcome)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,9 +313,6 @@ async fn perform_config_update(
|
|||||||
current_value: Option<&String>,
|
current_value: Option<&String>,
|
||||||
current_profile: Option<&String>,
|
current_profile: Option<&String>,
|
||||||
) -> CmdResult<ValidationOutcome> {
|
) -> CmdResult<ValidationOutcome> {
|
||||||
defer! {
|
|
||||||
CURRENT_SWITCHING_PROFILE.store(false, Ordering::Release);
|
|
||||||
}
|
|
||||||
let update_result = run_profile_config_update_transition(|| CoreManager::global().update_config_forced()).await;
|
let update_result = run_profile_config_update_transition(|| CoreManager::global().update_config_forced()).await;
|
||||||
|
|
||||||
match update_result {
|
match update_result {
|
||||||
@@ -409,6 +408,9 @@ pub async fn patch_profiles_config(profiles: ProfileSelection) -> CmdResult<Vali
|
|||||||
logging!(info, Type::Cmd, "当前正在切换配置,放弃请求");
|
logging!(info, Type::Cmd, "当前正在切换配置,放弃请求");
|
||||||
return Ok(ValidationOutcome::Busy);
|
return Ok(ValidationOutcome::Busy);
|
||||||
}
|
}
|
||||||
|
defer! {
|
||||||
|
CURRENT_SWITCHING_PROFILE.store(false, Ordering::Release);
|
||||||
|
}
|
||||||
let _profile_write_guard = PROFILE_WRITE_LOCK.lock().await;
|
let _profile_write_guard = PROFILE_WRITE_LOCK.lock().await;
|
||||||
|
|
||||||
let profiles = IProfiles {
|
let profiles = IProfiles {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ pub async fn open_or_close_dashboard() {
|
|||||||
logging!(info, Type::Window, "Window toggle result: {result:?}");
|
logging!(info, Type::Window, "Window toggle result: {result:?}");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn quit() -> clash_verge_signal::ShutdownOutcome {
|
pub async fn quit() {
|
||||||
logging!(debug, Type::System, "启动退出流程");
|
logging!(debug, Type::System, "启动退出流程");
|
||||||
// 设置退出标志
|
// 设置退出标志
|
||||||
handle::Handle::global().set_is_exiting();
|
handle::Handle::global().set_is_exiting();
|
||||||
@@ -165,13 +165,11 @@ pub async fn quit() -> clash_verge_signal::ShutdownOutcome {
|
|||||||
NoticeStatus::AppQuitCoreStopFailed,
|
NoticeStatus::AppQuitCoreStopFailed,
|
||||||
cleanup_result.stop_error.unwrap_or_default(),
|
cleanup_result.stop_error.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
return clash_verge_signal::ShutdownOutcome::Canceled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::server::shutdown_embedded_server();
|
utils::server::shutdown_embedded_server();
|
||||||
let app_handle = handle::Handle::app_handle();
|
let app_handle = handle::Handle::app_handle();
|
||||||
app_handle.exit(if cleanup_result.all_success { 0 } else { 1 });
|
app_handle.exit(if cleanup_result.all_success { 0 } else { 1 });
|
||||||
clash_verge_signal::ShutdownOutcome::Committed
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn clean_async() -> CleanupResult {
|
pub async fn clean_async() -> CleanupResult {
|
||||||
|
|||||||
@@ -230,6 +230,7 @@ pub fn run() -> std::process::ExitCode {
|
|||||||
if let Err(panic) = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
if let Err(panic) = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||||
resolve::resolve_setup_async();
|
resolve::resolve_setup_async();
|
||||||
resolve::resolve_setup_sync();
|
resolve::resolve_setup_sync();
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
resolve::init_signal();
|
resolve::init_signal();
|
||||||
})) {
|
})) {
|
||||||
log_setup_panic("window-core", panic);
|
log_setup_panic("window-core", panic);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ fn main() -> ExitCode {
|
|||||||
#[cfg(not(all(feature = "perf-harness", target_os = "macos")))]
|
#[cfg(not(all(feature = "perf-harness", target_os = "macos")))]
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
let default_parallelism = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1);
|
let default_parallelism = std::thread::available_parallelism().map(|n| n.get()).unwrap_or(1);
|
||||||
let worker_limit = std::cmp::min(default_parallelism, 8);
|
let worker_limit = std::cmp::min(default_parallelism, 4);
|
||||||
let blocking_limit = 2 * worker_limit;
|
let blocking_limit = 2 * worker_limit;
|
||||||
|
|
||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::unwrap_used)]
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ use crate::{
|
|||||||
utils::{init, server, window_manager::WindowManager},
|
utils::{init, server, window_manager::WindowManager},
|
||||||
};
|
};
|
||||||
use clash_verge_logging::{Type, logging, logging_error};
|
use clash_verge_logging::{Type, logging, logging_error};
|
||||||
use clash_verge_signal;
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub mod dns;
|
pub mod dns;
|
||||||
@@ -189,6 +188,8 @@ async fn init_silent_updater() {
|
|||||||
logging!(info, Type::Setup, "Silent updater initialized");
|
logging!(info, Type::Setup, "Silent updater initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Upstream has no session-end signal support on Linux; see crates/clash-verge-signal.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
pub(crate) fn init_signal() {
|
pub(crate) fn init_signal() {
|
||||||
logging!(debug, Type::Setup, "Initializing signal handlers...");
|
logging!(debug, Type::Setup, "Initializing signal handlers...");
|
||||||
clash_verge_signal::register(feat::quit);
|
clash_verge_signal::register(feat::quit);
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ static INSTANCE_LOCK: OnceLock<std::fs::File> = OnceLock::new();
|
|||||||
const PAC_INITIAL_AVAILABLE: bool = false;
|
const PAC_INITIAL_AVAILABLE: bool = false;
|
||||||
static PAC_AVAILABLE: AtomicBool = AtomicBool::new(PAC_INITIAL_AVAILABLE);
|
static PAC_AVAILABLE: AtomicBool = AtomicBool::new(PAC_INITIAL_AVAILABLE);
|
||||||
static COMMANDS_READY: AtomicBool = AtomicBool::new(false);
|
static COMMANDS_READY: AtomicBool = AtomicBool::new(false);
|
||||||
#[cfg(feature = "verge-dev")]
|
|
||||||
static DEV_QUIT_REQUESTED: AtomicBool = AtomicBool::new(false);
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum SingletonDisposition {
|
pub enum SingletonDisposition {
|
||||||
@@ -164,55 +162,12 @@ fn instance_auth(token: String) -> impl warp::Filter<Extract = (), Error = warp:
|
|||||||
.untuple_one()
|
.untuple_one()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "verge-dev")]
|
|
||||||
fn dev_quit_route<F>(
|
|
||||||
token: String,
|
|
||||||
commands_ready: &'static AtomicBool,
|
|
||||||
quit_requested: &'static AtomicBool,
|
|
||||||
trigger: F,
|
|
||||||
) -> impl warp::Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone
|
|
||||||
where
|
|
||||||
F: Fn() + Clone + Send + Sync + 'static,
|
|
||||||
{
|
|
||||||
instance_auth(token)
|
|
||||||
.and(warp::path!("commands" / "dev" / "quit"))
|
|
||||||
.and(warp::post())
|
|
||||||
.and_then(move || {
|
|
||||||
let trigger = trigger.clone();
|
|
||||||
async move {
|
|
||||||
if !commands_ready.load(Ordering::Acquire) {
|
|
||||||
return Ok::<_, warp::Rejection>(warp::reply::with_status(
|
|
||||||
String::from("starting"),
|
|
||||||
warp::http::StatusCode::SERVICE_UNAVAILABLE,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
if quit_requested
|
|
||||||
.compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
|
|
||||||
.is_ok()
|
|
||||||
{
|
|
||||||
trigger();
|
|
||||||
}
|
|
||||||
Ok(warp::reply::with_status(
|
|
||||||
String::from("accepted"),
|
|
||||||
warp::http::StatusCode::ACCEPTED,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "verge-dev")]
|
|
||||||
fn release_dev_quit_latch(quit_requested: &AtomicBool, outcome: clash_verge_signal::ShutdownOutcome) {
|
|
||||||
if matches!(outcome, clash_verge_signal::ShutdownOutcome::Canceled) {
|
|
||||||
quit_requested.store(false, Ordering::Release);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn start_embedded_server(listener: tokio::net::TcpListener, token: String) {
|
fn start_embedded_server(listener: tokio::net::TcpListener, token: String) {
|
||||||
let (shutdown_tx, shutdown_rx) = oneshot::channel();
|
let (shutdown_tx, shutdown_rx) = oneshot::channel();
|
||||||
let _ = SHUTDOWN_SENDER.set(Mutex::new(Some(shutdown_tx)));
|
let _ = SHUTDOWN_SENDER.set(Mutex::new(Some(shutdown_tx)));
|
||||||
|
|
||||||
#[cfg(feature = "verge-dev")]
|
#[cfg(feature = "verge-dev")]
|
||||||
let auth = instance_auth(token.clone());
|
let auth = instance_auth(token);
|
||||||
#[cfg(not(feature = "verge-dev"))]
|
#[cfg(not(feature = "verge-dev"))]
|
||||||
let auth = instance_auth(token);
|
let auth = instance_auth(token);
|
||||||
|
|
||||||
@@ -278,12 +233,6 @@ fn start_embedded_server(listener: tokio::net::TcpListener, token: String) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let commands = auth.clone().and(visible).or(auth.and(scheme)).or(pac);
|
let commands = auth.clone().and(visible).or(auth.and(scheme)).or(pac);
|
||||||
#[cfg(feature = "verge-dev")]
|
|
||||||
let commands = commands.or(dev_quit_route(token, &COMMANDS_READY, &DEV_QUIT_REQUESTED, || {
|
|
||||||
AsyncHandler::spawn(|| async {
|
|
||||||
release_dev_quit_latch(&DEV_QUIT_REQUESTED, crate::feat::quit().await);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
AsyncHandler::spawn(move || async move {
|
AsyncHandler::spawn(move || async move {
|
||||||
warp::serve(commands)
|
warp::serve(commands)
|
||||||
.incoming(listener)
|
.incoming(listener)
|
||||||
|
|||||||
@@ -27,8 +27,12 @@ const TRAY_STATUS_ITEM_EXTRA_WIDTH: f64 = 30.0;
|
|||||||
const TRAY_STATUS_ITEM_MIN_LENGTH: f64 = 58.0;
|
const TRAY_STATUS_ITEM_MIN_LENGTH: f64 = 58.0;
|
||||||
const NS_VARIABLE_STATUS_ITEM_LENGTH: f64 = -1.0;
|
const NS_VARIABLE_STATUS_ITEM_LENGTH: f64 = -1.0;
|
||||||
|
|
||||||
|
/// (button_height, mono_advance, attributes).
|
||||||
|
type CachedAttrs = (f64, f64, Retained<NSDictionary<NSString, AnyObject>>);
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static LAST_DISPLAY_STR: RefCell<String> = const { RefCell::new(String::new()) };
|
static LAST_DISPLAY_STR: RefCell<String> = const { RefCell::new(String::new()) };
|
||||||
|
static CACHED_ATTRS: RefCell<Option<CachedAttrs>> = const { RefCell::new(None) };
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_tray_speed(up: u64, down: u64) -> String {
|
fn format_tray_speed(up: u64, down: u64) -> String {
|
||||||
@@ -74,8 +78,26 @@ fn create_attributed_string(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn status_item_length_for_speed(attr_str: &NSAttributedString) -> f64 {
|
/// Attributes and per-glyph advance, rebuilt only when the button height changes.
|
||||||
(attr_str.size().width.ceil() + TRAY_STATUS_ITEM_EXTRA_WIDTH).max(TRAY_STATUS_ITEM_MIN_LENGTH)
|
fn cached_attributes(button_height: f64) -> (f64, Retained<NSDictionary<NSString, AnyObject>>) {
|
||||||
|
CACHED_ATTRS.with(|cache| {
|
||||||
|
if let Some((height, advance, attrs)) = cache.borrow().as_ref()
|
||||||
|
&& *height == button_height
|
||||||
|
{
|
||||||
|
return (*advance, attrs.clone());
|
||||||
|
}
|
||||||
|
let attrs = build_attributes(button_height);
|
||||||
|
let probe = NSString::from_str("0");
|
||||||
|
let advance = create_attributed_string(&probe, Some(&attrs)).size().width;
|
||||||
|
*cache.borrow_mut() = Some((button_height, advance, attrs.clone()));
|
||||||
|
(advance, attrs)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Longest line times the monospaced advance; matches `size().width` for the ASCII-only speed text.
|
||||||
|
fn arithmetic_width(text: &str, advance: f64) -> f64 {
|
||||||
|
let glyphs = text.split('\n').map(str::len).max().unwrap_or(0) as f64;
|
||||||
|
glyphs * advance
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sync_click_target_frame(button: &NSStatusBarButton) {
|
fn sync_click_target_frame(button: &NSStatusBarButton) {
|
||||||
@@ -89,7 +111,7 @@ fn sync_click_target_frame(button: &NSStatusBarButton) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// `with_inner_tray_icon` should run this on the main thread; fail safely if it does not.
|
/// `with_inner_tray_icon` should run this on the main thread; fail safely if it does not.
|
||||||
fn apply_status_item_attributed_title(status_item: &NSStatusItem, text: &NSString, show_speed: bool) {
|
fn apply_status_item_attributed_title(status_item: &NSStatusItem, text: &str, show_speed: bool) {
|
||||||
let Some(mtm) = MainThreadMarker::new() else {
|
let Some(mtm) = MainThreadMarker::new() else {
|
||||||
logging!(warn, Type::Tray, "托盘速率富文本设置跳过:非主线程调用");
|
logging!(warn, Type::Tray, "托盘速率富文本设置跳过:非主线程调用");
|
||||||
return;
|
return;
|
||||||
@@ -97,17 +119,19 @@ fn apply_status_item_attributed_title(status_item: &NSStatusItem, text: &NSStrin
|
|||||||
let Some(button) = status_item.button(mtm) else {
|
let Some(button) = status_item.button(mtm) else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
let ns_string = NSString::from_str(text);
|
||||||
let attr_str = if show_speed {
|
let attr_str = if show_speed {
|
||||||
let attrs = build_attributes(button.bounds().size.height);
|
let (advance, attrs) = cached_attributes(button.bounds().size.height);
|
||||||
let attrs: &NSDictionary<NSString, AnyObject> = &attrs;
|
let attrs: &NSDictionary<NSString, AnyObject> = &attrs;
|
||||||
let attr_str = create_attributed_string(text, Some(attrs));
|
let attr_str = create_attributed_string(&ns_string, Some(attrs));
|
||||||
let length = status_item_length_for_speed(&attr_str);
|
let width = arithmetic_width(text, advance);
|
||||||
|
let length = (width.ceil() + TRAY_STATUS_ITEM_EXTRA_WIDTH).max(TRAY_STATUS_ITEM_MIN_LENGTH);
|
||||||
if status_item.length() != length {
|
if status_item.length() != length {
|
||||||
status_item.setLength(length);
|
status_item.setLength(length);
|
||||||
}
|
}
|
||||||
attr_str
|
attr_str
|
||||||
} else {
|
} else {
|
||||||
create_attributed_string(text, None)
|
create_attributed_string(&ns_string, None)
|
||||||
};
|
};
|
||||||
button.setAttributedTitle(&attr_str);
|
button.setAttributedTitle(&attr_str);
|
||||||
sync_click_target_frame(&button);
|
sync_click_target_frame(&button);
|
||||||
@@ -121,8 +145,7 @@ pub fn set_speed_attributed_title(status_item: &NSStatusItem, up: u64, down: u64
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*last = speed_text;
|
*last = speed_text;
|
||||||
let ns_string = NSString::from_str(last.as_str());
|
apply_status_item_attributed_title(status_item, last.as_str(), true);
|
||||||
apply_status_item_attributed_title(status_item, &ns_string, true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +153,6 @@ pub fn clear_speed_attributed_title(status_item: &NSStatusItem) {
|
|||||||
LAST_DISPLAY_STR.with(|last| {
|
LAST_DISPLAY_STR.with(|last| {
|
||||||
last.borrow_mut().clear();
|
last.borrow_mut().clear();
|
||||||
});
|
});
|
||||||
let empty = NSString::from_str("");
|
|
||||||
status_item.setLength(NS_VARIABLE_STATUS_ITEM_LENGTH);
|
status_item.setLength(NS_VARIABLE_STATUS_ITEM_LENGTH);
|
||||||
apply_status_item_attributed_title(status_item, &empty, false);
|
apply_status_item_attributed_title(status_item, "", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import {
|
|||||||
ProxyGroupNavigator,
|
ProxyGroupNavigator,
|
||||||
} from './proxy-group-navigator'
|
} from './proxy-group-navigator'
|
||||||
import { ProxyRender } from './proxy-render'
|
import { ProxyRender } from './proxy-render'
|
||||||
|
import type { HeadState } from './use-head-state'
|
||||||
import {
|
import {
|
||||||
PROXY_GROUP_HEADER_SENSORS,
|
PROXY_GROUP_HEADER_SENSORS,
|
||||||
useProxyGroupHeaderLayout,
|
useProxyGroupHeaderLayout,
|
||||||
@@ -90,11 +91,11 @@ function useProxyRenderState(
|
|||||||
) {
|
) {
|
||||||
const { verge } = useVerge()
|
const { verge } = useVerge()
|
||||||
const { proxyView } = useProxiesData()
|
const { proxyView } = useProxiesData()
|
||||||
const { renderList, onProxies, onHeadState } = useRenderList(
|
const {
|
||||||
mode,
|
renderList,
|
||||||
isChainMode,
|
onProxies,
|
||||||
activeSelectedGroup,
|
onHeadState: setListHeadState,
|
||||||
)
|
} = useRenderList(mode, isChainMode, activeSelectedGroup)
|
||||||
const scrollPositionKey = useMemo(
|
const scrollPositionKey = useMemo(
|
||||||
() =>
|
() =>
|
||||||
isChainMode
|
isChainMode
|
||||||
@@ -103,6 +104,14 @@ function useProxyRenderState(
|
|||||||
[activeSelectedGroup, isChainMode, mode],
|
[activeSelectedGroup, isChainMode, mode],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const onHeadState = useCallback(
|
||||||
|
(groupName: string, patch: Partial<HeadState>) => {
|
||||||
|
if (patch.open) onProxies()
|
||||||
|
setListHeadState(groupName, patch)
|
||||||
|
},
|
||||||
|
[onProxies, setListHeadState],
|
||||||
|
)
|
||||||
|
|
||||||
const timeout = verge?.default_latency_timeout || 10000
|
const timeout = verge?.default_latency_timeout || 10000
|
||||||
|
|
||||||
const handleCheckAll = useStableCallback(
|
const handleCheckAll = useStableCallback(
|
||||||
|
|||||||
@@ -1,20 +1,11 @@
|
|||||||
import Visibility from '@mui/icons-material/Visibility'
|
import { Button, Grid, Stack, TextField } from '@mui/material'
|
||||||
import VisibilityOff from '@mui/icons-material/VisibilityOff'
|
|
||||||
import {
|
|
||||||
TextField,
|
|
||||||
Button,
|
|
||||||
Grid,
|
|
||||||
Stack,
|
|
||||||
IconButton,
|
|
||||||
InputAdornment,
|
|
||||||
} from '@mui/material'
|
|
||||||
import { useLockFn } from 'ahooks'
|
import { useLockFn } from 'ahooks'
|
||||||
import { useState, useRef, memo, useEffect } from 'react'
|
import { memo, useEffect, useRef } from 'react'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
import { useVerge } from '@/hooks/use-verge'
|
import { useVerge } from '@/hooks/use-verge'
|
||||||
import { saveWebdavConfig, createWebdavBackup } from '@/services/cmds'
|
import { createWebdavBackup, saveWebdavConfig } from '@/services/cmds'
|
||||||
import { mutate } from '@/services/mutate'
|
import { mutate } from '@/services/mutate'
|
||||||
import { errorDetail, showNotice } from '@/services/notice-service'
|
import { errorDetail, showNotice } from '@/services/notice-service'
|
||||||
import {
|
import {
|
||||||
@@ -43,7 +34,6 @@ export const BackupConfigViewer = memo(
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { verge, mutateVerge } = useVerge()
|
const { verge, mutateVerge } = useVerge()
|
||||||
const { webdav_url, webdav_username, webdav_password } = verge || {}
|
const { webdav_url, webdav_username, webdav_password } = verge || {}
|
||||||
const [showPassword, setShowPassword] = useState(false)
|
|
||||||
const usernameRef = useRef<HTMLInputElement>(null)
|
const usernameRef = useRef<HTMLInputElement>(null)
|
||||||
const passwordRef = useRef<HTMLInputElement>(null)
|
const passwordRef = useRef<HTMLInputElement>(null)
|
||||||
const urlRef = useRef<HTMLInputElement>(null)
|
const urlRef = useRef<HTMLInputElement>(null)
|
||||||
@@ -68,10 +58,6 @@ export const BackupConfigViewer = memo(
|
|||||||
const webdavStatus = getWebdavStatus(webdavSignature)
|
const webdavStatus = getWebdavStatus(webdavSignature)
|
||||||
const shouldAutoInit = webdavStatus !== 'failed'
|
const shouldAutoInit = webdavStatus !== 'failed'
|
||||||
|
|
||||||
const handleClickShowPassword = () => {
|
|
||||||
setShowPassword((prev) => !prev)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!webdav_url || !webdav_username || !webdav_password) {
|
if (!webdav_url || !webdav_username || !webdav_password) {
|
||||||
return
|
return
|
||||||
@@ -215,7 +201,7 @@ export const BackupConfigViewer = memo(
|
|||||||
<Grid size={{ xs: 6 }}>
|
<Grid size={{ xs: 6 }}>
|
||||||
<TextField
|
<TextField
|
||||||
label={t('shared.labels.password')}
|
label={t('shared.labels.password')}
|
||||||
type={showPassword ? 'text' : 'password'}
|
type="password"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
size="small"
|
size="small"
|
||||||
autoCorrect="off"
|
autoCorrect="off"
|
||||||
@@ -223,20 +209,6 @@ export const BackupConfigViewer = memo(
|
|||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
inputRef={passwordRef}
|
inputRef={passwordRef}
|
||||||
{...register('password')}
|
{...register('password')}
|
||||||
slotProps={{
|
|
||||||
input: {
|
|
||||||
endAdornment: (
|
|
||||||
<InputAdornment position="end">
|
|
||||||
<IconButton
|
|
||||||
onClick={handleClickShowPassword}
|
|
||||||
edge="end"
|
|
||||||
>
|
|
||||||
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
||||||
</IconButton>
|
|
||||||
</InputAdornment>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export const useProfiles = () => {
|
|||||||
try {
|
try {
|
||||||
const result = await mutate(() => patchProfilesConfig(value), {
|
const result = await mutate(() => patchProfilesConfig(value), {
|
||||||
id: 'patch-profiles-config',
|
id: 'patch-profiles-config',
|
||||||
|
errorNotice: false,
|
||||||
onFulfilled: (outcome) => {
|
onFulfilled: (outcome) => {
|
||||||
if (outcome.status === 'valid') {
|
if (outcome.status === 'valid') {
|
||||||
void setCacheData<IProfilesConfig>(profilesQueryKey, (current) =>
|
void setCacheData<IProfilesConfig>(profilesQueryKey, (current) =>
|
||||||
@@ -60,12 +61,8 @@ export const useProfiles = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
// Backend Busy keeps local state untouched, as before.
|
|
||||||
return result.value
|
|
||||||
}
|
|
||||||
const outcome = result.value
|
const outcome = result.value
|
||||||
if (outcome.status !== 'valid' && outcome.status !== 'busy') {
|
if (outcome.status !== 'valid') {
|
||||||
await mutateProfiles()
|
await mutateProfiles()
|
||||||
}
|
}
|
||||||
return outcome
|
return outcome
|
||||||
|
|||||||
+207
-216
@@ -32,230 +32,221 @@ export const forgetShownStartupError = () => {
|
|||||||
* type makes a backend status without a frontend entry a compile error (and
|
* type makes a backend status without a frontend entry a compile error (and
|
||||||
* contract regeneration keeps the union in sync).
|
* contract regeneration keeps the union in sync).
|
||||||
*/
|
*/
|
||||||
|
const handlers: Record<
|
||||||
|
NoticeStatus,
|
||||||
|
(msg: string, navigate: NavigateFunction) => void
|
||||||
|
> = {
|
||||||
|
info: (msg) => {
|
||||||
|
if (msg) showNotice.info(msg)
|
||||||
|
},
|
||||||
|
'import_sub_url::ok': (_msg, navigate) => {
|
||||||
|
// 空 msg 传入,我们不希望导致 后端-前端-后端 死循环,这里只做提醒。
|
||||||
|
// 未来细分事件通知时,可以考虑传入订阅 ID 或其他标识符
|
||||||
|
// navigate("/profile", { state: { current: msg } });
|
||||||
|
navigate('/profile')
|
||||||
|
showNotice.success(
|
||||||
|
'shared.feedback.notifications.importSubscriptionSuccess',
|
||||||
|
)
|
||||||
|
},
|
||||||
|
'import_sub_url::error': (msg, navigate) => {
|
||||||
|
navigate('/profile')
|
||||||
|
showNotice.error(msg)
|
||||||
|
},
|
||||||
|
'set_config::error': (msg) => showNotice.error(msg),
|
||||||
|
'core_start::error': () => {
|
||||||
|
const read = ++startupErrorReads
|
||||||
|
void getCoreStartupError()
|
||||||
|
.then(async (failure) => {
|
||||||
|
if (read < settledStartupErrorRead) return
|
||||||
|
settledStartupErrorRead = read
|
||||||
|
if (!failure) {
|
||||||
|
shownStartupError = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const window = getCurrentWindow()
|
||||||
|
const [visible, minimized] = await Promise.all([
|
||||||
|
window.isVisible(),
|
||||||
|
window.isMinimized(),
|
||||||
|
])
|
||||||
|
const shown = `${failure.kind}:${failure.detail}`
|
||||||
|
if (
|
||||||
|
read === settledStartupErrorRead &&
|
||||||
|
visible &&
|
||||||
|
!minimized &&
|
||||||
|
shownStartupError !== shown
|
||||||
|
) {
|
||||||
|
shownStartupError = shown
|
||||||
|
showNotice.error(
|
||||||
|
failure.kind === 'serviceCoreStopped'
|
||||||
|
? 'settings.feedback.errors.clash.serviceCoreStopped'
|
||||||
|
: 'settings.feedback.errors.clash.startFailed',
|
||||||
|
failure.detail,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Failed to read the pending core startup error', error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'service_core::repair_required': () => {
|
||||||
|
void takeServiceRepairNotice()
|
||||||
|
.then((pending) => {
|
||||||
|
if (pending) {
|
||||||
|
requestService({ reason: 'serviceLocationRefused' })
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Failed to read the pending service repair notice', error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'service_core::app_data_not_owned': () => {
|
||||||
|
void takeServiceOwnerNotice()
|
||||||
|
.then((command) => {
|
||||||
|
if (command) {
|
||||||
|
if (shownOwnerNotice !== null) hideNotice(shownOwnerNotice)
|
||||||
|
shownOwnerNotice = showNotice.warning(
|
||||||
|
'settings.feedback.notifications.clashService.appDataNotOwned',
|
||||||
|
{ command },
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Failed to read the pending service owner notice', error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'service_core::sidecar_fallback': () => {
|
||||||
|
void takeServiceFallbackNotice()
|
||||||
|
.then((notice) => {
|
||||||
|
if (notice?.kind === 'coreRejected') {
|
||||||
|
showNotice.warning(
|
||||||
|
'settings.feedback.notifications.clashService.permissionFallback',
|
||||||
|
{ reason: notice.reason },
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
} else if (notice?.kind === 'notAutoStarted') {
|
||||||
|
requestService({ reason: 'serviceNotAutoStarted' })
|
||||||
|
} else if (notice) {
|
||||||
|
showNotice.warning(
|
||||||
|
'settings.feedback.notifications.clashService.sidecarFallback',
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(
|
||||||
|
'Failed to read the pending service fallback notice',
|
||||||
|
error,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'dns_override::auto_disabled': () => {
|
||||||
|
void takeDnsOverrideNotice()
|
||||||
|
.then((pending) => {
|
||||||
|
if (pending) {
|
||||||
|
showNotice.info('settings.modals.dns.protection.autoDisabled')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Failed to read the pending DNS override notice', error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'enhance::discarded_keys': () => {
|
||||||
|
void takeDiscardedKeysNotice()
|
||||||
|
.then((keys) => {
|
||||||
|
if (keys) {
|
||||||
|
showNotice.warning('profiles.page.feedback.notices.discardedKeys', {
|
||||||
|
keys,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Failed to read the pending discarded keys notice', error)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'tun_mode::auto_disabled': () =>
|
||||||
|
showNotice.info(
|
||||||
|
'settings.sections.system.notifications.tunMode.autoDisabled',
|
||||||
|
),
|
||||||
|
'tun_mode::auto_disable_failed': () =>
|
||||||
|
showNotice.error(
|
||||||
|
'settings.sections.system.notifications.tunMode.autoDisableFailed',
|
||||||
|
),
|
||||||
|
'app_restart::core_stop_failed': (msg) =>
|
||||||
|
showNotice.error(
|
||||||
|
'layout.feedback.errors.restartCoreStopFailed',
|
||||||
|
msg || undefined,
|
||||||
|
),
|
||||||
|
'app_quit::core_stop_failed': (msg) =>
|
||||||
|
showNotice.error(
|
||||||
|
'layout.feedback.errors.quitCoreStopFailed',
|
||||||
|
msg || undefined,
|
||||||
|
),
|
||||||
|
update_with_clash_proxy: (msg) =>
|
||||||
|
showNotice.success(
|
||||||
|
'settings.feedback.notifications.updater.withClashProxySuccess',
|
||||||
|
msg,
|
||||||
|
),
|
||||||
|
update_failed_even_with_clash: (msg) =>
|
||||||
|
showNotice.error(
|
||||||
|
'settings.feedback.notifications.updater.withClashProxyFailed',
|
||||||
|
msg,
|
||||||
|
),
|
||||||
|
'reactivate_profiles::error': (msg) => showNotice.error(msg),
|
||||||
|
update_failed: (msg) => showNotice.error(msg),
|
||||||
|
'config_validate::boot_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.config.bootFailed', msg),
|
||||||
|
'config_validate::error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.config.failed', msg),
|
||||||
|
'config_validate::process_terminated': () =>
|
||||||
|
showNotice.error('shared.feedback.validation.config.processTerminated'),
|
||||||
|
'config_validate::script_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.script.fileError', msg),
|
||||||
|
'config_validate::script_syntax_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.script.syntaxError', msg),
|
||||||
|
'config_validate::script_missing_main': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.script.missingMain', msg),
|
||||||
|
'config_validate::file_not_found': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.script.fileNotFound', msg),
|
||||||
|
'config_validate::yaml_syntax_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.yaml.syntaxError', msg),
|
||||||
|
'config_validate::yaml_read_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.yaml.readError', msg),
|
||||||
|
'config_validate::yaml_mapping_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.yaml.mappingError', msg),
|
||||||
|
'config_validate::merge_syntax_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.merge.syntaxError', msg),
|
||||||
|
'config_validate::merge_mapping_error': (msg) =>
|
||||||
|
showNotice.error('shared.feedback.validation.merge.mappingError', msg),
|
||||||
|
'config_core::change_success': (msg) =>
|
||||||
|
showNotice.success(
|
||||||
|
'settings.feedback.notifications.clash.changeSuccess',
|
||||||
|
msg,
|
||||||
|
),
|
||||||
|
'config_core::change_error': (msg) =>
|
||||||
|
showNotice.error('settings.feedback.notifications.clash.changeFailed', msg),
|
||||||
|
'mixed_port::fallback': (msg) => {
|
||||||
|
const [oldPort, newPort] = msg.split(',')
|
||||||
|
showNotice.info('settings.modals.clashPort.messages.automaticFallback', {
|
||||||
|
oldPort,
|
||||||
|
newPort,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
'mixed_port::fallback_error': (msg) =>
|
||||||
|
showNotice.error(
|
||||||
|
'settings.modals.clashPort.messages.automaticFallbackFailed',
|
||||||
|
{ error: msg },
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
export const handleNoticeMessage = (
|
export const handleNoticeMessage = (
|
||||||
status: string,
|
status: string,
|
||||||
msg: string,
|
msg: string,
|
||||||
t: TranslateFunction,
|
t: TranslateFunction,
|
||||||
navigate: NavigateFunction,
|
navigate: NavigateFunction,
|
||||||
) => {
|
) => {
|
||||||
const handlers: Record<NoticeStatus, () => void> = {
|
|
||||||
info: () => {
|
|
||||||
if (msg) showNotice.info(msg)
|
|
||||||
},
|
|
||||||
'import_sub_url::ok': () => {
|
|
||||||
// 空 msg 传入,我们不希望导致 后端-前端-后端 死循环,这里只做提醒。
|
|
||||||
// 未来细分事件通知时,可以考虑传入订阅 ID 或其他标识符
|
|
||||||
// navigate("/profile", { state: { current: msg } });
|
|
||||||
navigate('/profile')
|
|
||||||
showNotice.success(
|
|
||||||
'shared.feedback.notifications.importSubscriptionSuccess',
|
|
||||||
)
|
|
||||||
},
|
|
||||||
'import_sub_url::error': () => {
|
|
||||||
navigate('/profile')
|
|
||||||
showNotice.error(msg)
|
|
||||||
},
|
|
||||||
'set_config::error': () => showNotice.error(msg),
|
|
||||||
'core_start::error': () => {
|
|
||||||
const read = ++startupErrorReads
|
|
||||||
void getCoreStartupError()
|
|
||||||
.then(async (failure) => {
|
|
||||||
if (read < settledStartupErrorRead) return
|
|
||||||
settledStartupErrorRead = read
|
|
||||||
if (!failure) {
|
|
||||||
shownStartupError = null
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const window = getCurrentWindow()
|
|
||||||
const [visible, minimized] = await Promise.all([
|
|
||||||
window.isVisible(),
|
|
||||||
window.isMinimized(),
|
|
||||||
])
|
|
||||||
const shown = `${failure.kind}:${failure.detail}`
|
|
||||||
if (
|
|
||||||
read === settledStartupErrorRead &&
|
|
||||||
visible &&
|
|
||||||
!minimized &&
|
|
||||||
shownStartupError !== shown
|
|
||||||
) {
|
|
||||||
shownStartupError = shown
|
|
||||||
showNotice.error(
|
|
||||||
failure.kind === 'serviceCoreStopped'
|
|
||||||
? 'settings.feedback.errors.clash.serviceCoreStopped'
|
|
||||||
: 'settings.feedback.errors.clash.startFailed',
|
|
||||||
failure.detail,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Failed to read the pending core startup error', error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'service_core::repair_required': () => {
|
|
||||||
void takeServiceRepairNotice()
|
|
||||||
.then((pending) => {
|
|
||||||
if (pending) {
|
|
||||||
requestService({ reason: 'serviceLocationRefused' })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(
|
|
||||||
'Failed to read the pending service repair notice',
|
|
||||||
error,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'service_core::app_data_not_owned': () => {
|
|
||||||
void takeServiceOwnerNotice()
|
|
||||||
.then((command) => {
|
|
||||||
if (command) {
|
|
||||||
if (shownOwnerNotice !== null) hideNotice(shownOwnerNotice)
|
|
||||||
shownOwnerNotice = showNotice.warning(
|
|
||||||
'settings.feedback.notifications.clashService.appDataNotOwned',
|
|
||||||
{ command },
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(
|
|
||||||
'Failed to read the pending service owner notice',
|
|
||||||
error,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'service_core::sidecar_fallback': () => {
|
|
||||||
void takeServiceFallbackNotice()
|
|
||||||
.then((notice) => {
|
|
||||||
if (notice?.kind === 'coreRejected') {
|
|
||||||
showNotice.warning(
|
|
||||||
'settings.feedback.notifications.clashService.permissionFallback',
|
|
||||||
{ reason: notice.reason },
|
|
||||||
0,
|
|
||||||
)
|
|
||||||
} else if (notice?.kind === 'notAutoStarted') {
|
|
||||||
requestService({ reason: 'serviceNotAutoStarted' })
|
|
||||||
} else if (notice) {
|
|
||||||
showNotice.warning(
|
|
||||||
'settings.feedback.notifications.clashService.sidecarFallback',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(
|
|
||||||
'Failed to read the pending service fallback notice',
|
|
||||||
error,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'dns_override::auto_disabled': () => {
|
|
||||||
void takeDnsOverrideNotice()
|
|
||||||
.then((pending) => {
|
|
||||||
if (pending) {
|
|
||||||
showNotice.info('settings.modals.dns.protection.autoDisabled')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('Failed to read the pending DNS override notice', error)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'enhance::discarded_keys': () => {
|
|
||||||
void takeDiscardedKeysNotice()
|
|
||||||
.then((keys) => {
|
|
||||||
if (keys) {
|
|
||||||
showNotice.warning('profiles.page.feedback.notices.discardedKeys', {
|
|
||||||
keys,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error(
|
|
||||||
'Failed to read the pending discarded keys notice',
|
|
||||||
error,
|
|
||||||
)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'tun_mode::auto_disabled': () =>
|
|
||||||
showNotice.info(
|
|
||||||
'settings.sections.system.notifications.tunMode.autoDisabled',
|
|
||||||
),
|
|
||||||
'tun_mode::auto_disable_failed': () =>
|
|
||||||
showNotice.error(
|
|
||||||
'settings.sections.system.notifications.tunMode.autoDisableFailed',
|
|
||||||
),
|
|
||||||
'app_restart::core_stop_failed': () =>
|
|
||||||
showNotice.error(
|
|
||||||
'layout.feedback.errors.restartCoreStopFailed',
|
|
||||||
msg || undefined,
|
|
||||||
),
|
|
||||||
'app_quit::core_stop_failed': () =>
|
|
||||||
showNotice.error(
|
|
||||||
'layout.feedback.errors.quitCoreStopFailed',
|
|
||||||
msg || undefined,
|
|
||||||
),
|
|
||||||
update_with_clash_proxy: () =>
|
|
||||||
showNotice.success(
|
|
||||||
'settings.feedback.notifications.updater.withClashProxySuccess',
|
|
||||||
msg,
|
|
||||||
),
|
|
||||||
update_failed_even_with_clash: () =>
|
|
||||||
showNotice.error(
|
|
||||||
'settings.feedback.notifications.updater.withClashProxyFailed',
|
|
||||||
msg,
|
|
||||||
),
|
|
||||||
'reactivate_profiles::error': () => showNotice.error(msg),
|
|
||||||
update_failed: () => showNotice.error(msg),
|
|
||||||
'config_validate::boot_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.config.bootFailed', msg),
|
|
||||||
'config_validate::error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.config.failed', msg),
|
|
||||||
'config_validate::process_terminated': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.config.processTerminated'),
|
|
||||||
'config_validate::script_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.script.fileError', msg),
|
|
||||||
'config_validate::script_syntax_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.script.syntaxError', msg),
|
|
||||||
'config_validate::script_missing_main': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.script.missingMain', msg),
|
|
||||||
'config_validate::file_not_found': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.script.fileNotFound', msg),
|
|
||||||
'config_validate::yaml_syntax_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.yaml.syntaxError', msg),
|
|
||||||
'config_validate::yaml_read_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.yaml.readError', msg),
|
|
||||||
'config_validate::yaml_mapping_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.yaml.mappingError', msg),
|
|
||||||
'config_validate::merge_syntax_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.merge.syntaxError', msg),
|
|
||||||
'config_validate::merge_mapping_error': () =>
|
|
||||||
showNotice.error('shared.feedback.validation.merge.mappingError', msg),
|
|
||||||
'config_core::change_success': () =>
|
|
||||||
showNotice.success(
|
|
||||||
'settings.feedback.notifications.clash.changeSuccess',
|
|
||||||
msg,
|
|
||||||
),
|
|
||||||
'config_core::change_error': () =>
|
|
||||||
showNotice.error(
|
|
||||||
'settings.feedback.notifications.clash.changeFailed',
|
|
||||||
msg,
|
|
||||||
),
|
|
||||||
'mixed_port::fallback': () => {
|
|
||||||
const [oldPort, newPort] = msg.split(',')
|
|
||||||
showNotice.info('settings.modals.clashPort.messages.automaticFallback', {
|
|
||||||
oldPort,
|
|
||||||
newPort,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
'mixed_port::fallback_error': () =>
|
|
||||||
showNotice.error(
|
|
||||||
'settings.modals.clashPort.messages.automaticFallbackFailed',
|
|
||||||
{ error: msg },
|
|
||||||
),
|
|
||||||
}
|
|
||||||
|
|
||||||
const handler = handlers[status as NoticeStatus]
|
const handler = handlers[status as NoticeStatus]
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handler()
|
handler(msg, navigate)
|
||||||
} else {
|
} else {
|
||||||
console.warn(`未处理的通知状态: ${status}`)
|
console.warn(`未处理的通知状态: ${status}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ const withLoading = (
|
|||||||
next.delete(uid)
|
next.delete(uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (next.size === state.profileUpdates.loading.size) return state
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
profileUpdates: { ...state.profileUpdates, loading: next },
|
profileUpdates: { ...state.profileUpdates, loading: next },
|
||||||
|
|||||||
Reference in New Issue
Block a user