mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-03 20:30:11 +08:00
chore(runtime): sync the profile refactor
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
"version": "v9.0.0",
|
||||
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
|
||||
},
|
||||
"github/gh-aw-actions/setup@v1.4.2": {
|
||||
"github/gh-aw-actions/setup@v1.4.5": {
|
||||
"repo": "github/gh-aw-actions/setup",
|
||||
"version": "v1.4.2",
|
||||
"sha": "d7852d91d5d1d13e7848771edab8bd1792a08651"
|
||||
"version": "v1.4.5",
|
||||
"sha": "a83eaf07e756a15e65f669eb32d00787cf5a2569"
|
||||
}
|
||||
},
|
||||
"containers": {
|
||||
@@ -199,13 +199,13 @@
|
||||
},
|
||||
"ghcr.io/github/gh-aw-node": {
|
||||
"image": "ghcr.io/github/gh-aw-node",
|
||||
"digest": "sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc",
|
||||
"pinned_image": "ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc"
|
||||
"digest": "sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f",
|
||||
"pinned_image": "ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"
|
||||
},
|
||||
"ghcr.io/github/github-mcp-server:v2.2.0": {
|
||||
"image": "ghcr.io/github/github-mcp-server:v2.2.0",
|
||||
"digest": "sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174",
|
||||
"pinned_image": "ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174"
|
||||
"ghcr.io/github/github-mcp-server:v2.3.0": {
|
||||
"image": "ghcr.io/github/github-mcp-server:v2.3.0",
|
||||
"digest": "sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6",
|
||||
"pinned_image": "ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install gh-aw extension
|
||||
uses: github/gh-aw-actions/setup-cli@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup-cli@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
version: v1.4.2
|
||||
version: v1.4.5
|
||||
- name: Install Rust Stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
|
||||
+38
-33
@@ -1,6 +1,6 @@
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4ca5835c0c9cd01f3432b873f5a177ca6d3d1dbd6a35939e2058dcb37aa224b4","body_hash":"ca82fafbe18061d7c8bd708dc18e91b9116faf0c921a7fa35be1538d47a2b005","compiler_version":"v1.4.2","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"d7852d91d5d1d13e7848771edab8bd1792a08651","version":"v1.4.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc","pinned_image":"ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc"},{"image":"ghcr.io/github/github-mcp-server:v2.2.0","digest":"sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174","pinned_image":"ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","add_labels","noop","remove_labels","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"4ca5835c0c9cd01f3432b873f5a177ca6d3d1dbd6a35939e2058dcb37aa224b4","body_hash":"ca82fafbe18061d7c8bd708dc18e91b9116faf0c921a7fa35be1538d47a2b005","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","add_labels","noop","remove_labels","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
# / _ \ | | (_)
|
||||
@@ -44,12 +44,12 @@
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
# - github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
#
|
||||
# Container images used:
|
||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||
# - ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc
|
||||
# - ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174
|
||||
# - ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f
|
||||
# - ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6
|
||||
# - ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad
|
||||
# - ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca
|
||||
# - ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -152,7 +152,7 @@ jobs:
|
||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.2"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||
GH_AW_INFO_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||
@@ -271,7 +271,7 @@ jobs:
|
||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
GH_AW_COMPILED_VERSION: "v1.4.2"
|
||||
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||
GH_AW_WORKFLOW_NAME: "PR AI Slop Review"
|
||||
@@ -558,7 +558,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -654,7 +654,7 @@ jobs:
|
||||
run: "node <<'NODE'\nconst fs = require('fs');\nconst harnessPath = `${process.env.RUNNER_TEMP}/gh-aw/actions/copilot_harness.cjs`;\nconst harness = fs.readFileSync(harnessPath, 'utf8');\nconst quotaBranch = [\n ' if (isQuotaExceeded && (result.retryAfterMs == null || /\\\\bquota exceeded\\\\b/i.test(result.output))) {',\n ' log(`attempt ${attempt + 1}: Copilot quota exceeded — not retrying`);',\n ' return { action: \"stop\" };',\n ' }',\n].join('\\n');\nconst nonBlockingQuotaBranch = [\n ' let quotaErrorMsg = null;',\n ' if (isQuotaExceeded && (result.retryAfterMs == null || /\\\\bquota exceeded\\\\b/i.test(result.output))) {',\n ' log(`attempt ${attempt + 1}: Copilot quota exceeded — not retrying`);',\n ' quotaErrorMsg = { action: \"stop\" };',\n ' }',\n ' if (/\\\\b429\\\\b|Too Many Requests/i.test(result.output)) {',\n ' log(`attempt ${attempt + 1}: Copilot quota unavailable — exiting 0`);',\n ' quotaErrorMsg = { action: \"stop\", exitCode: 0 };',\n ' }',\n ' if (quotaErrorMsg) {',\n ' return quotaErrorMsg;',\n ' }',\n].join('\\n');\n\nif (harness.split(quotaBranch).length !== 2) {\n throw new Error('Unexpected Copilot quota branch; re-audit the gh-aw upgrade');\n}\nfs.writeFileSync(harnessPath, harness.replace(quotaBranch, nonBlockingQuotaBranch));\nNODE"
|
||||
|
||||
- name: Download container images
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059 ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174 ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059 ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6 ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
- name: Prepare Safe Outputs Directories
|
||||
run: |
|
||||
mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
|
||||
@@ -899,12 +899,12 @@ jobs:
|
||||
|
||||
mkdir -p "$HOME/.copilot"
|
||||
GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
|
||||
cat << GH_AW_MCP_CONFIG_d448207cb151e2cb_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
|
||||
cat << GH_AW_MCP_CONFIG_36d6009112b7e687_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
|
||||
{
|
||||
"mcpServers": {
|
||||
"safeoutputs": {
|
||||
"type": "stdio",
|
||||
"container": "ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc",
|
||||
"container": "ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f",
|
||||
"mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"],
|
||||
"args": ["-w", "\${GITHUB_WORKSPACE}"],
|
||||
"entrypoint": "sh",
|
||||
@@ -963,7 +963,7 @@ jobs:
|
||||
}
|
||||
}
|
||||
}
|
||||
GH_AW_MCP_CONFIG_d448207cb151e2cb_EOF
|
||||
GH_AW_MCP_CONFIG_36d6009112b7e687_EOF
|
||||
- name: Mount MCP servers as CLIs
|
||||
id: mount-mcp-clis
|
||||
continue-on-error: true
|
||||
@@ -1104,7 +1104,7 @@ jobs:
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||
GH_AW_VERSION: v1.4.2
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
@@ -1197,8 +1197,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
run: |
|
||||
mkdir -p /tmp/gh-aw
|
||||
cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" file "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl || true
|
||||
- name: Ingest agent output
|
||||
id: collect_output
|
||||
if: always()
|
||||
@@ -1417,7 +1416,7 @@ jobs:
|
||||
permissions:
|
||||
actions: read # Read workflow runs and artifacts for workflow context.
|
||||
id-token: write # Request an OIDC token for authenticated services.
|
||||
issues: write # Create or update issues and comments.
|
||||
issues: write # Enabled by issue reporting, safe outputs, steering, work queues, reaction cleanup, or explicit job permissions.
|
||||
pull-requests: write # Create or update pull requests and review comments.
|
||||
concurrency:
|
||||
group: "gh-aw-conclusion-pr-ai-slop-review-${{ inputs.pr_number }}"
|
||||
@@ -1437,7 +1436,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1816,7 +1815,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1830,11 +1829,12 @@ jobs:
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
- name: Download activation artifact
|
||||
id: download-detection-activation
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: activation
|
||||
path: /tmp/gh-aw
|
||||
path: ${{ runner.temp }}/gh-aw-detection-activation
|
||||
- name: Download agent output artifact
|
||||
id: download-agent-output
|
||||
continue-on-error: true
|
||||
@@ -1855,6 +1855,10 @@ jobs:
|
||||
- name: Clear agent token usage
|
||||
if: always()
|
||||
run: rm -f /tmp/gh-aw/agent_usage.json
|
||||
- name: Restore activation metadata
|
||||
if: always()
|
||||
run: |
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/restore_detection_activation_metadata.sh" "${RUNNER_TEMP}/gh-aw-detection-activation" "/tmp/gh-aw"
|
||||
- name: Checkout repository for patch context
|
||||
if: needs.agent.outputs.has_patch == 'true'
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -1903,8 +1907,10 @@ jobs:
|
||||
- name: Prepare threat detection files
|
||||
id: detection_prepare
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
env:
|
||||
ACTIVATION_DOWNLOAD_OUTCOME: ${{ steps.download-detection-activation.outcome }}
|
||||
run: |
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/prepare_threat_detection_files.sh"
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/prepare_detection_inputs.sh" "${RUNNER_TEMP}/gh-aw-detection-activation" "/tmp/gh-aw"
|
||||
- name: Install AWF binary
|
||||
id: detection_awf_install
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||
@@ -1921,7 +1927,7 @@ jobs:
|
||||
GH_AW_COPILOT_MIN_VERSION: 1.0.35
|
||||
- name: Execute threat detection with AWF
|
||||
id: detection_agentic_execution
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_staging_reset.outcome == 'success' && steps.detection_prepare.outcome == 'success' && steps.detection_awf_install.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.detection_awf_install.outcome == 'success'
|
||||
continue-on-error: true
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
@@ -1934,11 +1940,11 @@ jobs:
|
||||
GH_AW_LLM_PROVIDER: github
|
||||
GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}
|
||||
GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
|
||||
GH_AW_MODEL_FALLBACK: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_MODEL_FALLBACK: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'detection' }}
|
||||
GH_AW_PHASE: detection
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_TIMEOUT_MINUTES: 10
|
||||
GH_AW_VERSION: v1.4.2
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||
@@ -2023,9 +2029,8 @@ jobs:
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall
|
||||
if [ -d /tmp/gh-aw/sandbox/firewall/logs ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/logs && cp -r /tmp/gh-aw/sandbox/firewall/logs/. /tmp/gh-aw/threat-detection/sandbox/firewall/logs/; fi
|
||||
if [ -d /tmp/gh-aw/sandbox/firewall/audit ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/audit && cp -r /tmp/gh-aw/sandbox/firewall/audit/. /tmp/gh-aw/threat-detection/sandbox/firewall/audit/; fi
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" tree /tmp/gh-aw/sandbox/firewall/logs /tmp/gh-aw/threat-detection/sandbox/firewall/logs
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" tree /tmp/gh-aw/sandbox/firewall/audit /tmp/gh-aw/threat-detection/sandbox/firewall/audit
|
||||
- name: Redact secrets in detection logs
|
||||
id: redact_detection_logs
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
@@ -2046,7 +2051,7 @@ jobs:
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Parse threat detection token usage for step summary
|
||||
id: parse_detection_token_usage
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
@@ -2082,7 +2087,7 @@ jobs:
|
||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Render detection log
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
@@ -2094,7 +2099,7 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||
await main();
|
||||
- name: Upload threat detection artifact
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: detection
|
||||
@@ -2110,7 +2115,7 @@ jobs:
|
||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||
- name: Conclude threat detection
|
||||
id: detection_conclusion
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
|
||||
env:
|
||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
@@ -2182,7 +2187,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
|
||||
Generated
+39
-34
@@ -1,6 +1,6 @@
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d6b72464a3766dd7d74aefe4c7dd982ae7ae2db951f8040f978feca9166adb39","body_hash":"deddd98c5fa425a91487fb5f50dc59ac61ae395bdcd4dff6543f1e8e563a7d73","compiler_version":"v1.4.2","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"d7852d91d5d1d13e7848771edab8bd1792a08651","version":"v1.4.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc","pinned_image":"ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc"},{"image":"ghcr.io/github/github-mcp-server:v2.2.0","digest":"sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174","pinned_image":"ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"d6b72464a3766dd7d74aefe4c7dd982ae7ae2db951f8040f978feca9166adb39","body_hash":"deddd98c5fa425a91487fb5f50dc59ac61ae395bdcd4dff6543f1e8e563a7d73","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
# / _ \ | | (_)
|
||||
@@ -43,12 +43,12 @@
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
# - github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
#
|
||||
# Container images used:
|
||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||
# - ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc
|
||||
# - ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174
|
||||
# - ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f
|
||||
# - ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6
|
||||
# - ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad
|
||||
# - ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca
|
||||
# - ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.2"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||
GH_AW_INFO_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||
@@ -284,7 +284,7 @@ jobs:
|
||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
GH_AW_COMPILED_VERSION: "v1.4.2"
|
||||
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||
GH_AW_WORKFLOW_NAME: "Verify Review Fixes"
|
||||
@@ -596,7 +596,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -693,7 +693,7 @@ jobs:
|
||||
GH_AW_SKILL_DIR: ".github/skills"
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh"
|
||||
- name: Download container images
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059 ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174 ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059 ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6 ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
- name: Prepare Safe Outputs Directories
|
||||
run: |
|
||||
mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
|
||||
@@ -902,12 +902,12 @@ jobs:
|
||||
|
||||
mkdir -p "$HOME/.copilot"
|
||||
GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
|
||||
cat << GH_AW_MCP_CONFIG_e9f853f8279889ed_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
|
||||
cat << GH_AW_MCP_CONFIG_060492a5ed2a5139_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
|
||||
{
|
||||
"mcpServers": {
|
||||
"safeoutputs": {
|
||||
"type": "stdio",
|
||||
"container": "ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc",
|
||||
"container": "ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f",
|
||||
"mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"],
|
||||
"args": ["-w", "\${GITHUB_WORKSPACE}"],
|
||||
"entrypoint": "sh",
|
||||
@@ -965,7 +965,7 @@ jobs:
|
||||
}
|
||||
}
|
||||
}
|
||||
GH_AW_MCP_CONFIG_e9f853f8279889ed_EOF
|
||||
GH_AW_MCP_CONFIG_060492a5ed2a5139_EOF
|
||||
- name: Mount MCP servers as CLIs
|
||||
id: mount-mcp-clis
|
||||
continue-on-error: true
|
||||
@@ -1105,7 +1105,7 @@ jobs:
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||
GH_AW_VERSION: v1.4.2
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
@@ -1198,8 +1198,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
run: |
|
||||
mkdir -p /tmp/gh-aw
|
||||
cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" file "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl || true
|
||||
- name: Ingest agent output
|
||||
id: collect_output
|
||||
if: always()
|
||||
@@ -1419,7 +1418,7 @@ jobs:
|
||||
permissions:
|
||||
actions: read # Read workflow runs and artifacts for workflow context.
|
||||
id-token: write # Request an OIDC token for authenticated services.
|
||||
issues: write # Create or update issues and comments.
|
||||
issues: write # Enabled by issue reporting, safe outputs, steering, work queues, reaction cleanup, or explicit job permissions.
|
||||
pull-requests: write # Create or update pull requests and review comments.
|
||||
concurrency:
|
||||
group: "gh-aw-conclusion-pr-verify-fix-${{ github.event.issue.number || inputs.pr_number || github.run_id }}"
|
||||
@@ -1439,7 +1438,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1818,7 +1817,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1832,11 +1831,12 @@ jobs:
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
- name: Download activation artifact
|
||||
id: download-detection-activation
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: activation
|
||||
path: /tmp/gh-aw
|
||||
path: ${{ runner.temp }}/gh-aw-detection-activation
|
||||
- name: Download agent output artifact
|
||||
id: download-agent-output
|
||||
continue-on-error: true
|
||||
@@ -1857,6 +1857,10 @@ jobs:
|
||||
- name: Clear agent token usage
|
||||
if: always()
|
||||
run: rm -f /tmp/gh-aw/agent_usage.json
|
||||
- name: Restore activation metadata
|
||||
if: always()
|
||||
run: |
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/restore_detection_activation_metadata.sh" "${RUNNER_TEMP}/gh-aw-detection-activation" "/tmp/gh-aw"
|
||||
- name: Checkout repository for patch context
|
||||
if: needs.agent.outputs.has_patch == 'true'
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -1905,8 +1909,10 @@ jobs:
|
||||
- name: Prepare threat detection files
|
||||
id: detection_prepare
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
env:
|
||||
ACTIVATION_DOWNLOAD_OUTCOME: ${{ steps.download-detection-activation.outcome }}
|
||||
run: |
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/prepare_threat_detection_files.sh"
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/prepare_detection_inputs.sh" "${RUNNER_TEMP}/gh-aw-detection-activation" "/tmp/gh-aw"
|
||||
- name: Install AWF binary
|
||||
id: detection_awf_install
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||
@@ -1923,7 +1929,7 @@ jobs:
|
||||
GH_AW_COPILOT_MIN_VERSION: 1.0.35
|
||||
- name: Execute threat detection with AWF
|
||||
id: detection_agentic_execution
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_staging_reset.outcome == 'success' && steps.detection_prepare.outcome == 'success' && steps.detection_awf_install.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.detection_awf_install.outcome == 'success'
|
||||
continue-on-error: true
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
@@ -1936,11 +1942,11 @@ jobs:
|
||||
GH_AW_LLM_PROVIDER: github
|
||||
GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}
|
||||
GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
|
||||
GH_AW_MODEL_FALLBACK: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_MODEL_FALLBACK: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'detection' }}
|
||||
GH_AW_PHASE: detection
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_TIMEOUT_MINUTES: 10
|
||||
GH_AW_VERSION: v1.4.2
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||
@@ -2025,9 +2031,8 @@ jobs:
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall
|
||||
if [ -d /tmp/gh-aw/sandbox/firewall/logs ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/logs && cp -r /tmp/gh-aw/sandbox/firewall/logs/. /tmp/gh-aw/threat-detection/sandbox/firewall/logs/; fi
|
||||
if [ -d /tmp/gh-aw/sandbox/firewall/audit ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/audit && cp -r /tmp/gh-aw/sandbox/firewall/audit/. /tmp/gh-aw/threat-detection/sandbox/firewall/audit/; fi
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" tree /tmp/gh-aw/sandbox/firewall/logs /tmp/gh-aw/threat-detection/sandbox/firewall/logs
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" tree /tmp/gh-aw/sandbox/firewall/audit /tmp/gh-aw/threat-detection/sandbox/firewall/audit
|
||||
- name: Redact secrets in detection logs
|
||||
id: redact_detection_logs
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
@@ -2048,7 +2053,7 @@ jobs:
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Parse threat detection token usage for step summary
|
||||
id: parse_detection_token_usage
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
@@ -2084,7 +2089,7 @@ jobs:
|
||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Render detection log
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
@@ -2096,7 +2101,7 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||
await main();
|
||||
- name: Upload threat detection artifact
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: detection
|
||||
@@ -2112,7 +2117,7 @@ jobs:
|
||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||
- name: Conclude threat detection
|
||||
id: detection_conclusion
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
|
||||
env:
|
||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
@@ -2145,7 +2150,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -2240,7 +2245,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
|
||||
+38
-33
@@ -1,6 +1,6 @@
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e44852fbf56eab99e67b3f6a306f75195603ece6ed130e55652a2467efed1415","body_hash":"7835f25016082d56592b67f4d2bf5b839eb02a6fa8f03d65699ed6bae979c5ad","compiler_version":"v1.4.2","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"d7852d91d5d1d13e7848771edab8bd1792a08651","version":"v1.4.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc","pinned_image":"ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc"},{"image":"ghcr.io/github/github-mcp-server:v2.2.0","digest":"sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174","pinned_image":"ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"e44852fbf56eab99e67b3f6a306f75195603ece6ed130e55652a2467efed1415","body_hash":"7835f25016082d56592b67f4d2bf5b839eb02a6fa8f03d65699ed6bae979c5ad","compiler_version":"v1.4.5","strict":true,"agent_id":"copilot","engine_versions":{"copilot":"1.0.103"}}
|
||||
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_GITHUB_TOKEN","GH_AW_DEFAULT_OTLP_ENDPOINT","GH_AW_DEFAULT_OTLP_HEADERS","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"9000827ccba6bdab643e8b6fd33ac0654aef8333","version":"v8.0.2"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"949feb2413d6458794dcd2491c4babbbce0c15c1","version":"v7.1.0"},{"repo":"actions/upload-artifact","sha":"cf430e030ddbb5b0abf93d22962f4752f3646cd9","version":"v7.0.2"},{"repo":"github/gh-aw-actions/setup","sha":"a83eaf07e756a15e65f669eb32d00787cf5a2569","version":"v1.4.5"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7"},{"image":"ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.5.16","digest":"sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f","pinned_image":"ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f"},{"image":"ghcr.io/github/github-mcp-server:v2.3.0","digest":"sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6","pinned_image":"ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6"}],"mcp_servers":[{"name":"safeoutputs","tools":["add_comment","noop","report_incomplete","report_missing_data","report_missing_tool"]}],"threat_detection":{"mode":"enabled"},"admission":false,"agent_metadata":{"14ba41178a91b10b7de6":{"name":"Agentic Workflows"}}}
|
||||
# This file was automatically generated by gh-aw (v1.4.5). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md
|
||||
#
|
||||
# ___ _ _
|
||||
# / _ \ | | (_)
|
||||
@@ -43,12 +43,12 @@
|
||||
# - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
# - actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
# - actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
# - github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
# - github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
#
|
||||
# Container images used:
|
||||
# - ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059
|
||||
# - ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc
|
||||
# - ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174
|
||||
# - ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f
|
||||
# - ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6
|
||||
# - ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad
|
||||
# - ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca
|
||||
# - ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7
|
||||
@@ -133,7 +133,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -155,7 +155,7 @@ jobs:
|
||||
GH_AW_INFO_MODEL: ${{ vars.GH_AW_MODEL_AGENT_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_INFO_VERSION: "1.0.103"
|
||||
GH_AW_INFO_AGENT_VERSION: "1.0.103"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.2"
|
||||
GH_AW_INFO_CLI_VERSION: "v1.4.5"
|
||||
GH_AW_INFO_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
GH_AW_INFO_WORKFLOW_ID: ${{ job.workflow_ref }}
|
||||
GH_AW_INFO_WORKFLOW_SHA: ${{ job.workflow_sha }}
|
||||
@@ -274,7 +274,7 @@ jobs:
|
||||
if: steps.daily-ai-credits-workflow-guardrail.outputs.daily_ai_credits_guardrail_status != 'quota_blocked'
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
GH_AW_COMPILED_VERSION: "v1.4.2"
|
||||
GH_AW_COMPILED_VERSION: "v1.4.5"
|
||||
GH_AW_HAS_SAFE_OUTPUTS: "true"
|
||||
GH_AW_BLOCKED_VERSION_REPORT_AS_ISSUE: "false"
|
||||
GH_AW_WORKFLOW_NAME: "Renovate Minor Upgrade Analysis"
|
||||
@@ -562,7 +562,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -674,7 +674,7 @@ jobs:
|
||||
GH_AW_SKILL_DIR: ".github/skills"
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_skills.sh"
|
||||
- name: Download container images
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059 ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc ghcr.io/github/github-mcp-server:v2.2.0@sha256:040c4e99810076035eb1d9beb4b4a96fcf589c43cefed6ff51a46a553eb4e174 ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-mcpg:v0.5.16@sha256:cd50cfae3acce5985985aee3964902c9358dcc809f1b68b8168cfe29b761b059 ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f ghcr.io/github/github-mcp-server:v2.3.0@sha256:f8ee4dedc7d5c8cb32854ab91cc92a31c55a8a5510708cf8742e9f9427588ca6 ghcr.io/github/gh-aw-firewall/agent:0.29.22@sha256:f5829ed92ec390e9c88c9d393556a16f0442c124c0d6b9c713e7544cb0efa5ad ghcr.io/github/gh-aw-firewall/api-proxy:0.29.22@sha256:02149f4ed8b9c0bae954932745f2d16e8c5bd2b37adec5f788344806cd063dca ghcr.io/github/gh-aw-firewall/cli-proxy:0.29.22@sha256:7b8ef50c5221824a425fbfabafb50767c5a4e6b0197a0fce6085fd9f7e97b5b7 ghcr.io/github/gh-aw-firewall/router:0.29.22@sha256:b4253735af3ab47c17bcdfaf86e91b541581e1338d3d9ead512a12ebd3f146fb ghcr.io/github/gh-aw-firewall/squid:0.29.22@sha256:cf4dd8944eb5b389adcf49f42de0e884f46e07d63afc5824543e7c9ab8ddb882
|
||||
- name: Prepare Safe Outputs Directories
|
||||
run: |
|
||||
mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs"
|
||||
@@ -885,12 +885,12 @@ jobs:
|
||||
|
||||
mkdir -p "$HOME/.copilot"
|
||||
GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node)
|
||||
cat << GH_AW_MCP_CONFIG_d448207cb151e2cb_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
|
||||
cat << GH_AW_MCP_CONFIG_36d6009112b7e687_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs"
|
||||
{
|
||||
"mcpServers": {
|
||||
"safeoutputs": {
|
||||
"type": "stdio",
|
||||
"container": "ghcr.io/github/gh-aw-node@sha256:8735428c2d4e602f90781ba0c571c400e8ff93c7ee1508a75d71f87e34e415cc",
|
||||
"container": "ghcr.io/github/gh-aw-node@sha256:1ee08ba84b321ff231ca905b73e6e7da8f5fd177bcc6433a56631fce2b5a0f2f",
|
||||
"mounts": ["\${GITHUB_WORKSPACE}:\${GITHUB_WORKSPACE}:rw", "${RUNNER_TEMP}/gh-aw/safeoutputs:${RUNNER_TEMP}/gh-aw/safeoutputs:rw", "/tmp/gh-aw:/tmp/gh-aw:rw"],
|
||||
"args": ["-w", "\${GITHUB_WORKSPACE}"],
|
||||
"entrypoint": "sh",
|
||||
@@ -949,7 +949,7 @@ jobs:
|
||||
}
|
||||
}
|
||||
}
|
||||
GH_AW_MCP_CONFIG_d448207cb151e2cb_EOF
|
||||
GH_AW_MCP_CONFIG_36d6009112b7e687_EOF
|
||||
- name: Mount MCP servers as CLIs
|
||||
id: mount-mcp-clis
|
||||
continue-on-error: true
|
||||
@@ -1094,7 +1094,7 @@ jobs:
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
GH_AW_TIMEOUT_MINUTES: ${{ fromJSON(vars.GH_AW_DEFAULT_TIMEOUT_MINUTES || '20') }}
|
||||
GH_AW_VERSION: v1.4.2
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_TOKEN || github.token }}
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
@@ -1193,8 +1193,7 @@ jobs:
|
||||
env:
|
||||
GH_AW_SAFE_OUTPUTS: ${{ steps.set-runtime-paths.outputs.GH_AW_SAFE_OUTPUTS }}
|
||||
run: |
|
||||
mkdir -p /tmp/gh-aw
|
||||
cp "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl 2>/dev/null || true
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" file "$GH_AW_SAFE_OUTPUTS" /tmp/gh-aw/safeoutputs.jsonl || true
|
||||
- name: Ingest agent output
|
||||
id: collect_output
|
||||
if: always()
|
||||
@@ -1413,7 +1412,7 @@ jobs:
|
||||
permissions:
|
||||
actions: read # Read workflow runs and artifacts for workflow context.
|
||||
id-token: write # Request an OIDC token for authenticated services.
|
||||
issues: write # Create or update issues and comments.
|
||||
issues: write # Enabled by issue reporting, safe outputs, steering, work queues, reaction cleanup, or explicit job permissions.
|
||||
pull-requests: write # Create or update pull requests and review comments.
|
||||
concurrency:
|
||||
group: "gh-aw-conclusion-renovate-minor-review-${{ inputs.pr_number }}"
|
||||
@@ -1433,7 +1432,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1812,7 +1811,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
@@ -1826,11 +1825,12 @@ jobs:
|
||||
GH_AW_INFO_ENGINE_ID: "copilot"
|
||||
GH_AW_SETUP_AW_CONTEXT: ${{ inputs.aw_context }}
|
||||
- name: Download activation artifact
|
||||
id: download-detection-activation
|
||||
continue-on-error: true
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: activation
|
||||
path: /tmp/gh-aw
|
||||
path: ${{ runner.temp }}/gh-aw-detection-activation
|
||||
- name: Download agent output artifact
|
||||
id: download-agent-output
|
||||
continue-on-error: true
|
||||
@@ -1851,6 +1851,10 @@ jobs:
|
||||
- name: Clear agent token usage
|
||||
if: always()
|
||||
run: rm -f /tmp/gh-aw/agent_usage.json
|
||||
- name: Restore activation metadata
|
||||
if: always()
|
||||
run: |
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/restore_detection_activation_metadata.sh" "${RUNNER_TEMP}/gh-aw-detection-activation" "/tmp/gh-aw"
|
||||
- name: Checkout repository for patch context
|
||||
if: needs.agent.outputs.has_patch == 'true'
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
@@ -1899,8 +1903,10 @@ jobs:
|
||||
- name: Prepare threat detection files
|
||||
id: detection_prepare
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
env:
|
||||
ACTIVATION_DOWNLOAD_OUTCOME: ${{ steps.download-detection-activation.outcome }}
|
||||
run: |
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/prepare_threat_detection_files.sh"
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/prepare_detection_inputs.sh" "${RUNNER_TEMP}/gh-aw-detection-activation" "/tmp/gh-aw"
|
||||
- name: Install AWF binary
|
||||
id: detection_awf_install
|
||||
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.29.22 --rootless
|
||||
@@ -1917,7 +1923,7 @@ jobs:
|
||||
GH_AW_COPILOT_MIN_VERSION: 1.0.35
|
||||
- name: Execute threat detection with AWF
|
||||
id: detection_agentic_execution
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_staging_reset.outcome == 'success' && steps.detection_prepare.outcome == 'success' && steps.detection_awf_install.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.detection_staging_reset.outcome == 'success' && steps.detection_awf_install.outcome == 'success'
|
||||
continue-on-error: true
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
@@ -1930,11 +1936,11 @@ jobs:
|
||||
GH_AW_LLM_PROVIDER: github
|
||||
GH_AW_MAX_AI_CREDITS: ${{ vars.GH_AW_DEFAULT_DETECTION_MAX_AI_CREDITS || '400' }}
|
||||
GH_AW_MAX_TURNS: ${{ vars.GH_AW_DEFAULT_MAX_TURNS || '' }}
|
||||
GH_AW_MODEL_FALLBACK: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'auto' }}
|
||||
GH_AW_MODEL_FALLBACK: ${{ vars.GH_AW_MODEL_DETECTION_COPILOT || vars.GH_AW_DEFAULT_MODEL_COPILOT || 'detection' }}
|
||||
GH_AW_PHASE: detection
|
||||
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
|
||||
GH_AW_TIMEOUT_MINUTES: 10
|
||||
GH_AW_VERSION: v1.4.2
|
||||
GH_AW_VERSION: v1.4.5
|
||||
GITHUB_API_URL: ${{ github.api_url }}
|
||||
GITHUB_AW: true
|
||||
GITHUB_COPILOT_INTEGRATION_ID: agentic-workflows
|
||||
@@ -2019,9 +2025,8 @@ jobs:
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
continue-on-error: true
|
||||
run: |
|
||||
mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall
|
||||
if [ -d /tmp/gh-aw/sandbox/firewall/logs ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/logs && cp -r /tmp/gh-aw/sandbox/firewall/logs/. /tmp/gh-aw/threat-detection/sandbox/firewall/logs/; fi
|
||||
if [ -d /tmp/gh-aw/sandbox/firewall/audit ]; then mkdir -p /tmp/gh-aw/threat-detection/sandbox/firewall/audit && cp -r /tmp/gh-aw/sandbox/firewall/audit/. /tmp/gh-aw/threat-detection/sandbox/firewall/audit/; fi
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" tree /tmp/gh-aw/sandbox/firewall/logs /tmp/gh-aw/threat-detection/sandbox/firewall/logs
|
||||
bash "${RUNNER_TEMP}/gh-aw/actions/safe_copy.sh" tree /tmp/gh-aw/sandbox/firewall/audit /tmp/gh-aw/threat-detection/sandbox/firewall/audit
|
||||
- name: Redact secrets in detection logs
|
||||
id: redact_detection_logs
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true'
|
||||
@@ -2042,7 +2047,7 @@ jobs:
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Parse threat detection token usage for step summary
|
||||
id: parse_detection_token_usage
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
@@ -2078,7 +2083,7 @@ jobs:
|
||||
const { persistDetectionMasks } = require(path.join(actionsDir, 'detection_mask_state.cjs'));
|
||||
await main({ additionalDirectories: ["/tmp/gh-aw/threat-detection/sandbox/firewall"], persistDetectionMasks });
|
||||
- name: Render detection log
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success'
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
@@ -2090,7 +2095,7 @@ jobs:
|
||||
const { main } = require(path.join(actionsDir, 'render_detection_log.cjs'));
|
||||
await main();
|
||||
- name: Upload threat detection artifact
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success' && steps.detection_staging_reset.outcome == 'success'
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: detection
|
||||
@@ -2106,7 +2111,7 @@ jobs:
|
||||
retention-days: ${{ vars.GH_AW_DEFAULT_ARTIFACT_RETENTION_DAYS || '0' }}
|
||||
- name: Conclude threat detection
|
||||
id: detection_conclusion
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
|
||||
if: always() && steps.detection_guard.outputs.run_detection == 'false' || (always() && steps.detection_guard.outputs.run_detection == 'true' && steps.detection_prepare.outcome == 'success' && steps.redact_detection_logs.outcome == 'success' && steps.redact_detection_artifacts.outcome == 'success')
|
||||
env:
|
||||
RUN_DETECTION: ${{ steps.detection_guard.outputs.run_detection }}
|
||||
DETECTION_AGENTIC_EXECUTION_OUTCOME: ${{ steps.detection_agentic_execution.outcome }}
|
||||
@@ -2178,7 +2183,7 @@ jobs:
|
||||
steps:
|
||||
- name: Setup Scripts
|
||||
id: setup
|
||||
uses: github/gh-aw-actions/setup@d7852d91d5d1d13e7848771edab8bd1792a08651 # v1.4.2
|
||||
uses: github/gh-aw-actions/setup@a83eaf07e756a15e65f669eb32d00787cf5a2569 # v1.4.5
|
||||
with:
|
||||
destination: ${{ runner.temp }}/gh-aw/actions
|
||||
job-name: ${{ github.job }}
|
||||
|
||||
Generated
+628
-530
File diff suppressed because it is too large
Load Diff
+8
-2
@@ -57,6 +57,7 @@ split-debuginfo = "unpacked"
|
||||
[patch.crates-io]
|
||||
# Backport Windows menu command ID recycling on the muda 0.20 compatibility branch.
|
||||
muda = { git = "https://github.com/wonfen/muda.git", rev = "547de49352791653fbdfa785f20f3c7ece8468e2" }
|
||||
tauri-plugin-wdio-webdriver = { git = "https://github.com/Tunglies/desktop-mobile.git", rev = "2745082c7f487c5e0c9568000b5a7ac24234d6e4" }
|
||||
|
||||
[workspace.dependencies]
|
||||
clash-verge-config-render = { path = "crates/clash-verge-config-render" }
|
||||
@@ -78,7 +79,7 @@ tracing-estuary = { git = "https://github.com/Tunglies/tracing-estuary.git", bra
|
||||
tauri-plugin-clash-verge-sysinfo = { path = "crates/tauri-plugin-clash-verge-sysinfo" }
|
||||
tracing = "0.1.44"
|
||||
|
||||
tauri = { version = "2.12.7" }
|
||||
tauri = { version = "2.13.0" }
|
||||
tauri-plugin-clipboard-manager = "2.5.0"
|
||||
parking_lot = "0.13.0"
|
||||
anyhow = "1.0.105"
|
||||
@@ -86,6 +87,8 @@ thiserror = "2.0.20"
|
||||
zip = "9.9.0"
|
||||
boa_engine = "0.22.0"
|
||||
futures = "0.3.34"
|
||||
loom = "0.7.3"
|
||||
proptest = "1.12.0"
|
||||
chrono = "0.4.45"
|
||||
criterion = { version = "0.8.2", features = ["async_tokio"] }
|
||||
tokio = { version = "1.54.1", features = [
|
||||
@@ -115,7 +118,7 @@ socket2 = "0.6.5"
|
||||
|
||||
# *** For Windows platform only ***
|
||||
deelevate = "0.2.0"
|
||||
windows-sys = { version = "0.61.2", features = [
|
||||
windows-sys = { version = "0.101.0", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_NetworkManagement_IpHelper",
|
||||
"Win32_Networking_WinSock",
|
||||
@@ -128,6 +131,9 @@ windows-sys = { version = "0.61.2", features = [
|
||||
] }
|
||||
# *********************************
|
||||
|
||||
[workspace.lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }
|
||||
|
||||
[workspace.lints.clippy]
|
||||
# fallible_impl_from = "deny" // 过于激进,暂时不开启
|
||||
# implicit_clone = "deny" // 可能会造成额外开销,暂时不开启
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
**🐧 Linux**
|
||||
|
||||
- 修复 Linux OpenRC 环境下服务安装失败
|
||||
- 修复 Linux 左键点击托盘图标时无法唤回主窗口
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -4,10 +4,4 @@ pub enum ArchiveError {
|
||||
Zip(#[from] zip::result::ZipError),
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("backup contains a symbolic link")]
|
||||
Symlink,
|
||||
#[error("backup contains an invalid path")]
|
||||
InvalidPath,
|
||||
#[error("archive contains profile recovery data")]
|
||||
ReservedEntry,
|
||||
}
|
||||
|
||||
@@ -2,11 +2,8 @@ mod error;
|
||||
|
||||
pub use error::ArchiveError;
|
||||
|
||||
use std::{
|
||||
io::{self, Read, Seek, Write},
|
||||
path::{Component, Path},
|
||||
};
|
||||
use zip::{CompressionMethod, ZipArchive, ZipWriter, write::SimpleFileOptions};
|
||||
use std::io::{Seek, Write};
|
||||
use zip::{CompressionMethod, ZipWriter, write::SimpleFileOptions};
|
||||
|
||||
pub struct BackupWriter<W: Write + Seek> {
|
||||
zip: ZipWriter<W>,
|
||||
@@ -35,55 +32,20 @@ impl<W: Write + Seek> BackupWriter<W> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ValidatedBackup<R: Read + Seek> {
|
||||
zip: ZipArchive<R>,
|
||||
}
|
||||
|
||||
impl<R: Read + Seek> ValidatedBackup<R> {
|
||||
pub fn open(source: R, reserved_names: &[&str]) -> Result<Self, ArchiveError> {
|
||||
let mut zip = ZipArchive::new(source)?;
|
||||
for index in 0..zip.len() {
|
||||
let mut entry = zip.by_index(index)?;
|
||||
if entry.is_symlink() {
|
||||
return Err(ArchiveError::Symlink);
|
||||
}
|
||||
let path = entry.enclosed_name().ok_or(ArchiveError::InvalidPath)?;
|
||||
for component in path.components() {
|
||||
let Component::Normal(name) = component else {
|
||||
continue;
|
||||
};
|
||||
let name = name.to_string_lossy();
|
||||
if reserved_names
|
||||
.iter()
|
||||
.any(|reserved| name.eq_ignore_ascii_case(reserved))
|
||||
{
|
||||
return Err(ArchiveError::ReservedEntry);
|
||||
}
|
||||
}
|
||||
io::copy(&mut entry, &mut io::sink())?;
|
||||
}
|
||||
Ok(Self { zip })
|
||||
}
|
||||
|
||||
pub fn extract_to(mut self, destination: &Path) -> Result<(), ArchiveError> {
|
||||
self.zip.extract(destination)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::Cursor;
|
||||
use std::io::{Cursor, Read as _};
|
||||
use zip::ZipArchive;
|
||||
|
||||
#[test]
|
||||
fn writes_and_validates_the_backup_layout() -> Result<(), ArchiveError> {
|
||||
fn writes_the_backup_layout() -> Result<(), ArchiveError> {
|
||||
let mut writer = BackupWriter::new(Cursor::new(Vec::new()))?;
|
||||
writer.start_profile("example.yaml")?.write_all(b"proxies: []\n")?;
|
||||
writer.start_file("profiles.yaml")?.write_all(b"items: []\n")?;
|
||||
let source = writer.finish()?;
|
||||
|
||||
let mut zip = ZipArchive::new(source.clone())?;
|
||||
let mut zip = ZipArchive::new(source)?;
|
||||
assert_eq!(zip.len(), 3);
|
||||
assert_eq!(zip.by_index(0)?.name()?, "profiles/");
|
||||
let profile_time = {
|
||||
@@ -98,7 +60,6 @@ mod tests {
|
||||
let index = zip.by_index(2)?;
|
||||
assert_eq!(index.name()?, "profiles.yaml");
|
||||
assert_eq!(index.last_modified(), profile_time);
|
||||
ValidatedBackup::open(source, &[".profile-refresh", ".profile-refresh.lock"])?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
pin::pin,
|
||||
sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
},
|
||||
task::{Context, Poll, Wake, Waker},
|
||||
};
|
||||
|
||||
use clash_verge_draft::{Draft, DraftBusy, DraftConflict, DraftTransaction};
|
||||
use tokio::sync::Notify;
|
||||
use tokio::sync::{Notify, oneshot};
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
struct Config {
|
||||
@@ -83,6 +90,47 @@ async fn async_update_rejects_a_changed_committed_value() -> Result<(), Box<dyn
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parked_async_update_is_woken_after_optimistic_conflict() {
|
||||
#[derive(Default)]
|
||||
struct WakeFlag(AtomicBool);
|
||||
|
||||
impl Wake for WakeFlag {
|
||||
fn wake(self: Arc<Self>) {
|
||||
self.0.store(true, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
let draft = Draft::new(1);
|
||||
let (finish, finished) = oneshot::channel();
|
||||
let mut owner = pin!(draft.with_data_modify(|value| async move {
|
||||
finished.await.expect("owner completion signal");
|
||||
Ok::<_, DraftConflict>((value + 10, ()))
|
||||
}));
|
||||
let mut owner_context = Context::from_waker(Waker::noop());
|
||||
assert!(owner.as_mut().poll(&mut owner_context).is_pending());
|
||||
|
||||
let wake_flag = Arc::new(WakeFlag::default());
|
||||
let waker = Waker::from(Arc::clone(&wake_flag));
|
||||
let mut waiter_context = Context::from_waker(&waker);
|
||||
let mut waiter = pin!(draft.with_data_modify(|value| async move { Ok::<_, DraftConflict>((value + 1, value)) }));
|
||||
|
||||
// The fast retry wakes once before the waiter parks on Notify.
|
||||
assert!(waiter.as_mut().poll(&mut waiter_context).is_pending());
|
||||
assert!(wake_flag.0.swap(false, Ordering::Relaxed), "fast retry did not wake");
|
||||
assert!(waiter.as_mut().poll(&mut waiter_context).is_pending());
|
||||
assert!(!wake_flag.0.load(Ordering::Relaxed), "waiter did not park");
|
||||
|
||||
draft.edit_draft(|value| *value = 7);
|
||||
draft.apply();
|
||||
assert!(finish.send(()).is_ok());
|
||||
assert!(matches!(owner.as_mut().poll(&mut owner_context), Poll::Ready(Err(_))));
|
||||
assert_eq!(**draft.data_arc(), 7);
|
||||
assert!(wake_flag.0.load(Ordering::Relaxed), "parked waiter was not notified");
|
||||
assert!(matches!(waiter.as_mut().poll(&mut waiter_context), Poll::Ready(Ok(7))));
|
||||
assert_eq!(**draft.data_arc(), 8);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transaction_commits_every_layer() -> Result<(), DraftBusy> {
|
||||
let first = Draft::new(1_u8);
|
||||
@@ -117,10 +165,15 @@ fn dropped_transaction_rolls_every_layer_back() -> Result<(), DraftBusy> {
|
||||
#[test]
|
||||
fn transaction_claims_are_exclusive_and_release_partial_claims() -> Result<(), DraftBusy> {
|
||||
let first = Draft::new(1_u8);
|
||||
let second = Draft::new(2_u8);
|
||||
let second = Draft::new(2_u16);
|
||||
let held = DraftTransaction::begin(vec![&second])?;
|
||||
|
||||
assert!(DraftTransaction::begin(vec![&first, &second]).is_err());
|
||||
let busy = DraftTransaction::begin(vec![&first, &second])
|
||||
.err()
|
||||
.expect("transaction claimed an already-held layer");
|
||||
let layer = std::any::type_name::<u16>();
|
||||
assert_eq!(busy.layer, layer);
|
||||
assert!(busy.to_string().contains(layer));
|
||||
let available = DraftTransaction::begin(vec![&first])?;
|
||||
|
||||
drop(available);
|
||||
|
||||
@@ -23,17 +23,20 @@ fn resolve_supported_language(language: &str) -> Option<Cow<'static, str>> {
|
||||
return None;
|
||||
}
|
||||
let normalized = language.to_lowercase().replace('_', "-");
|
||||
let segments: Vec<&str> = normalized.split('-').collect();
|
||||
for i in (1..=segments.len()).rev() {
|
||||
let prefix = segments[..i].join("-");
|
||||
if let Some(alias) = locale_alias(&prefix)
|
||||
let mut prefix = normalized.as_str();
|
||||
loop {
|
||||
if let Some(alias) = locale_alias(prefix)
|
||||
&& let Some(found) = SUPPORTED_LOCALES.iter().find(|l| l.eq_ignore_ascii_case(alias))
|
||||
{
|
||||
return Some(found.clone());
|
||||
}
|
||||
if let Some(found) = SUPPORTED_LOCALES.iter().find(|l| l.eq_ignore_ascii_case(&prefix)) {
|
||||
if let Some(found) = SUPPORTED_LOCALES.iter().find(|l| l.eq_ignore_ascii_case(prefix)) {
|
||||
return Some(found.clone());
|
||||
}
|
||||
let Some((shorter, _)) = prefix.rsplit_once('-') else {
|
||||
break;
|
||||
};
|
||||
prefix = shorter;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
@@ -5,5 +5,11 @@ edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[dev-dependencies]
|
||||
proptest = { workspace = true }
|
||||
|
||||
[target.'cfg(loom)'.dependencies]
|
||||
loom = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#[cfg(loom)]
|
||||
use loom::sync::Arc;
|
||||
#[cfg(loom)]
|
||||
use loom::sync::atomic::AtomicU64;
|
||||
#[cfg(not(loom))]
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
#[cfg(not(loom))]
|
||||
use std::sync::atomic::AtomicU64;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
|
||||
pub type SystemLimiter = Limiter<SystemClock>;
|
||||
@@ -38,6 +45,7 @@ pub struct Limiter<C: Clock = SystemClock> {
|
||||
}
|
||||
|
||||
impl<C: Clock> Limiter<C> {
|
||||
#[cfg(not(loom))]
|
||||
pub const fn new(period: Duration, clock: C) -> Self {
|
||||
Self {
|
||||
last_run_ms: AtomicU64::new(0),
|
||||
@@ -46,11 +54,21 @@ impl<C: Clock> Limiter<C> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check(&self) -> bool {
|
||||
let now = self.clock.now_ms();
|
||||
let last = self.last_run_ms.load(Ordering::Relaxed);
|
||||
#[cfg(loom)]
|
||||
pub fn new(period: Duration, clock: C) -> Self {
|
||||
Self {
|
||||
last_run_ms: AtomicU64::new(0),
|
||||
period_ms: period.as_millis() as u64,
|
||||
clock,
|
||||
}
|
||||
}
|
||||
|
||||
if now < last + self.period_ms && now >= last {
|
||||
pub fn check(&self) -> bool {
|
||||
// Load before sampling so a stale sample cannot move a newer admission backward.
|
||||
let last = self.last_run_ms.load(Ordering::Relaxed);
|
||||
let now = self.clock.now_ms();
|
||||
|
||||
if now >= last && now - last < self.period_ms {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -74,6 +92,22 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn system_clock_reports_unix_epoch_milliseconds() {
|
||||
const MAX_DRIFT_MS: u64 = 5 * 60 * 1_000;
|
||||
|
||||
let wall_clock_ms = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis() as u64;
|
||||
let clock_ms = SystemClock.now_ms();
|
||||
|
||||
assert!(
|
||||
clock_ms.abs_diff(wall_clock_ms) <= MAX_DRIFT_MS,
|
||||
"SystemClock::now_ms() should return Unix epoch milliseconds, got {clock_ms} while wall clock is {wall_clock_ms}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enforces_the_period_boundary() {
|
||||
let clock = MockClock(AtomicU64::new(1_000));
|
||||
@@ -100,7 +134,10 @@ mod tests {
|
||||
}
|
||||
let admitted = handles
|
||||
.into_iter()
|
||||
.map(|handle| handle.join().unwrap_or(false))
|
||||
.map(|handle| match handle.join() {
|
||||
Ok(admitted) => admitted,
|
||||
Err(panic) => std::panic::resume_unwind(panic),
|
||||
})
|
||||
.filter(|passed| *passed)
|
||||
.count();
|
||||
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
#![cfg(loom)]
|
||||
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::time::Duration;
|
||||
|
||||
use clash_verge_limiter::{Clock, Limiter};
|
||||
use loom::sync::Arc;
|
||||
use loom::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize};
|
||||
|
||||
const PERIOD_MS: u64 = 100;
|
||||
const START_MS: u64 = 1_000;
|
||||
|
||||
struct MockClock(AtomicU64);
|
||||
|
||||
impl Clock for MockClock {
|
||||
fn now_ms(&self) -> u64 {
|
||||
self.0.load(Ordering::SeqCst)
|
||||
}
|
||||
}
|
||||
|
||||
type TestLimiter = Limiter<Arc<MockClock>>;
|
||||
|
||||
struct AdvancingClock(AtomicU64);
|
||||
|
||||
impl Clock for AdvancingClock {
|
||||
fn now_ms(&self) -> u64 {
|
||||
self.0.fetch_add(1, Ordering::SeqCst)
|
||||
}
|
||||
}
|
||||
|
||||
fn limiter_at(now_ms: u64) -> (Arc<MockClock>, Arc<TestLimiter>) {
|
||||
let clock = Arc::new(MockClock(AtomicU64::new(now_ms)));
|
||||
let limiter = Limiter::new(Duration::from_millis(PERIOD_MS), Arc::clone(&clock));
|
||||
(clock, Arc::new(limiter))
|
||||
}
|
||||
|
||||
fn run_two_concurrent_checks<C: Clock + 'static>(limiter: &Arc<Limiter<C>>) -> usize {
|
||||
let handles: [_; 2] = std::array::from_fn(|_| {
|
||||
let limiter = Arc::clone(limiter);
|
||||
loom::thread::spawn(move || limiter.check())
|
||||
});
|
||||
|
||||
handles
|
||||
.into_iter()
|
||||
.map(|handle| match handle.join() {
|
||||
Ok(admitted) => admitted,
|
||||
Err(panic) => std::panic::resume_unwind(panic),
|
||||
})
|
||||
.filter(|admitted| *admitted)
|
||||
.count()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn admits_exactly_one_caller_in_an_eligible_window() {
|
||||
loom::model(|| {
|
||||
let (_clock, limiter) = limiter_at(START_MS);
|
||||
|
||||
assert_eq!(run_two_concurrent_checks(&limiter), 1);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_concurrent_callers_inside_the_restricted_period() {
|
||||
loom::model(|| {
|
||||
let (clock, limiter) = limiter_at(START_MS);
|
||||
assert!(limiter.check());
|
||||
|
||||
clock.0.store(START_MS + PERIOD_MS - 1, Ordering::SeqCst);
|
||||
|
||||
assert_eq!(run_two_concurrent_checks(&limiter), 0);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn admits_exactly_one_caller_at_the_period_boundary() {
|
||||
loom::model(|| {
|
||||
let (clock, limiter) = limiter_at(START_MS);
|
||||
assert!(limiter.check());
|
||||
|
||||
clock.0.store(START_MS + PERIOD_MS, Ordering::SeqCst);
|
||||
|
||||
assert_eq!(run_two_concurrent_checks(&limiter), 1);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn concurrent_clock_advancement_admits_exactly_one_caller() {
|
||||
loom::model(|| {
|
||||
let clock = Arc::new(AdvancingClock(AtomicU64::new(START_MS)));
|
||||
let limiter = Arc::new(Limiter::new(Duration::from_millis(PERIOD_MS), Arc::clone(&clock)));
|
||||
|
||||
assert_eq!(run_two_concurrent_checks(&limiter), 1);
|
||||
});
|
||||
}
|
||||
|
||||
struct StaleClock {
|
||||
current: AtomicU64,
|
||||
reads: AtomicUsize,
|
||||
stale_reads: usize,
|
||||
sampled: AtomicUsize,
|
||||
released: AtomicBool,
|
||||
}
|
||||
|
||||
impl StaleClock {
|
||||
fn new(now_ms: u64, stale_reads: usize) -> Self {
|
||||
Self {
|
||||
current: AtomicU64::new(now_ms),
|
||||
reads: AtomicUsize::new(0),
|
||||
stale_reads,
|
||||
sampled: AtomicUsize::new(0),
|
||||
released: AtomicBool::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
fn release(&self) {
|
||||
self.released.store(true, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
||||
impl Clock for StaleClock {
|
||||
fn now_ms(&self) -> u64 {
|
||||
if self.reads.fetch_add(1, Ordering::SeqCst) < self.stale_reads {
|
||||
let stale = self.current.load(Ordering::SeqCst);
|
||||
self.sampled.fetch_add(1, Ordering::SeqCst);
|
||||
|
||||
// Parking can wake spuriously; re-check the release flag on each
|
||||
// wake. Unparking after setting the flag avoids a lost wakeup.
|
||||
while !self.released.load(Ordering::SeqCst) {
|
||||
loom::thread::park();
|
||||
}
|
||||
|
||||
stale
|
||||
} else {
|
||||
self.current.load(Ordering::SeqCst)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Regression: a caller that sampled the clock before a newer admission must
|
||||
/// not overwrite that admission when it resumes.
|
||||
#[test]
|
||||
fn stale_clock_sample_does_not_reopen_the_period() {
|
||||
loom::model(|| {
|
||||
const LATER_MS: u64 = START_MS + PERIOD_MS * 10;
|
||||
|
||||
let clock = Arc::new(StaleClock::new(START_MS, 1));
|
||||
let limiter = Arc::new(Limiter::new(Duration::from_millis(PERIOD_MS), Arc::clone(&clock)));
|
||||
|
||||
let stale_caller = {
|
||||
let limiter = Arc::clone(&limiter);
|
||||
loom::thread::spawn(move || limiter.check())
|
||||
};
|
||||
|
||||
while clock.sampled.load(Ordering::SeqCst) < 1 {
|
||||
loom::thread::yield_now();
|
||||
}
|
||||
clock.current.store(LATER_MS, Ordering::SeqCst);
|
||||
|
||||
let later_caller = {
|
||||
let limiter = Arc::clone(&limiter);
|
||||
loom::thread::spawn(move || limiter.check())
|
||||
};
|
||||
|
||||
let later_admitted = later_caller.join().unwrap();
|
||||
assert!(
|
||||
later_admitted,
|
||||
"the later caller must be admitted before the stale caller resumes"
|
||||
);
|
||||
|
||||
clock.release();
|
||||
stale_caller.thread().unpark();
|
||||
|
||||
let stale_admitted = stale_caller.join().unwrap();
|
||||
let reopened = limiter.check();
|
||||
|
||||
assert!(
|
||||
!stale_admitted,
|
||||
"stale caller must not be admitted after the later caller"
|
||||
);
|
||||
assert!(
|
||||
!reopened,
|
||||
"stale caller admitted={stale_admitted} moved last_run_ms from {LATER_MS} back to {START_MS}"
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multiple_stale_clock_samples_cannot_reopen_the_period() {
|
||||
loom::model(|| {
|
||||
const LATER_MS: u64 = START_MS + PERIOD_MS * 10;
|
||||
|
||||
let clock = Arc::new(StaleClock::new(START_MS, 2));
|
||||
let limiter = Arc::new(Limiter::new(Duration::from_millis(PERIOD_MS), Arc::clone(&clock)));
|
||||
|
||||
let stale_callers: [_; 2] = std::array::from_fn(|_| {
|
||||
let limiter = Arc::clone(&limiter);
|
||||
loom::thread::spawn(move || limiter.check())
|
||||
});
|
||||
|
||||
while clock.sampled.load(Ordering::SeqCst) < 2 {
|
||||
loom::thread::yield_now();
|
||||
}
|
||||
clock.current.store(LATER_MS, Ordering::SeqCst);
|
||||
assert!(
|
||||
limiter.check(),
|
||||
"the later caller must be admitted before the stale callers resume"
|
||||
);
|
||||
|
||||
clock.release();
|
||||
for caller in &stale_callers {
|
||||
caller.thread().unpark();
|
||||
}
|
||||
|
||||
let stale_admitted = stale_callers
|
||||
.into_iter()
|
||||
.map(|caller| caller.join().unwrap())
|
||||
.filter(|admitted| *admitted)
|
||||
.count();
|
||||
assert_eq!(
|
||||
stale_admitted, 0,
|
||||
"stale callers must not be admitted after the later caller"
|
||||
);
|
||||
assert!(!limiter.check(), "stale callers reopened the period at {LATER_MS}");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# Seeds for failure cases proptest has generated in the past. It is
|
||||
# automatically read and these particular cases re-run before any
|
||||
# novel cases are generated.
|
||||
#
|
||||
# It is recommended to check this file in to source control so that
|
||||
# everyone who runs the test benefits from these saved cases.
|
||||
cc 0139d921e3faaf32821ee0c596b0d495ffc72ce94200b8d5a795883db56305e6 # shrinks to period = 56, start = 18446744073709551560
|
||||
@@ -0,0 +1,211 @@
|
||||
#![cfg(not(loom))]
|
||||
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::time::Duration;
|
||||
|
||||
use clash_verge_limiter::{Clock, Limiter};
|
||||
use proptest::prelude::*;
|
||||
use proptest::test_runner::FileFailurePersistence;
|
||||
|
||||
const CASES: u32 = 10_000;
|
||||
const MAX_PERIOD_MS: u64 = 100_000;
|
||||
const MAX_START_MS: u64 = 1_000_000;
|
||||
const MAX_DELTA_MS: u64 = 10_000;
|
||||
|
||||
/// Returns one clock value per call, in order. The test supplies exactly as
|
||||
/// many values as the limiter will read.
|
||||
struct SequenceClock {
|
||||
values: Vec<u64>,
|
||||
next: AtomicUsize,
|
||||
}
|
||||
|
||||
impl SequenceClock {
|
||||
const fn new(values: Vec<u64>) -> Self {
|
||||
Self {
|
||||
values,
|
||||
next: AtomicUsize::new(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Clock for SequenceClock {
|
||||
fn now_ms(&self) -> u64 {
|
||||
let index = self.next.fetch_add(1, Ordering::SeqCst);
|
||||
self.values[index]
|
||||
}
|
||||
}
|
||||
|
||||
fn timestamps(start: u64, deltas: &[u64]) -> Vec<u64> {
|
||||
let mut now = start;
|
||||
let mut values = Vec::with_capacity(deltas.len() + 1);
|
||||
values.push(now);
|
||||
for delta in deltas {
|
||||
now += delta;
|
||||
values.push(now);
|
||||
}
|
||||
values
|
||||
}
|
||||
|
||||
proptest! {
|
||||
#![proptest_config(ProptestConfig {
|
||||
cases: CASES,
|
||||
failure_persistence: Some(Box::new(FileFailurePersistence::Direct(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/tests/properties.proptest-regressions"
|
||||
)))),
|
||||
..ProptestConfig::default()
|
||||
})]
|
||||
|
||||
/// For positive periods and nondecreasing time, admission is equivalent to
|
||||
/// reaching the next allowed timestamp after the previous admission.
|
||||
#[test]
|
||||
fn sequential_results_match_the_next_allowed_time_contract(
|
||||
period in 1u64..=MAX_PERIOD_MS,
|
||||
start in MAX_PERIOD_MS..=MAX_START_MS,
|
||||
deltas in prop::collection::vec(0u64..=MAX_DELTA_MS, 0..64),
|
||||
) {
|
||||
let times = timestamps(start, &deltas);
|
||||
let clock = SequenceClock::new(times.clone());
|
||||
let limiter = Limiter::new(Duration::from_millis(period), &clock);
|
||||
let mut last_admitted = None;
|
||||
|
||||
for now in times {
|
||||
let expected = match last_admitted {
|
||||
None => true,
|
||||
Some(last) => now >= last + period,
|
||||
};
|
||||
let actual = limiter.check();
|
||||
prop_assert!(
|
||||
actual == expected,
|
||||
"period={} now={} last={:?}",
|
||||
period,
|
||||
now,
|
||||
last_admitted
|
||||
);
|
||||
if actual {
|
||||
last_admitted = Some(now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An admission at the period boundary is accepted, while a repeated or
|
||||
/// pre-boundary check is rejected.
|
||||
#[test]
|
||||
fn period_boundary_and_repeated_checks_follow_the_period(
|
||||
period in 1u64..=MAX_PERIOD_MS,
|
||||
start in MAX_PERIOD_MS..=MAX_START_MS,
|
||||
) {
|
||||
let boundary = start + period;
|
||||
let clock = SequenceClock::new(vec![start, start, boundary - 1, boundary]);
|
||||
let limiter = Limiter::new(Duration::from_millis(period), &clock);
|
||||
|
||||
prop_assert!(limiter.check(), "first check at {}", start);
|
||||
prop_assert!(!limiter.check(), "repeated check at {}", start);
|
||||
prop_assert!(!limiter.check(), "pre-boundary check at {}", boundary - 1);
|
||||
prop_assert!(limiter.check(), "boundary check at {}", boundary);
|
||||
}
|
||||
|
||||
/// Any two admitted timestamps in a monotonic sequence are separated by at
|
||||
/// least one configured period.
|
||||
#[test]
|
||||
fn admitted_timestamps_are_at_least_one_period_apart(
|
||||
period in 1u64..=MAX_PERIOD_MS,
|
||||
start in MAX_PERIOD_MS..=MAX_START_MS,
|
||||
deltas in prop::collection::vec(0u64..=MAX_DELTA_MS, 0..64),
|
||||
) {
|
||||
let times = timestamps(start, &deltas);
|
||||
let clock = SequenceClock::new(times.clone());
|
||||
let limiter = Limiter::new(Duration::from_millis(period), &clock);
|
||||
let mut admitted = Vec::new();
|
||||
|
||||
for now in times {
|
||||
if limiter.check() {
|
||||
admitted.push(now);
|
||||
}
|
||||
}
|
||||
|
||||
for pair in admitted.windows(2) {
|
||||
prop_assert!(
|
||||
pair[1] - pair[0] >= period,
|
||||
"period={} admitted pair={:?}",
|
||||
period,
|
||||
pair
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A rejected duplicate at the current admission timestamp must not change
|
||||
/// the outcomes of later checks.
|
||||
#[test]
|
||||
fn rejected_checks_do_not_change_future_admissions(
|
||||
period in 1u64..=MAX_PERIOD_MS,
|
||||
start in MAX_PERIOD_MS..=MAX_START_MS,
|
||||
deltas in prop::collection::vec(0u64..=MAX_DELTA_MS, 0..64),
|
||||
) {
|
||||
let base_times = timestamps(start, &deltas);
|
||||
let base_clock = SequenceClock::new(base_times.clone());
|
||||
let base = Limiter::new(Duration::from_millis(period), &base_clock);
|
||||
let base_results: Vec<bool> = base_times.iter().map(|_| base.check()).collect();
|
||||
|
||||
let mut repeated_times = vec![start, start];
|
||||
repeated_times.extend_from_slice(&base_times[1..]);
|
||||
let repeated_len = repeated_times.len();
|
||||
let repeated_clock = SequenceClock::new(repeated_times);
|
||||
let repeated = Limiter::new(Duration::from_millis(period), &repeated_clock);
|
||||
let repeated_results: Vec<bool> = (0..repeated_len).map(|_| repeated.check()).collect();
|
||||
|
||||
prop_assert!(repeated_results[0]);
|
||||
prop_assert!(!repeated_results[1]);
|
||||
prop_assert_eq!(&base_results[1..], &repeated_results[2..]);
|
||||
}
|
||||
|
||||
/// Every sub-millisecond period is represented as zero milliseconds, so it
|
||||
/// must produce the same admissions as `Duration::ZERO`. This deliberately
|
||||
/// does not assert a policy for zero periods.
|
||||
#[test]
|
||||
fn zero_and_submillisecond_periods_are_equivalent(
|
||||
nanos in 0u64..1_000_000,
|
||||
start in 0u64..=MAX_START_MS,
|
||||
deltas in prop::collection::vec(0u64..=MAX_DELTA_MS, 0..64),
|
||||
) {
|
||||
let times = timestamps(start, &deltas);
|
||||
let zero_clock = SequenceClock::new(times.clone());
|
||||
let zero = Limiter::new(Duration::ZERO, &zero_clock);
|
||||
let submillisecond_clock = SequenceClock::new(times.clone());
|
||||
let submillisecond =
|
||||
Limiter::new(Duration::from_nanos(nanos), &submillisecond_clock);
|
||||
|
||||
for now in times {
|
||||
prop_assert_eq!(
|
||||
zero.check(),
|
||||
submillisecond.check(),
|
||||
"nanos={} now={}",
|
||||
nanos,
|
||||
now
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Regression: timestamp arithmetic must not overflow near `u64::MAX`.
|
||||
#[test]
|
||||
fn extreme_timestamp_and_period_do_not_overflow(
|
||||
period in 1u64..=1_000,
|
||||
start in (u64::MAX - 1_000)..=u64::MAX,
|
||||
) {
|
||||
let clock = SequenceClock::new(vec![start, start]);
|
||||
let limiter = Limiter::new(Duration::from_millis(period), &clock);
|
||||
|
||||
prop_assert!(limiter.check());
|
||||
prop_assert!(!limiter.check());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn max_timestamp_boundary_does_not_overflow() {
|
||||
let clock = SequenceClock::new(vec![u64::MAX - 1, u64::MAX, u64::MAX]);
|
||||
let limiter = Limiter::new(Duration::from_millis(1), &clock);
|
||||
|
||||
assert!(limiter.check());
|
||||
assert!(limiter.check());
|
||||
assert!(!limiter.check());
|
||||
}
|
||||
@@ -20,7 +20,6 @@ macro_rules! patch_opt_field {
|
||||
#[serde(default)]
|
||||
pub struct PrfItem {
|
||||
pub uid: Option<String>,
|
||||
|
||||
/// enum value: remote | local | script | merge
|
||||
#[serde(rename = "type")]
|
||||
pub itype: Option<String>,
|
||||
@@ -157,21 +156,20 @@ impl IProfiles {
|
||||
}
|
||||
|
||||
pub fn get_item(&self, uid: impl AsRef<str>) -> Result<&PrfItem, ProfileNotFound> {
|
||||
let uid_str = uid.as_ref();
|
||||
let uid = uid.as_ref();
|
||||
self.items
|
||||
.iter()
|
||||
.flatten()
|
||||
.find(|item| item.uid.as_deref() == Some(uid))
|
||||
.ok_or_else(|| ProfileNotFound { uid: uid.to_owned() })
|
||||
}
|
||||
|
||||
if let Some(items) = self.items.as_ref() {
|
||||
for each in items.iter() {
|
||||
if let Some(uid_val) = &each.uid
|
||||
&& uid_val.as_str() == uid_str
|
||||
{
|
||||
return Ok(each);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Err(ProfileNotFound {
|
||||
uid: uid_str.to_owned(),
|
||||
})
|
||||
pub fn get_item_mut(&mut self, uid: &str) -> Result<&mut PrfItem, ProfileNotFound> {
|
||||
self.items
|
||||
.iter_mut()
|
||||
.flatten()
|
||||
.find(|item| item.uid.as_deref() == Some(uid))
|
||||
.ok_or_else(|| ProfileNotFound { uid: uid.to_owned() })
|
||||
}
|
||||
|
||||
/// Inserts a prepared entry after any required body write.
|
||||
@@ -200,41 +198,30 @@ impl IProfiles {
|
||||
|
||||
pub fn plan_delete_item(&mut self, uid: &str) -> Result<ProfileDeletePlan, ProfileNotFound> {
|
||||
let deleting_current = self.current.as_deref().is_none_or(|current| current == uid);
|
||||
let delete_uids = self.get_item(uid)?.option.as_ref().map_or_else(Vec::new, |op| {
|
||||
[
|
||||
op.merge.clone(),
|
||||
op.script.clone(),
|
||||
op.rules.clone(),
|
||||
op.proxies.clone(),
|
||||
op.groups.clone(),
|
||||
]
|
||||
.into_iter()
|
||||
.collect::<Vec<_>>()
|
||||
});
|
||||
let mut items = self.items.take().unwrap_or_default();
|
||||
let mut files = Vec::new();
|
||||
|
||||
if let Some(file) = take_item_file_by_uid(&mut items, Some(uid)) {
|
||||
files.push(file);
|
||||
}
|
||||
|
||||
for delete_uid in delete_uids {
|
||||
if let Some(file) = take_item_file_by_uid(&mut items, delete_uid.as_deref()) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
if deleting_current {
|
||||
self.current = None;
|
||||
for item in items.iter() {
|
||||
if matches!(item.itype.as_deref(), Some("remote" | "local")) {
|
||||
self.current = item.uid.clone();
|
||||
break;
|
||||
let missing_profile = || ProfileNotFound { uid: uid.to_owned() };
|
||||
let items = self.items.as_mut().ok_or_else(missing_profile)?;
|
||||
let profile = remove_item(items, Some(uid)).ok_or_else(missing_profile)?;
|
||||
let mut files = Vec::from_iter(profile.file);
|
||||
if let Some(options) = profile.option {
|
||||
for companion_uid in [
|
||||
options.merge,
|
||||
options.script,
|
||||
options.rules,
|
||||
options.proxies,
|
||||
options.groups,
|
||||
] {
|
||||
if let Some(file) = remove_item(items, companion_uid.as_deref()).and_then(|item| item.file) {
|
||||
files.push(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.items = Some(items);
|
||||
if deleting_current {
|
||||
self.current = items
|
||||
.iter()
|
||||
.find(|item| matches!(item.itype.as_deref(), Some("remote" | "local")))
|
||||
.and_then(|item| item.uid.clone());
|
||||
}
|
||||
Ok(ProfileDeletePlan {
|
||||
deleting_current,
|
||||
files,
|
||||
@@ -259,9 +246,9 @@ impl IProfiles {
|
||||
}
|
||||
}
|
||||
|
||||
fn take_item_file_by_uid(items: &mut Vec<PrfItem>, target_uid: Option<&str>) -> Option<String> {
|
||||
fn remove_item(items: &mut Vec<PrfItem>, target_uid: Option<&str>) -> Option<PrfItem> {
|
||||
let index = items.iter().position(|item| item.uid.as_deref() == target_uid)?;
|
||||
items.remove(index).file
|
||||
Some(items.remove(index))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -28,7 +28,7 @@ impl SubscriptionSchedule {
|
||||
let full = Self::interval_duration(interval_minutes);
|
||||
let elapsed = updated
|
||||
.filter(|updated| *updated > 0)
|
||||
.map_or(0, |updated| now.saturating_sub(updated as i64).max(0) as u64);
|
||||
.map_or(0, |updated| (now.max(0) as u64).saturating_sub(updated as u64));
|
||||
|
||||
Self {
|
||||
interval_minutes,
|
||||
|
||||
@@ -13,7 +13,11 @@ pub fn decode_subscription_link(link: &Url) -> Option<SubscriptionLink<'_>> {
|
||||
}
|
||||
|
||||
// The embedded URL can contain unescaped query separators of its own.
|
||||
let raw_url = link.query()?.split_once("url=")?.1.trim();
|
||||
let query = link.query()?;
|
||||
let raw_url = query
|
||||
.strip_prefix("url=")
|
||||
.or_else(|| query.split_once("&url=").map(|(_, url)| url))?
|
||||
.trim();
|
||||
let name = link.query_pairs().find(|(key, _)| key == "name").map(|(_, name)| name);
|
||||
Some(SubscriptionLink {
|
||||
url: decode_subscription_url(raw_url),
|
||||
@@ -22,10 +26,16 @@ pub fn decode_subscription_link(link: &Url) -> Option<SubscriptionLink<'_>> {
|
||||
}
|
||||
|
||||
fn decode_subscription_url(raw_url: &str) -> Cow<'_, str> {
|
||||
let mut candidate = Cow::Borrowed(raw_url);
|
||||
if Url::parse(raw_url).is_ok() {
|
||||
return candidate;
|
||||
return Cow::Borrowed(raw_url);
|
||||
}
|
||||
// Only the outer name has meaning here. Partly encoded URLs can still contain literal path and query delimiters.
|
||||
let mut candidate = Cow::Borrowed(
|
||||
raw_url
|
||||
.split_once("&name=")
|
||||
.filter(|(value, _)| !value.contains(['/', '?', '&']))
|
||||
.map_or(raw_url, |(value, _)| value),
|
||||
);
|
||||
|
||||
for _ in 0..2 {
|
||||
let decoded = percent_decode_str(&candidate).decode_utf8_lossy();
|
||||
@@ -51,7 +61,22 @@ mod tests {
|
||||
assert_eq!(link.name.as_deref(), Some("Work VPN"));
|
||||
assert!(matches!(link.url, Cow::Borrowed("https://example.invalid/sub?a=1&b=2")));
|
||||
|
||||
let encoded = Url::parse("clash-verge://install-config?url=https%253A%252F%252Fexample.invalid%252Fsub")?;
|
||||
let partial = Url::parse("clash://install-config?url=https%3A%2F%2Fexample.invalid/a&b/file?token=abc")?;
|
||||
assert_eq!(
|
||||
decode_subscription_link(&partial).expect("partially encoded link").url,
|
||||
"https://example.invalid/a&b/file?token=abc"
|
||||
);
|
||||
|
||||
let missing = Url::parse("clash://install-config?name=myurl=notes")?;
|
||||
assert!(decode_subscription_link(&missing).is_none());
|
||||
let named = Url::parse("clash://install-config?name=myurl=notes&url=https://example.invalid/work")?;
|
||||
assert_eq!(
|
||||
decode_subscription_link(&named).expect("named link").url,
|
||||
"https://example.invalid/work"
|
||||
);
|
||||
|
||||
let encoded =
|
||||
Url::parse("clash-verge://install-config?url=https%253A%252F%252Fexample.invalid%252Fsub&name=Work")?;
|
||||
let link = decode_subscription_link(&encoded).expect("double-encoded subscription link");
|
||||
assert_eq!(link.url, "https://example.invalid/sub");
|
||||
Ok(())
|
||||
|
||||
@@ -69,26 +69,10 @@ pub fn decode_subscription<'a>(
|
||||
}
|
||||
|
||||
fn subscription_filename(url: &Url, headers: &HeaderMap) -> Option<String> {
|
||||
if let Some(value) = headers.get("content-disposition") {
|
||||
let disposition = format!("{value:?}");
|
||||
let disposition = disposition.trim_matches('"');
|
||||
if let Some(encoded) = find_field(disposition, "filename*", Some)
|
||||
&& let Ok(decoded) = percent_decode_str(encoded).decode_utf8()
|
||||
&& let Some(filename) = decoded.split("''").last()
|
||||
&& !filename.trim().is_empty()
|
||||
{
|
||||
return Some(filename.to_owned());
|
||||
}
|
||||
if let Some(filename) = find_field(disposition, "filename", Some).map(|name| name.trim_matches('"'))
|
||||
&& !filename.trim().is_empty()
|
||||
{
|
||||
return Some(filename.to_owned());
|
||||
}
|
||||
if let Some(filename) = headers.get("content-disposition").and_then(disposition_filename) {
|
||||
return Some(filename);
|
||||
}
|
||||
|
||||
let url = url.as_str();
|
||||
let path = url.split_once('?').map_or(url, |(path, _)| path);
|
||||
let filename = path.rsplit_once('/').map_or(path, |(_, filename)| filename);
|
||||
let filename = url.path().rsplit('/').next()?;
|
||||
let filename = percent_decode_str(filename).decode_utf8_lossy();
|
||||
if filename.trim().is_empty() {
|
||||
return None;
|
||||
@@ -96,6 +80,57 @@ fn subscription_filename(url: &Url, headers: &HeaderMap) -> Option<String> {
|
||||
Some(filename.into_owned())
|
||||
}
|
||||
|
||||
fn disposition_filename(header: &http::HeaderValue) -> Option<String> {
|
||||
let mut quoted = false;
|
||||
let mut escaped = false;
|
||||
let fields = header.as_bytes().split(|&byte| {
|
||||
if escaped {
|
||||
escaped = false;
|
||||
} else if quoted && byte == b'\\' {
|
||||
escaped = true;
|
||||
} else if byte == b'"' {
|
||||
quoted = !quoted;
|
||||
} else if !quoted && byte == b';' {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
});
|
||||
|
||||
let mut plain = None;
|
||||
for field in fields {
|
||||
let Some((key, value)) = std::str::from_utf8(field).ok().and_then(|s| s.split_once('=')) else {
|
||||
continue;
|
||||
};
|
||||
let value = value.trim();
|
||||
if key.trim().eq_ignore_ascii_case("filename*") {
|
||||
let encoded = value.splitn(3, '\'').nth(2).unwrap_or(value);
|
||||
if let Ok(name) = percent_decode_str(encoded).decode_utf8()
|
||||
&& !name.trim().is_empty()
|
||||
{
|
||||
return Some(name.into_owned());
|
||||
}
|
||||
} else if plain.is_none() && key.trim().eq_ignore_ascii_case("filename") {
|
||||
let name = unquote_filename(value);
|
||||
if !name.trim().is_empty() {
|
||||
plain = Some(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
plain
|
||||
}
|
||||
|
||||
fn unquote_filename(value: &str) -> String {
|
||||
let Some(inner) = value.strip_prefix('"').and_then(|s| s.strip_suffix('"')) else {
|
||||
return value.to_owned();
|
||||
};
|
||||
let mut chars = inner.chars();
|
||||
let mut name = String::with_capacity(inner.len());
|
||||
while let Some(ch) = chars.next() {
|
||||
name.push(if ch == '\\' { chars.next().unwrap_or(ch) } else { ch });
|
||||
}
|
||||
name
|
||||
}
|
||||
|
||||
pub fn normalize_profile_home_url(raw: &str) -> Option<String> {
|
||||
let url = Url::parse(raw.trim()).ok()?;
|
||||
|
||||
@@ -179,6 +214,22 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_filename_parameters_before_falling_back_to_the_url_path() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let url = Url::parse("https://example.invalid/sub.yaml#my/notes")?;
|
||||
for (disposition, expected) in [
|
||||
(r#"attachment; FileName="My; \"Work\".yaml""#, r#"My; "Work".yaml"#),
|
||||
("attachment; filename*=UTF-8'en'Work%27%27s.yaml", "Work''s.yaml"),
|
||||
("attachment", "sub.yaml"),
|
||||
] {
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert("content-disposition", HeaderValue::from_static(disposition));
|
||||
let document = decode_subscription(&url, &headers, "proxies: []")?;
|
||||
assert_eq!(document.filename.as_deref(), Some(expected));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ignores_overflowing_server_interval() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let url = Url::parse("https://example.com/My%20Profile.yaml?token=value")?;
|
||||
|
||||
@@ -12,7 +12,7 @@ parking_lot = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
# sysinfo 0.38.2 conflicts with dark-light
|
||||
# see https://github.com/GuillaumeGomez/sysinfo/issues/1623
|
||||
sysinfo = { version = "0.40.4", default-features = false, features = ["network", "system"] }
|
||||
sysinfo = { version = "0.40.5", default-features = false, features = ["network", "system"] }
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
libc = "0.2.191"
|
||||
|
||||
@@ -7,7 +7,6 @@ import pluginImportX from 'eslint-plugin-import-x'
|
||||
import pluginReactCompiler from 'eslint-plugin-react-compiler'
|
||||
import pluginReactHooks from 'eslint-plugin-react-hooks'
|
||||
import pluginReactRefresh from 'eslint-plugin-react-refresh'
|
||||
import PluginSukka from 'eslint-plugin-sukka'
|
||||
import pluginUnusedImports from 'eslint-plugin-unused-imports'
|
||||
import globals from 'globals'
|
||||
import tseslint from 'typescript-eslint'
|
||||
@@ -112,7 +111,6 @@ export default defineConfig([
|
||||
'import-x': pluginImportX,
|
||||
'react-refresh': pluginReactRefresh,
|
||||
'unused-imports': pluginUnusedImports,
|
||||
sukka: PluginSukka,
|
||||
},
|
||||
|
||||
extends: [
|
||||
@@ -182,7 +180,6 @@ export default defineConfig([
|
||||
'@eslint-react/no-unused-class-component-members': 'error',
|
||||
'@eslint-react/no-unused-state': 'error',
|
||||
'@eslint-react/jsx-no-useless-fragment': 'warn',
|
||||
'sukka/react-prefer-destructuring-assignment': 'warn',
|
||||
|
||||
// TypeScript
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
|
||||
+2
-5
@@ -47,7 +47,7 @@
|
||||
"@mui/icons-material": "^9.4.0",
|
||||
"@mui/material": "^9.4.0",
|
||||
"@tanstack/react-virtual": "^3.14.13",
|
||||
"@tauri-apps/api": "2.12.5",
|
||||
"@tauri-apps/api": "2.13.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.5.0",
|
||||
"@tauri-apps/plugin-dialog": "2.8.4",
|
||||
"@tauri-apps/plugin-fs": "2.7.1",
|
||||
@@ -57,8 +57,6 @@
|
||||
"ahooks": "^3.10.0",
|
||||
"cidr-block": "^2.3.0",
|
||||
"dayjs": "1.11.23",
|
||||
"foxact": "^0.3.12",
|
||||
"foxts": "^5.9.1",
|
||||
"i18next": "^27.0.0",
|
||||
"js-yaml": "^5.4.2",
|
||||
"lodash-es": "^4.18.1",
|
||||
@@ -87,7 +85,7 @@
|
||||
"@biomejs/biome": "^2.5.14",
|
||||
"@eslint-react/eslint-plugin": "^5.20.5",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@tauri-apps/cli": "2.12.6",
|
||||
"@tauri-apps/cli": "2.13.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^26.0.0",
|
||||
"@types/react": "19.3.3",
|
||||
@@ -107,7 +105,6 @@
|
||||
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.7",
|
||||
"eslint-plugin-sukka": "^10.2.0",
|
||||
"eslint-plugin-unused-imports": "^4.4.1",
|
||||
"globals": "^17.12.0",
|
||||
"https-proxy-agent": "^9.1.0",
|
||||
|
||||
Generated
+119
-308
@@ -219,8 +219,8 @@ importers:
|
||||
specifier: ^3.14.13
|
||||
version: 3.14.13(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
|
||||
'@tauri-apps/api':
|
||||
specifier: 2.12.5
|
||||
version: 2.12.5
|
||||
specifier: 2.13.0
|
||||
version: 2.13.0
|
||||
'@tauri-apps/plugin-clipboard-manager':
|
||||
specifier: 2.5.0
|
||||
version: 2.5.0
|
||||
@@ -248,12 +248,6 @@ importers:
|
||||
dayjs:
|
||||
specifier: 1.11.23
|
||||
version: 1.11.23
|
||||
foxact:
|
||||
specifier: ^0.3.12
|
||||
version: 0.3.12(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
|
||||
foxts:
|
||||
specifier: ^5.9.1
|
||||
version: 5.9.1
|
||||
i18next:
|
||||
specifier: ^27.0.0
|
||||
version: 27.0.1(typescript@6.0.3)
|
||||
@@ -334,8 +328,8 @@ importers:
|
||||
specifier: ^10.0.1
|
||||
version: 10.0.1(eslint@10.16.0(jiti@2.7.0))
|
||||
'@tauri-apps/cli':
|
||||
specifier: 2.12.6
|
||||
version: 2.12.6
|
||||
specifier: 2.13.0
|
||||
version: 2.13.0
|
||||
'@types/lodash-es':
|
||||
specifier: ^4.17.12
|
||||
version: 4.17.12
|
||||
@@ -353,10 +347,10 @@ importers:
|
||||
version: 13.15.10
|
||||
'@vitejs/plugin-legacy':
|
||||
specifier: ^8.2.3
|
||||
version: 8.2.3(terser@5.51.2)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))
|
||||
version: 8.2.3(terser@5.51.3)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.1.1
|
||||
version: 6.1.1(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))
|
||||
version: 6.1.1(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))
|
||||
adm-zip:
|
||||
specifier: ^0.6.1
|
||||
version: 0.6.1
|
||||
@@ -377,13 +371,13 @@ importers:
|
||||
version: 10.16.0(jiti@2.7.0)
|
||||
eslint-import-resolver-typescript:
|
||||
specifier: ^4.4.5
|
||||
version: 4.4.5(eslint-plugin-import-x@4.18.1(@typescript-eslint/utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)))(eslint@10.16.0(jiti@2.7.0))
|
||||
version: 4.4.5(eslint-plugin-import-x@4.18.1(@typescript-eslint/utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)))(eslint@10.16.0(jiti@2.7.0))
|
||||
eslint-plugin-es-x:
|
||||
specifier: ^10.0.1
|
||||
version: 10.0.1(eslint@10.16.0(jiti@2.7.0))
|
||||
eslint-plugin-import-x:
|
||||
specifier: ^4.18.1
|
||||
version: 4.18.1(@typescript-eslint/utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))
|
||||
version: 4.18.1(@typescript-eslint/utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))
|
||||
eslint-plugin-react-compiler:
|
||||
specifier: 19.1.0-rc.2
|
||||
version: 19.1.0-rc.2(eslint@10.16.0(jiti@2.7.0))
|
||||
@@ -393,9 +387,6 @@ importers:
|
||||
eslint-plugin-react-refresh:
|
||||
specifier: ^0.5.7
|
||||
version: 0.5.7(eslint@10.16.0(jiti@2.7.0))
|
||||
eslint-plugin-sukka:
|
||||
specifier: ^10.2.0
|
||||
version: 10.2.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint-plugin-unused-imports:
|
||||
specifier: ^4.4.1
|
||||
version: 4.4.1(@typescript-eslint/eslint-plugin@8.74.0(@typescript-eslint/parser@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))
|
||||
@@ -425,7 +416,7 @@ importers:
|
||||
version: 8.0.2
|
||||
terser:
|
||||
specifier: ^5.51.2
|
||||
version: 5.51.2
|
||||
version: 5.51.3
|
||||
tsrs:
|
||||
specifier: 0.20.0-ts7.1.0-beta
|
||||
version: 0.20.0-ts7.1.0-beta
|
||||
@@ -437,13 +428,13 @@ importers:
|
||||
version: 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
vite:
|
||||
specifier: ^8.3.0
|
||||
version: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)
|
||||
version: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)
|
||||
vite-plugin-svgr:
|
||||
specifier: ^5.2.0
|
||||
version: 5.2.0(typescript@6.0.3)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))
|
||||
version: 5.2.0(typescript@6.0.3)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))
|
||||
vitest:
|
||||
specifier: ^5.0.3
|
||||
version: 5.1.2(@types/node@26.6.5)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))
|
||||
version: 5.1.2(@types/node@26.6.5)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))
|
||||
|
||||
packages:
|
||||
|
||||
@@ -1931,82 +1922,82 @@ packages:
|
||||
'@tanstack/virtual-core@3.17.11':
|
||||
resolution: {integrity: sha512-+ILjvtHup6Y2hzQ6YzwMgX1Q+oQpxEGOXCEsCNaPoIP0VxMbizIBTmYTDtkerkIQS8/CbP1BRuyt8V/8BCsy1g==}
|
||||
|
||||
'@tauri-apps/api@2.12.5':
|
||||
resolution: {integrity: sha512-G9QIMt5fzED+aS4QhVK3w1HWLKpLIwH/MnpCr9z1ugGEHnS2ORmqrLkc0uALOjRK4qXJy+4Yiw8LDl/KicC1Hg==}
|
||||
'@tauri-apps/api@2.13.0':
|
||||
resolution: {integrity: sha512-O0uLpOZcFxbHMtkSv8sE6WNTuoUu4pOHtKQn0R6GPAFNJaOgaFa+LrR3emw1jRWA9ebVC8PZUS3Q2p881yFNrA==}
|
||||
|
||||
'@tauri-apps/cli-darwin-arm64@2.12.6':
|
||||
resolution: {integrity: sha512-Uokwk1hFfJoG54+kD8iU0St33jAIkNvojnjEfBZ6UbL5rnM10AiFwUS/2DHTJ9R4/Kba4U44v7djfMuWFTQgeg==}
|
||||
'@tauri-apps/cli-darwin-arm64@2.13.0':
|
||||
resolution: {integrity: sha512-xqWG7E1j6HEcU0ZMXIxNP5MqtR3LKfvb+6iH5bvG6e3QgpaEP1Syz/j1fnX7M55Raqi6Rs4FJGTHlsG8C65Mtg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@tauri-apps/cli-darwin-x64@2.12.6':
|
||||
resolution: {integrity: sha512-WhahqzcyHCpCzh4Taf0ZbBm6nGkvuOSh5ffrgOO7EdYaYe+RBQK8LOlFu+bbjul5v9cdLDi3kco+0+7IlZtTVA==}
|
||||
'@tauri-apps/cli-darwin-x64@2.13.0':
|
||||
resolution: {integrity: sha512-L4WEEqEc7WH3KFCnbpSUnlPud5Qs/CQ+i1USaOvhwTy3PO3JpeW1sTKB7WKUG9QeGke7tE1KL8liVd8/3lpqgg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf@2.12.6':
|
||||
resolution: {integrity: sha512-GB6weN+iFHxiFZ9SOKW6fINis7gnxohoOldR7sryBe7uaavkFGaMCa0yQs5njeXPWvzlE9WTQ13z8oDjmqK+Ww==}
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf@2.13.0':
|
||||
resolution: {integrity: sha512-SRjozN64oQgs1I8ErMsNqTKmlSSyAQ9yVM7X+0FUkZQ0isqx42qOzJ02HkKhoEG/+ucZ15HjsL+LEe0ooFjxVg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-gnu@2.12.6':
|
||||
resolution: {integrity: sha512-mdHoUFYKfztUtPKE0C2hhGkEo7j6swXjg+5yRRKSD7A2gLkRPQFIXWD/DAYhiJdeAkyA8MCP6nvvKvg/4YryWQ==}
|
||||
'@tauri-apps/cli-linux-arm64-gnu@2.13.0':
|
||||
resolution: {integrity: sha512-ZZWiHcyrtLCCoUdfOBVWazKwDtc/c09BXrxziXcL2lUSnUBOWpzd9ROo0EzNDGDJEFB8S4cQHx+wRG6GL2MyFA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.12.6':
|
||||
resolution: {integrity: sha512-2BxB+9a3JRN0eJ0t0qGe8IKJfgBLOZDE8a499OXH+yg4J9bMpSK1oHXBxnHuSHFWhby4QnQ/t+sBf7tRC0UZeA==}
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.13.0':
|
||||
resolution: {integrity: sha512-0W9GgBF155WPbcVnYJHxDxVXDM/gYSywGKfGZIQrMMLv03AqeMcc+mxz4/NZBT5FO36jHPxhy8VNiy0yk+qfzQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@tauri-apps/cli-linux-riscv64-gnu@2.12.6':
|
||||
resolution: {integrity: sha512-sb58RsNHex9QVqHdN1cf9MMlamUWAtk1NzuxTZalUnBUHfblIbe71hfmdI6whDZ84MufgOdeg/bzvhrbZS1r0w==}
|
||||
'@tauri-apps/cli-linux-riscv64-gnu@2.13.0':
|
||||
resolution: {integrity: sha512-1kKCOh768IIoqgE4o7g5zhi5SnbzqW8p82RmPcg8zFYLb17+LNwvMzpJexUWqIM2U2QkbT8rH0wfcjiaR6rTDA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.12.6':
|
||||
resolution: {integrity: sha512-ZAb4/CHRma3ErjL2RGfHjITTUBIs4zySf0hIli9BddOtEdSx0ze0hEgxl+HfBVc5OEW/QmbiZ2E2+CkkHc8Pcg==}
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.13.0':
|
||||
resolution: {integrity: sha512-Riq+64bPGAFoLjgnqcslFIb0Rijnm5oCjLCX6xZETWClNPMADmHflCyNwLO7XO3s97Uv6ZX2yTnpwULAyII08A==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tauri-apps/cli-linux-x64-musl@2.12.6':
|
||||
resolution: {integrity: sha512-ueSzM2Du6r4i1d/lby9kEvrhPnXw5zM/VYvcW1ldEWSpkUyVohsBXkmD+U7vMskEW5tXeCUenki7nYVxyGBGpQ==}
|
||||
'@tauri-apps/cli-linux-x64-musl@2.13.0':
|
||||
resolution: {integrity: sha512-xbkW27qp9+YrU1pLebEJy300jH9NtUWEAMpMsCYS3KiZ00jv9ui3p26YWINhTgo+Yj53CDTK9B7ROViCKAluqQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.12.6':
|
||||
resolution: {integrity: sha512-6bmOt2BQSe0Bba+5CJcTKSML7VOYDxyiAKyBrjo86VxMdC1usIQmklu3Xc83s3QoK1rOMwwbANlPF6i5R2mvIg==}
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.13.0':
|
||||
resolution: {integrity: sha512-gjjU8TYHXPenmQvmdvJYwGX1KNHBG/3dXviJvBuX2S1hV4uOFMulTVWnPKPn3N/HgfCn0p5+7HzPKKobdNAfSg==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@tauri-apps/cli-win32-ia32-msvc@2.12.6':
|
||||
resolution: {integrity: sha512-9q9ZFNuFreBczwyJuhhlrEOBzGClwWUYirQ2GBl66Y6EaNl17IdLH8TRqoY9wYB1LnctNBi+Fa/WMGtFA4BtFQ==}
|
||||
'@tauri-apps/cli-win32-ia32-msvc@2.13.0':
|
||||
resolution: {integrity: sha512-9Ln67dSuuIaVJAhdvOnJOtD9gQxeHCvhQ6OcbkxaM0EZu1Ed1ZqxImpyVBov6c7AJfzpollO93i7ZXJGsnYMtQ==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@tauri-apps/cli-win32-x64-msvc@2.12.6':
|
||||
resolution: {integrity: sha512-ion7Chbj21ROxMRpjQ7G8rz5sIOaI7IoBQum1oq5sl1V5zGWyc/oYnCrQhVqO2TxK/lBDWxt648BzLi02SY3Xg==}
|
||||
'@tauri-apps/cli-win32-x64-msvc@2.13.0':
|
||||
resolution: {integrity: sha512-IPcIRMjzAXgYTH+rQxFQFwrHu4/3txIA2ONNmQpWUCHXQgukazrPYJrKaMJSjDh83ysbusjsQ16Z89qhtxFNJA==}
|
||||
engines: {node: '>= 10'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@tauri-apps/cli@2.12.6':
|
||||
resolution: {integrity: sha512-/cOeQgqq8PBDPODOjjT0YHs4qxKCHcQMWMiBm4rLM3JNr9mZE+PHNKOK4zAkhIUtYMNL/0fweW48VNvzD1AbqA==}
|
||||
'@tauri-apps/cli@2.13.0':
|
||||
resolution: {integrity: sha512-NhPUU24BnPfofhfPlPCJFPHVG9sVq7B4V9zGCRXFEhXFeNnLtjwnHSDoiR3IXoJUumsKd/q6sNLsMr/rr88GBQ==}
|
||||
engines: {node: '>= 10'}
|
||||
hasBin: true
|
||||
|
||||
@@ -2162,45 +2153,22 @@ packages:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/project-service@8.70.0':
|
||||
resolution: {integrity: sha512-hFHbTNqhU9G+2eKFXCBVb1tjFT/LceiJ4+HfLO4pTpDI0KHi6iajpcFFkaSQ9gXmCh7n82A0PthaayEdN6mspQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/project-service@8.74.0':
|
||||
resolution: {integrity: sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/scope-manager@8.70.0':
|
||||
resolution: {integrity: sha512-8nP3Kwh5hlgZ4FicGvmznAmJe8UL4sdU8tLukrPaMuQmDuk4Y8xYfzu/aYZW4xT2JCgc7H/TpDI5cGlxcWJSqQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/scope-manager@8.74.0':
|
||||
resolution: {integrity: sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.70.0':
|
||||
resolution: {integrity: sha512-adnkeeNq9Sq1sUf4+FRVc0KdgYghzsgFpZSQVZVvY0LCuUuN0FnQgyGzCJeC4fW1cdXseBAjU2EOqUIjbNcZUw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.74.0':
|
||||
resolution: {integrity: sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/type-utils@8.70.0':
|
||||
resolution: {integrity: sha512-NUMKIhYVaVIVLnRL9CRt+VVcuLgSHUCpXn4/+K8wql+vdInUzvx8BjUO1oJ7cG9shjFJKtF8F8Hh2kCh3/KBVw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/type-utils@8.74.0':
|
||||
resolution: {integrity: sha512-CV3Y3la8l3F9ANfxcfpgSSiQgJTe4IeLEoZV4O/gcW86Ugp8X6SKiQ0vm+QegXaRIbbDMokZZSF3A1CgiU/kPw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
@@ -2208,20 +2176,10 @@ packages:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/types@8.70.0':
|
||||
resolution: {integrity: sha512-asTOIYhDg4zdzOScCyaytrsV3cR6B4ecPQlXw/dJIm7J/MZTtCtfVII9JD8Geh4jTCrK/Xe6cg5UevoleMcoJQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/types@8.74.0':
|
||||
resolution: {integrity: sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.70.0':
|
||||
resolution: {integrity: sha512-d9NmHMPEKQ7QCLLm1jI3zmoQBwT5KwFYjXBJ9ymZfKCUU+5rmTRykKAFvH5Qn/ZCds3CEAFS9OC9M/jkl0X2bA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.74.0':
|
||||
resolution: {integrity: sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
@@ -2232,13 +2190,6 @@ packages:
|
||||
'@typescript/native':
|
||||
optional: true
|
||||
|
||||
'@typescript-eslint/utils@8.70.0':
|
||||
resolution: {integrity: sha512-oZmtKJz/4fufZ2p3+Cn3ijEojcdfR+1zYDH2xKYrEly0dR/Q/1xUPRCOlKGxod78nWlU2UnDe09GZ3TaknBFGA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/utils@8.74.0':
|
||||
resolution: {integrity: sha512-IpWXPxXXomzxyTcvjhZJexgdvtTR1TooLAPpuxzaGqQ8BHll1lf4Ysp/BTE/l0U5TJ+x1j7B4bEM8pLRrvY+XA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
@@ -2246,10 +2197,6 @@ packages:
|
||||
eslint: ^8.57.0 || ^9.0.0 || ^10.0.0
|
||||
typescript: '>=4.8.4 <6.1.0'
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.70.0':
|
||||
resolution: {integrity: sha512-BoC8PiO4Hkdo0TVJh9Ntxr5MxPDI7/oFsrygN5ADelFSeXG/qgNuucIGA+L5Z6JpPTE/uRfcTWtscjbUaufepQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.74.0':
|
||||
resolution: {integrity: sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
@@ -2569,9 +2516,6 @@ packages:
|
||||
resolution: {integrity: sha512-zlnpg0jNcibNrO7GG9IeHH7maWFeCz+Ja1wx/7tZNU5ASSSSZ+/qZciM0/LHCYxSdqv5h2sdbQ/PXYdOuetXvA==}
|
||||
engines: {node: '>=0.10'}
|
||||
|
||||
client-only@0.0.1:
|
||||
resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==}
|
||||
|
||||
clsx@2.1.1:
|
||||
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -2850,12 +2794,6 @@ packages:
|
||||
eslint: '*'
|
||||
typescript: '*'
|
||||
|
||||
eslint-plugin-sukka@10.2.0:
|
||||
resolution: {integrity: sha512-BbErYY/fymqL7Te5yiDeBGfSF7QMxzZrT4SQpFI2e8ecRun3oYbL5aJm4kzFfeUzNZ/hET8T7pedpaH1fuXXHg==}
|
||||
peerDependencies:
|
||||
eslint: '>=9.29.0'
|
||||
typescript: '*'
|
||||
|
||||
eslint-plugin-unused-imports@4.4.1:
|
||||
resolution: {integrity: sha512-oZGYUz1X3sRMGUB+0cZyK2VcvRX5lm/vB56PgNNcU+7ficUCKm66oZWKUubXWnOuPjQ8PvmXtCViXBMONPe7tQ==}
|
||||
peerDependencies:
|
||||
@@ -2929,9 +2867,6 @@ packages:
|
||||
event-emitter@0.3.5:
|
||||
resolution: {integrity: sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==}
|
||||
|
||||
event-target-bus@1.1.0:
|
||||
resolution: {integrity: sha512-24JX34nM0qRcsj7KvtLbVpMcX8ZQYmb0+0a6viaV2GJtVFg5UGyJyDLITkBipJIG0fSscNskI2PxdhTBIMeg8g==}
|
||||
|
||||
expect-type@1.4.0:
|
||||
resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
@@ -2945,10 +2880,6 @@ packages:
|
||||
fast-deep-equal@3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
|
||||
fast-fnv1a@1.0.0:
|
||||
resolution: {integrity: sha512-Y7iaFmz24pNJX+nqXgDuyHYFTfV9XPWJRfqp0hlG0Xuz1vKnelwLwvmKkbvVVvp5WzYWnrovBTLdk2PWkOYzCg==}
|
||||
engines: {node: ^22.15.0 || ^23.8.0 || >=24.0.0}
|
||||
|
||||
fast-json-stable-stringify@2.1.0:
|
||||
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
||||
|
||||
@@ -2983,10 +2914,6 @@ packages:
|
||||
flatted@3.4.4:
|
||||
resolution: {integrity: sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==}
|
||||
|
||||
fnv1a52@1.0.0:
|
||||
resolution: {integrity: sha512-dUnV6Uok578HuGYTC/EM0LqeXewXBCHsh/kmLkdcqN1zgSy7K3gCIrshPBS5JwW20XSaRv4Vnz7z8lMjOV8jWw==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
|
||||
follow-redirects@1.16.2:
|
||||
resolution: {integrity: sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==}
|
||||
engines: {node: '>=4.0'}
|
||||
@@ -3005,20 +2932,6 @@ packages:
|
||||
engines: {node: ^20.12.0 || >=22}
|
||||
hasBin: true
|
||||
|
||||
foxact@0.3.12:
|
||||
resolution: {integrity: sha512-sXE1plDgAUsKWzqbAMq/+ifRI3TSOnDPmyZGoaniW9AhtZqk3cOEUSC0jC4a4srvLf4PXwtCB+zQczBdxHGSDA==}
|
||||
peerDependencies:
|
||||
react: '*'
|
||||
react-dom: '*'
|
||||
peerDependenciesMeta:
|
||||
react:
|
||||
optional: true
|
||||
react-dom:
|
||||
optional: true
|
||||
|
||||
foxts@5.9.1:
|
||||
resolution: {integrity: sha512-NrIHGlf4LZGTjjGlVi3gmMbtvC4871SFUflu9yb8X91FYppAk+WMiYS6ZlaEgkPqAkgIGNeq+Y5YCL80GL6v8g==}
|
||||
|
||||
fsevents@2.3.3:
|
||||
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
@@ -3368,9 +3281,6 @@ packages:
|
||||
lru-queue@0.1.0:
|
||||
resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==}
|
||||
|
||||
magic-string@1.4.1:
|
||||
resolution: {integrity: sha512-8lyCu36ErXR0J9uaGKlKQoiLZKmtI63YGLE8G2o9jyRPdr4X47LusSOwgOJOzcVtp81fTAAjxR7BwKz682Jhow==}
|
||||
|
||||
magic-string@1.4.5:
|
||||
resolution: {integrity: sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==}
|
||||
|
||||
@@ -3490,10 +3400,6 @@ packages:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
||||
minimatch@10.2.6:
|
||||
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
|
||||
engines: {node: 18 || 20 || >=22}
|
||||
|
||||
minimatch@11.0.9:
|
||||
resolution: {integrity: sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==}
|
||||
engines: {node: 20 || >=22}
|
||||
@@ -3833,9 +3739,6 @@ packages:
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
server-only@0.0.1:
|
||||
resolution: {integrity: sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -3926,8 +3829,8 @@ packages:
|
||||
resolution: {gitHosted: true, integrity: sha512-4nRJ9eBOdd+mT9KaqEhUNya8bh/zaHHAJMBRgFR62KxSZ0S77mcjkB6Bz2xmHqPdYrhbi58aD6UcybEp4a6UyA==, tarball: https://codeload.github.com/clash-verge-rev/tauri-plugin-mihomo/tar.gz/7e4fa8642cf6c394ed88b5a969420d8eab60087f}
|
||||
version: 0.7.1
|
||||
|
||||
terser@5.51.2:
|
||||
resolution: {integrity: sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q==}
|
||||
terser@5.51.3:
|
||||
resolution: {integrity: sha512-j5jPZZ6Sz0Eg2unusKhdRzUhUlHXJ3Bw2AkIXyJ6AqajWwihUlZOdJS+KSnZzmtVk6mFGdm3hHg0+M2sgyEz5Q==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
@@ -5150,12 +5053,13 @@ snapshots:
|
||||
'@eslint-react/ast@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/typescript-estree': 8.70.0(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/typescript-estree': 8.74.0(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
string-ts: 2.3.1
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint-react/core@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
@@ -5166,11 +5070,12 @@ snapshots:
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.74.0
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint-react/eslint-plugin@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
@@ -5185,14 +5090,16 @@ snapshots:
|
||||
eslint-plugin-react-x: 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint-react/eslint@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint-react/jsx@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
@@ -5202,22 +5109,24 @@ snapshots:
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint-react/shared@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-react/eslint': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
zod: 4.6.5
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint-react/var@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
@@ -5226,11 +5135,12 @@ snapshots:
|
||||
'@eslint-react/eslint': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.74.0
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@eslint/config-array@0.23.7':
|
||||
@@ -5800,78 +5710,78 @@ snapshots:
|
||||
|
||||
'@tanstack/virtual-core@3.17.11': {}
|
||||
|
||||
'@tauri-apps/api@2.12.5': {}
|
||||
'@tauri-apps/api@2.13.0': {}
|
||||
|
||||
'@tauri-apps/cli-darwin-arm64@2.12.6':
|
||||
'@tauri-apps/cli-darwin-arm64@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-darwin-x64@2.12.6':
|
||||
'@tauri-apps/cli-darwin-x64@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf@2.12.6':
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-gnu@2.12.6':
|
||||
'@tauri-apps/cli-linux-arm64-gnu@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.12.6':
|
||||
'@tauri-apps/cli-linux-arm64-musl@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-riscv64-gnu@2.12.6':
|
||||
'@tauri-apps/cli-linux-riscv64-gnu@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.12.6':
|
||||
'@tauri-apps/cli-linux-x64-gnu@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-linux-x64-musl@2.12.6':
|
||||
'@tauri-apps/cli-linux-x64-musl@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.12.6':
|
||||
'@tauri-apps/cli-win32-arm64-msvc@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-win32-ia32-msvc@2.12.6':
|
||||
'@tauri-apps/cli-win32-ia32-msvc@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli-win32-x64-msvc@2.12.6':
|
||||
'@tauri-apps/cli-win32-x64-msvc@2.13.0':
|
||||
optional: true
|
||||
|
||||
'@tauri-apps/cli@2.12.6':
|
||||
'@tauri-apps/cli@2.13.0':
|
||||
optionalDependencies:
|
||||
'@tauri-apps/cli-darwin-arm64': 2.12.6
|
||||
'@tauri-apps/cli-darwin-x64': 2.12.6
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf': 2.12.6
|
||||
'@tauri-apps/cli-linux-arm64-gnu': 2.12.6
|
||||
'@tauri-apps/cli-linux-arm64-musl': 2.12.6
|
||||
'@tauri-apps/cli-linux-riscv64-gnu': 2.12.6
|
||||
'@tauri-apps/cli-linux-x64-gnu': 2.12.6
|
||||
'@tauri-apps/cli-linux-x64-musl': 2.12.6
|
||||
'@tauri-apps/cli-win32-arm64-msvc': 2.12.6
|
||||
'@tauri-apps/cli-win32-ia32-msvc': 2.12.6
|
||||
'@tauri-apps/cli-win32-x64-msvc': 2.12.6
|
||||
'@tauri-apps/cli-darwin-arm64': 2.13.0
|
||||
'@tauri-apps/cli-darwin-x64': 2.13.0
|
||||
'@tauri-apps/cli-linux-arm-gnueabihf': 2.13.0
|
||||
'@tauri-apps/cli-linux-arm64-gnu': 2.13.0
|
||||
'@tauri-apps/cli-linux-arm64-musl': 2.13.0
|
||||
'@tauri-apps/cli-linux-riscv64-gnu': 2.13.0
|
||||
'@tauri-apps/cli-linux-x64-gnu': 2.13.0
|
||||
'@tauri-apps/cli-linux-x64-musl': 2.13.0
|
||||
'@tauri-apps/cli-win32-arm64-msvc': 2.13.0
|
||||
'@tauri-apps/cli-win32-ia32-msvc': 2.13.0
|
||||
'@tauri-apps/cli-win32-x64-msvc': 2.13.0
|
||||
|
||||
'@tauri-apps/plugin-clipboard-manager@2.5.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
'@tauri-apps/plugin-dialog@2.8.4':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
'@tauri-apps/plugin-fs@2.7.1':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
'@tauri-apps/plugin-http@2.9.0':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
'@tauri-apps/plugin-opener@2.7.3':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
'@tauri-apps/plugin-updater@2.14.1':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
'@tsrs/darwin-arm64@0.20.0-ts7.1.0-beta':
|
||||
optional: true
|
||||
@@ -5995,15 +5905,6 @@ snapshots:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/project-service@8.70.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.70.0(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
debug: 4.4.3
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/project-service@8.74.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/tsconfig-utils': 8.74.0(typescript@6.0.3)
|
||||
@@ -6013,36 +5914,15 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/scope-manager@8.70.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.70.0
|
||||
'@typescript-eslint/visitor-keys': 8.70.0
|
||||
|
||||
'@typescript-eslint/scope-manager@8.74.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/visitor-keys': 8.74.0
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.70.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@typescript-eslint/tsconfig-utils@8.74.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@typescript-eslint/type-utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.70.0
|
||||
'@typescript-eslint/typescript-estree': 8.70.0(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
debug: 4.4.3
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/type-utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
@@ -6056,25 +5936,8 @@ snapshots:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/types@8.70.0': {}
|
||||
|
||||
'@typescript-eslint/types@8.74.0': {}
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.70.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/project-service': 8.70.0(typescript@6.0.3)
|
||||
'@typescript-eslint/tsconfig-utils': 8.70.0(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.70.0
|
||||
'@typescript-eslint/visitor-keys': 8.70.0
|
||||
debug: 4.4.3
|
||||
minimatch: 10.2.6
|
||||
semver: 7.8.5
|
||||
tinyglobby: 0.2.17
|
||||
ts-api-utils: 2.5.0(typescript@6.0.3)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/typescript-estree@8.74.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@typescript-eslint/project-service': 8.74.0(typescript@6.0.3)
|
||||
@@ -6090,17 +5953,6 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.10.1(eslint@10.16.0(jiti@2.7.0))
|
||||
'@typescript-eslint/scope-manager': 8.70.0
|
||||
'@typescript-eslint/types': 8.70.0
|
||||
'@typescript-eslint/typescript-estree': 8.70.0(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.10.1(eslint@10.16.0(jiti@2.7.0))
|
||||
@@ -6113,11 +5965,6 @@ snapshots:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.70.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.70.0
|
||||
eslint-visitor-keys: 5.0.1
|
||||
|
||||
'@typescript-eslint/visitor-keys@8.74.0':
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
@@ -6195,7 +6042,7 @@ snapshots:
|
||||
'@unrs/resolver-binding-win32-x64-msvc@1.12.2':
|
||||
optional: true
|
||||
|
||||
'@vitejs/plugin-legacy@8.2.3(terser@5.51.2)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))':
|
||||
'@vitejs/plugin-legacy@8.2.3(terser@5.51.3)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))':
|
||||
dependencies:
|
||||
'@babel/core': 7.29.7
|
||||
'@babel/plugin-transform-dynamic-import': 7.29.7(@babel/core@7.29.7)
|
||||
@@ -6206,27 +6053,27 @@ snapshots:
|
||||
browserslist: 4.29.0
|
||||
browserslist-to-esbuild: 2.1.1(browserslist@4.29.0)
|
||||
core-js: 3.50.0
|
||||
magic-string: 1.4.1
|
||||
magic-string: 1.4.5
|
||||
regenerator-runtime: 0.14.1
|
||||
systemjs: 6.15.1
|
||||
terser: 5.51.2
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)
|
||||
terser: 5.51.3
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@vitejs/plugin-react@6.1.1(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))':
|
||||
'@vitejs/plugin-react@6.1.1(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))':
|
||||
dependencies:
|
||||
'@rolldown/pluginutils': 1.0.1
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)
|
||||
|
||||
'@vitest/mocker@5.1.2(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))':
|
||||
'@vitest/mocker@5.1.2(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))':
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
'@vitest/spy': 5.1.2
|
||||
estree-walker: 3.0.3
|
||||
magic-string: 1.4.5
|
||||
optionalDependencies:
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)
|
||||
|
||||
'@vitest/spy@5.1.2': {}
|
||||
|
||||
@@ -6390,8 +6237,6 @@ snapshots:
|
||||
memoizee: 0.4.17
|
||||
timers-ext: 0.1.8
|
||||
|
||||
client-only@0.0.1: {}
|
||||
|
||||
clsx@2.1.1: {}
|
||||
|
||||
combined-stream@1.0.8:
|
||||
@@ -6564,7 +6409,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
unrs-resolver: 1.12.2
|
||||
|
||||
eslint-import-resolver-typescript@4.4.5(eslint-plugin-import-x@4.18.1(@typescript-eslint/utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)))(eslint@10.16.0(jiti@2.7.0)):
|
||||
eslint-import-resolver-typescript@4.4.5(eslint-plugin-import-x@4.18.1(@typescript-eslint/utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)))(eslint@10.16.0(jiti@2.7.0)):
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
@@ -6575,7 +6420,7 @@ snapshots:
|
||||
tinyglobby: 0.2.17
|
||||
unrs-resolver: 1.12.2
|
||||
optionalDependencies:
|
||||
eslint-plugin-import-x: 4.18.1(@typescript-eslint/utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))
|
||||
eslint-plugin-import-x: 4.18.1(@typescript-eslint/utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -6586,7 +6431,7 @@ snapshots:
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
eslint-type-tracer: 0.5.2(eslint@10.16.0(jiti@2.7.0))
|
||||
|
||||
eslint-plugin-import-x@4.18.1(@typescript-eslint/utils@8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)):
|
||||
eslint-plugin-import-x@4.18.1(@typescript-eslint/utils@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)):
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
cjs-module-lexer: 2.3.0
|
||||
@@ -6601,7 +6446,7 @@ snapshots:
|
||||
stable-hash-x: 0.2.0
|
||||
unrs-resolver: 1.12.2
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -6626,11 +6471,12 @@ snapshots:
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
compare-versions: 6.1.1
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-react-hooks@7.1.1(eslint@10.16.0(jiti@2.7.0)):
|
||||
@@ -6652,10 +6498,11 @@ snapshots:
|
||||
'@eslint-react/jsx': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-react-naming-convention@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3):
|
||||
@@ -6666,11 +6513,12 @@ snapshots:
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-react-refresh@0.5.7(eslint@10.16.0(jiti@2.7.0)):
|
||||
@@ -6685,10 +6533,11 @@ snapshots:
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-react-web-api@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3):
|
||||
@@ -6699,11 +6548,12 @@ snapshots:
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-react-x@5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3):
|
||||
@@ -6715,10 +6565,10 @@ snapshots:
|
||||
'@eslint-react/shared': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@eslint-react/var': 5.20.5(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/scope-manager': 8.74.0
|
||||
'@typescript-eslint/type-utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/type-utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/typescript-estree': 8.70.0(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
'@typescript-eslint/typescript-estree': 8.74.0(typescript@6.0.3)
|
||||
'@typescript-eslint/utils': 8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
compare-versions: 6.1.1
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
string-ts: 2.3.1
|
||||
@@ -6726,16 +6576,7 @@ snapshots:
|
||||
ts-pattern: 5.9.0
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-sukka@10.2.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3):
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 8.74.0
|
||||
'@typescript-eslint/utils': 8.70.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3)
|
||||
eslint: 10.16.0(jiti@2.7.0)
|
||||
foxts: 5.9.1
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
- '@typescript/native'
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-unused-imports@4.4.1(@typescript-eslint/eslint-plugin@8.74.0(@typescript-eslint/parser@8.74.0(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0))(typescript@6.0.3))(eslint@10.16.0(jiti@2.7.0)):
|
||||
@@ -6835,8 +6676,6 @@ snapshots:
|
||||
d: 1.0.2
|
||||
es5-ext: 0.10.64
|
||||
|
||||
event-target-bus@1.1.0: {}
|
||||
|
||||
expect-type@1.4.0: {}
|
||||
|
||||
ext@1.7.0:
|
||||
@@ -6847,8 +6686,6 @@ snapshots:
|
||||
|
||||
fast-deep-equal@3.1.3: {}
|
||||
|
||||
fast-fnv1a@1.0.0: {}
|
||||
|
||||
fast-json-stable-stringify@2.1.0: {}
|
||||
|
||||
fast-levenshtein@2.0.6: {}
|
||||
@@ -6880,8 +6717,6 @@ snapshots:
|
||||
|
||||
flatted@3.4.4: {}
|
||||
|
||||
fnv1a52@1.0.0: {}
|
||||
|
||||
follow-redirects@1.16.2(debug@4.4.3):
|
||||
optionalDependencies:
|
||||
debug: 4.4.3
|
||||
@@ -6904,20 +6739,6 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- '@clack/prompts'
|
||||
|
||||
foxact@0.3.12(react-dom@19.3.1(react@19.3.1))(react@19.3.1):
|
||||
dependencies:
|
||||
client-only: 0.0.1
|
||||
event-target-bus: 1.1.0
|
||||
server-only: 0.0.1
|
||||
optionalDependencies:
|
||||
react: 19.3.1
|
||||
react-dom: 19.3.1(react@19.3.1)
|
||||
|
||||
foxts@5.9.1:
|
||||
dependencies:
|
||||
fast-fnv1a: 1.0.0
|
||||
fnv1a52: 1.0.0
|
||||
|
||||
fsevents@2.3.3:
|
||||
optional: true
|
||||
|
||||
@@ -7278,10 +7099,6 @@ snapshots:
|
||||
dependencies:
|
||||
es5-ext: 0.10.64
|
||||
|
||||
magic-string@1.4.1:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.6.0
|
||||
|
||||
magic-string@1.4.5:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.6.0
|
||||
@@ -7533,10 +7350,6 @@ snapshots:
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
|
||||
minimatch@10.2.6:
|
||||
dependencies:
|
||||
brace-expansion: 5.0.12
|
||||
|
||||
minimatch@11.0.9:
|
||||
dependencies:
|
||||
'@isaacs/nonrecursive-glob-match': 1.1.0
|
||||
@@ -7921,8 +7734,6 @@ snapshots:
|
||||
|
||||
semver@7.8.5: {}
|
||||
|
||||
server-only@0.0.1: {}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
@@ -7992,9 +7803,9 @@ snapshots:
|
||||
|
||||
tauri-plugin-mihomo-api@https://codeload.github.com/clash-verge-rev/tauri-plugin-mihomo/tar.gz/7e4fa8642cf6c394ed88b5a969420d8eab60087f:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.12.5
|
||||
'@tauri-apps/api': 2.13.0
|
||||
|
||||
terser@5.51.2:
|
||||
terser@5.51.3:
|
||||
dependencies:
|
||||
'@jridgewell/source-map': 0.3.11
|
||||
acorn: 8.18.0
|
||||
@@ -8177,18 +7988,18 @@ snapshots:
|
||||
'@types/unist': 3.0.3
|
||||
vfile-message: 4.0.3
|
||||
|
||||
vite-plugin-svgr@5.2.0(typescript@6.0.3)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)):
|
||||
vite-plugin-svgr@5.2.0(typescript@6.0.3)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)):
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.4.0
|
||||
'@svgr/core': 8.1.0(typescript@6.0.3)
|
||||
'@svgr/plugin-jsx': 8.1.0(@svgr/core@8.1.0(typescript@6.0.3))
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)
|
||||
transitivePeerDependencies:
|
||||
- rollup
|
||||
- supports-color
|
||||
- typescript
|
||||
|
||||
vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1):
|
||||
vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1):
|
||||
dependencies:
|
||||
lightningcss: 1.33.0
|
||||
picomatch: 4.0.7
|
||||
@@ -8200,13 +8011,13 @@ snapshots:
|
||||
fsevents: 2.3.3
|
||||
jiti: 2.7.0
|
||||
sass: 1.104.1
|
||||
terser: 5.51.2
|
||||
terser: 5.51.3
|
||||
yaml: 2.9.1
|
||||
|
||||
vitest@5.1.2(@types/node@26.6.5)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)):
|
||||
vitest@5.1.2(@types/node@26.6.5)(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)):
|
||||
dependencies:
|
||||
'@types/chai': 5.2.3
|
||||
'@vitest/mocker': 5.1.2(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1))
|
||||
'@vitest/mocker': 5.1.2(vite@8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1))
|
||||
chai: 6.3.0
|
||||
es-module-lexer: 2.3.2
|
||||
expect-type: 1.4.0
|
||||
@@ -8217,7 +8028,7 @@ snapshots:
|
||||
tinybench: 6.2.5
|
||||
tinyexec: 1.3.1
|
||||
tinyglobby: 0.2.17
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.2)(yaml@2.9.1)
|
||||
vite: 8.3.3(@types/node@26.6.5)(jiti@2.7.0)(sass@1.104.1)(terser@5.51.3)(yaml@2.9.1)
|
||||
why-is-node-running: 3.2.1
|
||||
optionalDependencies:
|
||||
'@types/node': 26.6.5
|
||||
|
||||
+14
-10
@@ -27,7 +27,7 @@ perf-harness = ["dep:tauri-plugin-wdio-webdriver"]
|
||||
identifier = "io.github.clash-verge-rev.clash-verge-rev"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.7.6", features = [] }
|
||||
tauri-build = { version = "2.8.0", features = [] }
|
||||
|
||||
[dependencies]
|
||||
clash-verge-draft = { workspace = true }
|
||||
@@ -64,7 +64,6 @@ tristr = { workspace = true }
|
||||
socket2 = { workspace = true }
|
||||
warp = { version = "0.4.4", features = ["server"] }
|
||||
open = "5.4.5"
|
||||
rfd = { version = "0.18.0", default-features = false, features = ["common-controls-v6", "xdg-portal"] }
|
||||
dirs = "7.0.0"
|
||||
dunce = "1.0.5"
|
||||
nanoid = "0.5"
|
||||
@@ -78,10 +77,10 @@ sysproxy = { git = "https://github.com/clash-verge-rev/sysproxy-rs.git", rev = "
|
||||
network-interface = { version = "2.0.5", features = ["serde"] }
|
||||
tauri-plugin-shell = "2.6.0"
|
||||
tauri-plugin-opener = "2.7.3"
|
||||
tauri-plugin-dialog = "2.8.4"
|
||||
tauri-plugin-fs = "2.7.1"
|
||||
tauri-plugin-dialog = { version = "2.9.0", default-features = false, features = ["gtk3"] }
|
||||
tauri-plugin-fs = "2.8.0"
|
||||
tauri-plugin-deep-link = "2.6.3"
|
||||
tauri-plugin-window-state = "2.5.0"
|
||||
tauri-plugin-window-state = "2.5.1"
|
||||
zip = { workspace = true }
|
||||
flate2 = "1.1.11"
|
||||
reqwest_dav = "0.4.0"
|
||||
@@ -92,8 +91,8 @@ getrandom = "0.4.3"
|
||||
futures = { workspace = true }
|
||||
gethostname = "1.1.0"
|
||||
tauri-plugin-notification = "2.8.1"
|
||||
backon = { version = "1.6.0", features = ["tokio-sleep"] }
|
||||
tauri-plugin-http = "2.9.0"
|
||||
tauri-plugin-http = "2.10.0"
|
||||
backon = { version = "1.7.0", features = ["tokio-sleep"] }
|
||||
tracing = { workspace = true }
|
||||
tauri-plugin-devtools = { version = "2.2.3", optional = true }
|
||||
tauri-plugin-mihomo = { git = "https://github.com/clash-verge-rev/tauri-plugin-mihomo", rev = "7e4fa8642cf6c394ed88b5a969420d8eab60087f" }
|
||||
@@ -101,7 +100,7 @@ async-trait = "0.1.92"
|
||||
clash_verge_service_ipc = { workspace = true, features = ["client"] }
|
||||
arc-swap = "1.9.5"
|
||||
tokio-rustls = "0.26.6"
|
||||
rustls = { version = "0.23.46", features = ["ring"] }
|
||||
rustls = { version = "0.23.47", features = ["ring"] }
|
||||
webpki-roots = "1.0.12"
|
||||
dark-light = "3.0.0"
|
||||
bytes = "1.12.2"
|
||||
@@ -114,11 +113,16 @@ specta-typescript = "=0.0.13"
|
||||
libc = "0.2.191"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
gtk = "0.19"
|
||||
tauri = { workspace = true, features = ["linux-ksni"] }
|
||||
# Upstream has no session-end signal support on Linux; see crates/clash-verge-signal.
|
||||
clash-verge-signal = { workspace = true }
|
||||
|
||||
[target.'cfg(not(target_os = "linux"))'.dependencies]
|
||||
rfd = { version = "0.18.0", default-features = false, features = ["common-controls-v6"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
tauri-plugin-wdio-webdriver = { version = "=1.5.1", optional = true }
|
||||
tauri-plugin-wdio-webdriver = { version = "=2.0.0-next.0", optional = true }
|
||||
objc2 = "0.6.5"
|
||||
objc2-foundation = { version = "0.3.2", features = [
|
||||
"NSString",
|
||||
@@ -147,7 +151,7 @@ quick-xml = "0.42.0"
|
||||
runas = "=1.2.0"
|
||||
winreg = "0.56.0"
|
||||
windows-service = "0.8.1"
|
||||
windows = { version = "0.62.2", features = [
|
||||
windows = { version = "0.101.0", features = [
|
||||
"Win32_System_Com",
|
||||
"Win32_System_Ole",
|
||||
"Win32_System_TaskScheduler",
|
||||
|
||||
@@ -81,6 +81,9 @@ Var VC_RUNTIME_NEEDED
|
||||
Var ServiceExisted
|
||||
Var ServiceStartType
|
||||
Var ServiceWasRunning
|
||||
Var ExistingVersionKind
|
||||
Var Webview2DownloadResult
|
||||
Var Webview2InstallExitCode
|
||||
|
||||
Name "${PRODUCTNAME}"
|
||||
BrandingText "${COPYRIGHT}"
|
||||
@@ -214,13 +217,13 @@ Function PageReinstall
|
||||
; Compare this installar version with the existing installation
|
||||
; and modify the messages presented to the user accordingly
|
||||
compare_version:
|
||||
StrCpy $R4 "$(older)"
|
||||
StrCpy $ExistingVersionKind "$(older)"
|
||||
${If} $WixMode = 1
|
||||
ReadRegStr $R0 HKLM "$R6" "DisplayVersion"
|
||||
${Else}
|
||||
ReadRegStr $R0 SHCTX "${UNINSTKEY}" "DisplayVersion"
|
||||
${EndIf}
|
||||
${IfThen} $R0 == "" ${|} StrCpy $R4 "$(unknown)" ${|}
|
||||
${IfThen} $R0 == "" ${|} StrCpy $ExistingVersionKind "$(unknown)" ${|}
|
||||
|
||||
nsis_tauri_utils::SemverCompare "${VERSION}" $R0
|
||||
Pop $R0
|
||||
@@ -895,8 +898,8 @@ Section WebView2
|
||||
Delete "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||
DetailPrint "$(webview2Downloading)"
|
||||
NSISdl::download "https://go.microsoft.com/fwlink/p/?LinkId=2124703" "$TEMP\MicrosoftEdgeWebview2Setup.exe"
|
||||
Pop $0
|
||||
${If} $0 == "success"
|
||||
Pop $Webview2DownloadResult
|
||||
${If} $Webview2DownloadResult == "success"
|
||||
DetailPrint "$(webview2DownloadSuccess)"
|
||||
${Else}
|
||||
DetailPrint "$(webview2DownloadError)"
|
||||
@@ -927,8 +930,8 @@ Section WebView2
|
||||
install_webview2:
|
||||
DetailPrint "$(installingWebview2)"
|
||||
; $6 holds the path to the webview2 installer
|
||||
ExecWait "$6 ${WEBVIEW2INSTALLERARGS} /install" $1
|
||||
${If} $1 = 0
|
||||
ExecWait "$6 ${WEBVIEW2INSTALLERARGS} /install" $Webview2InstallExitCode
|
||||
${If} $Webview2InstallExitCode = 0
|
||||
DetailPrint "$(webview2InstallSuccess)"
|
||||
${Else}
|
||||
DetailPrint "$(webview2InstallError)"
|
||||
@@ -953,8 +956,8 @@ Section WebView2
|
||||
${If} $R1 != ""
|
||||
; Chromium updater docs: https://source.chromium.org/chromium/chromium/src/+/main:docs/updater/user_manual.md
|
||||
; Modified from "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft EdgeWebView\ModifyPath"
|
||||
ExecWait `"$R1" /install appguid=${WEBVIEW2APPGUID}&needsadmin=true` $1
|
||||
${If} $1 = 0
|
||||
ExecWait `"$R1" /install appguid=${WEBVIEW2APPGUID}&needsadmin=true` $Webview2InstallExitCode
|
||||
${If} $Webview2InstallExitCode = 0
|
||||
DetailPrint "$(webview2InstallSuccess)"
|
||||
${Else}
|
||||
MessageBox MB_ICONEXCLAMATION|MB_ABORTRETRYIGNORE "$(webview2InstallError)" IDIGNORE ignore IDRETRY update_webview
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::feat;
|
||||
use crate::utils::dirs;
|
||||
use crate::{
|
||||
cmd::StringifyErr as _,
|
||||
config::{ClashInfo, Config, mihomo_yaml, profiles::profiles_save_file_safe},
|
||||
config::{ClashInfo, Config, mihomo_yaml, profiles::save_committed_profiles},
|
||||
constants,
|
||||
core::{
|
||||
CoreManager, handle,
|
||||
@@ -59,7 +59,7 @@ pub async fn change_clash_core(clash_core: std::string::String) -> CmdResult<Opt
|
||||
|
||||
match CoreManager::global().change_core(&clash_core).await {
|
||||
Ok(_) => {
|
||||
logging_error!(Type::Core, profiles_save_file_safe().await);
|
||||
logging_error!(Type::Core, save_committed_profiles().await);
|
||||
|
||||
match CoreManager::global().restart_core().await {
|
||||
Ok(_) => {
|
||||
@@ -88,7 +88,7 @@ pub async fn change_clash_core(clash_core: std::string::String) -> CmdResult<Opt
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn restart_core() -> CmdResult {
|
||||
logging_error!(Type::Core, profiles_save_file_safe().await);
|
||||
logging_error!(Type::Core, save_committed_profiles().await);
|
||||
let result = CoreManager::global()
|
||||
.restart_core()
|
||||
.await
|
||||
|
||||
@@ -7,9 +7,8 @@ use crate::{
|
||||
config::{
|
||||
Config, IProfiles, PrfItem, PrfOption, build_remote_profile,
|
||||
profiles::{
|
||||
PROFILE_WRITE_LOCK, cleanup_profile_files, profiles_append_item_safe,
|
||||
profiles_append_item_with_filedata_safe, profiles_patch_item_safe, profiles_reorder_safe,
|
||||
profiles_save_file_safe, save_profiles,
|
||||
PROFILE_WRITE_LOCK, append_profile, cleanup_profile_files, patch_profile_item, reorder_profiles,
|
||||
save_committed_profiles, save_profiles,
|
||||
},
|
||||
read_profile_item_file,
|
||||
},
|
||||
@@ -46,7 +45,7 @@ pub async fn get_profiles() -> CmdResult<SharedDraft<IProfiles>> {
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn enhance_profiles() -> CmdResult<ValidationOutcome> {
|
||||
match feat::enhance_profiles().await {
|
||||
match CoreManager::global().update_config_forced().await {
|
||||
Ok(outcome) if outcome.is_valid() => {
|
||||
handle::Handle::refresh_clash();
|
||||
Ok(outcome)
|
||||
@@ -80,12 +79,12 @@ pub async fn import_profile(url: std::string::String, option: Option<PrfOption>)
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(e) = profiles_append_item_safe(item).await {
|
||||
if let Err(e) = append_profile(item).await {
|
||||
logging!(error, Type::Cmd, "[导入订阅] 保存配置失败: {e:#}");
|
||||
return Err(coded_error("PROFILE_IMPORT_FAILED", e));
|
||||
}
|
||||
|
||||
if let Err(e) = profiles_save_file_safe().await {
|
||||
if let Err(e) = save_committed_profiles().await {
|
||||
logging!(error, Type::Cmd, "[导入订阅] 保存配置文件失败: {e:#}");
|
||||
return Err(coded_error("PROFILE_IMPORT_FAILED", e));
|
||||
}
|
||||
@@ -104,7 +103,7 @@ pub async fn import_profile(url: std::string::String, option: Option<PrfOption>)
|
||||
pub async fn reorder_profile(active_id: std::string::String, over_id: std::string::String) -> CmdResult {
|
||||
let active_id: String = active_id.into();
|
||||
let over_id: String = over_id.into();
|
||||
match profiles_reorder_safe(&active_id, &over_id).await {
|
||||
match reorder_profiles(&active_id, &over_id).await {
|
||||
Ok(_) => {
|
||||
logging!(info, Type::Cmd, "重新排序配置文件: {} -> {}", active_id, over_id);
|
||||
Ok(())
|
||||
@@ -127,9 +126,9 @@ pub async fn reorder_profile(active_id: std::string::String, over_id: std::strin
|
||||
pub async fn create_profile(item: ProfileCreate, file_data: Option<std::string::String>) -> CmdResult {
|
||||
let item: PrfItem = item.into();
|
||||
let file_data = file_data.map(String::from);
|
||||
match profiles_append_item_with_filedata_safe(&item, file_data).await {
|
||||
match profiles::create_profile(&item, file_data).await {
|
||||
Ok(_) => {
|
||||
profiles_save_file_safe()
|
||||
save_committed_profiles()
|
||||
.await
|
||||
.with_error_code("PROFILE_CREATE_FAILED")?;
|
||||
logging_error!(Type::Timer, Timer::global().refresh().await);
|
||||
@@ -219,7 +218,7 @@ async fn restore_previous_profile(prev_profile: &String) -> CmdResult<()> {
|
||||
.edit_draft(|d| d.patch_current(Some(prev_profile)));
|
||||
Config::profiles().await.apply();
|
||||
crate::process::AsyncHandler::spawn(|| async move {
|
||||
if let Err(e) = profiles_save_file_safe().await {
|
||||
if let Err(e) = save_committed_profiles().await {
|
||||
logging!(warn, Type::Cmd, "异步保存恢复配置文件失败: {e:#}");
|
||||
}
|
||||
});
|
||||
@@ -247,7 +246,7 @@ async fn handle_success(current_value: Option<&String>) -> CmdResult<ValidationO
|
||||
// Runtime refresh and tray rebuilding happen after saved node selections are restored.
|
||||
profiles::activate_selected_nodes();
|
||||
|
||||
if let Err(e) = profiles_save_file_safe().await {
|
||||
if let Err(e) = save_committed_profiles().await {
|
||||
logging!(warn, Type::Cmd, "异步保存配置文件失败: {e:#}");
|
||||
}
|
||||
|
||||
@@ -433,7 +432,7 @@ pub async fn patch_profile(index: std::string::String, profile: ProfilePatch) ->
|
||||
// Prevent an in-flight restore from overwriting a newer UI or chain selection.
|
||||
let records_a_selection = profile.selected.is_some();
|
||||
|
||||
profiles_patch_item_safe(&index, &profile)
|
||||
patch_profile_item(&index, &profile)
|
||||
.await
|
||||
.with_error_code("PROFILE_UPDATE_FAILED")?;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::core::notify::NoticeStatus;
|
||||
use crate::{
|
||||
config::{
|
||||
prfitem::{build_merge_profile, build_script_profile},
|
||||
profiles::{load_profiles, profiles_append_item_to_safe, save_profiles},
|
||||
profiles::{append_to_profile_index, load_profiles, save_profiles},
|
||||
runtime::IRuntime,
|
||||
},
|
||||
constants::{files, timing},
|
||||
@@ -142,11 +142,11 @@ impl Config {
|
||||
|
||||
if profiles.latest_arc().get_item("Merge").is_err() {
|
||||
let merge_item = &mut build_merge_profile(Some("Merge".into()));
|
||||
profiles_append_item_to_safe(&profiles, merge_item).await?;
|
||||
append_to_profile_index(&profiles, merge_item).await?;
|
||||
}
|
||||
if profiles.latest_arc().get_item("Script").is_err() {
|
||||
let script_item = &mut build_script_profile(Some("Script".into()));
|
||||
profiles_append_item_to_safe(&profiles, script_item).await?;
|
||||
append_to_profile_index(&profiles, script_item).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ mod verge;
|
||||
|
||||
pub(crate) use self::config::Config;
|
||||
pub(crate) use self::prfitem::{
|
||||
build_remote_profile, download_subscription, prepare_remote_refresh, read_profile_item_file,
|
||||
build_remote_profile, download_subscription, prepare_remote_refresh, read_profile_item_file, subscription_proxy,
|
||||
};
|
||||
pub use self::{clash::*, encrypt::*, mixed_port::*, profiles::*, verge::*};
|
||||
pub use clash_verge_profile::{PrfExtra, PrfItem, PrfOption, PrfSelected};
|
||||
|
||||
@@ -45,35 +45,38 @@ pub(super) async fn build_profile(item: &PrfItem, file_data: Option<String>) ->
|
||||
}
|
||||
|
||||
async fn append_companion_item(item: &mut PrfItem) -> Result<String> {
|
||||
profiles::profiles_append_item_safe(item).await?;
|
||||
profiles::append_profile(item).await?;
|
||||
item.uid
|
||||
.clone()
|
||||
.ok_or_else(|| anyhow::anyhow!("appended companion item has no uid"))
|
||||
}
|
||||
|
||||
async fn ensure_companion_items(
|
||||
merge: &mut Option<String>,
|
||||
script: &mut Option<String>,
|
||||
rules: &mut Option<String>,
|
||||
proxies: &mut Option<String>,
|
||||
groups: &mut Option<String>,
|
||||
) -> Result<()> {
|
||||
if merge.is_none() {
|
||||
*merge = Some(append_companion_item(&mut build_merge_profile(None)).await?);
|
||||
async fn prepare_profile_options(source: Option<&PrfOption>) -> Result<PrfOption> {
|
||||
let mut options = PrfOption {
|
||||
update_interval: source.and_then(|options| options.update_interval),
|
||||
merge: source.and_then(|options| options.merge.clone()),
|
||||
script: source.and_then(|options| options.script.clone()),
|
||||
rules: source.and_then(|options| options.rules.clone()),
|
||||
proxies: source.and_then(|options| options.proxies.clone()),
|
||||
groups: source.and_then(|options| options.groups.clone()),
|
||||
..PrfOption::default()
|
||||
};
|
||||
if options.merge.is_none() {
|
||||
options.merge = Some(append_companion_item(&mut build_merge_profile(None)).await?);
|
||||
}
|
||||
if script.is_none() {
|
||||
*script = Some(append_companion_item(&mut build_script_profile(None)).await?);
|
||||
if options.script.is_none() {
|
||||
options.script = Some(append_companion_item(&mut build_script_profile(None)).await?);
|
||||
}
|
||||
if rules.is_none() {
|
||||
*rules = Some(append_companion_item(&mut from_rules()).await?);
|
||||
if options.rules.is_none() {
|
||||
options.rules = Some(append_companion_item(&mut from_rules()).await?);
|
||||
}
|
||||
if proxies.is_none() {
|
||||
*proxies = Some(append_companion_item(&mut from_proxies()).await?);
|
||||
if options.proxies.is_none() {
|
||||
options.proxies = Some(append_companion_item(&mut from_proxies()).await?);
|
||||
}
|
||||
if groups.is_none() {
|
||||
*groups = Some(append_companion_item(&mut from_groups()).await?);
|
||||
if options.groups.is_none() {
|
||||
options.groups = Some(append_companion_item(&mut from_groups()).await?);
|
||||
}
|
||||
Ok(())
|
||||
Ok(options)
|
||||
}
|
||||
|
||||
async fn from_local(
|
||||
@@ -84,15 +87,7 @@ async fn from_local(
|
||||
) -> Result<PrfItem> {
|
||||
let uid = help::get_uid("L").into();
|
||||
let file = format!("{uid}.yaml").into();
|
||||
let opt_ref = option.as_ref();
|
||||
let update_interval = opt_ref.and_then(|o| o.update_interval);
|
||||
let mut merge = opt_ref.and_then(|o| o.merge.clone());
|
||||
let mut script = opt_ref.and_then(|o| o.script.clone());
|
||||
let mut rules = opt_ref.and_then(|o| o.rules.clone());
|
||||
let mut proxies = opt_ref.and_then(|o| o.proxies.clone());
|
||||
let mut groups = opt_ref.and_then(|o| o.groups.clone());
|
||||
|
||||
ensure_companion_items(&mut merge, &mut script, &mut rules, &mut proxies, &mut groups).await?;
|
||||
let options = prepare_profile_options(option).await?;
|
||||
Ok(PrfItem {
|
||||
uid: Some(uid),
|
||||
itype: Some("local".into()),
|
||||
@@ -102,15 +97,7 @@ async fn from_local(
|
||||
url: None,
|
||||
selected: None,
|
||||
extra: None,
|
||||
option: Some(PrfOption {
|
||||
update_interval,
|
||||
merge,
|
||||
script,
|
||||
rules,
|
||||
proxies,
|
||||
groups,
|
||||
..PrfOption::default()
|
||||
}),
|
||||
option: Some(options),
|
||||
home: None,
|
||||
updated: Some(chrono::Local::now().timestamp() as usize),
|
||||
file_data: Some(file_data.unwrap_or_else(|| tmpl::ITEM_LOCAL.into())),
|
||||
@@ -140,7 +127,7 @@ pub(crate) async fn build_remote_profile(
|
||||
desc: Option<&String>,
|
||||
option: Option<&PrfOption>,
|
||||
) -> Result<PrfItem> {
|
||||
let mut downloaded = download_subscription(url, option).await?;
|
||||
let mut downloaded = download_subscription(url, option, subscription_proxy(option)).await?;
|
||||
let uid: String = help::get_uid("R").into();
|
||||
let file = format!("{uid}.yaml").into();
|
||||
let name = name
|
||||
@@ -172,31 +159,28 @@ pub(crate) async fn build_remote_profile(
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) async fn download_subscription(url: &str, option: Option<&PrfOption>) -> Result<DownloadedSubscription> {
|
||||
let with_proxy = option.is_some_and(|o| o.with_proxy.unwrap_or(false));
|
||||
let self_proxy = option.is_some_and(|o| o.self_proxy.unwrap_or(false));
|
||||
let accept_invalid_certs = option.is_some_and(|o| o.danger_accept_invalid_certs.unwrap_or(false));
|
||||
let user_agent = option.and_then(|o| o.user_agent.clone());
|
||||
let timeout = option.and_then(|o| o.timeout_seconds).unwrap_or(20);
|
||||
|
||||
let proxy_type = if self_proxy {
|
||||
pub(crate) fn subscription_proxy(options: Option<&PrfOption>) -> ProxyType {
|
||||
if options.and_then(|options| options.self_proxy) == Some(true) {
|
||||
ProxyType::Localhost
|
||||
} else if with_proxy {
|
||||
} else if options.and_then(|options| options.with_proxy) == Some(true) {
|
||||
ProxyType::System
|
||||
} else {
|
||||
ProxyType::None
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn download_subscription(
|
||||
url: &str,
|
||||
option: Option<&PrfOption>,
|
||||
proxy: ProxyType,
|
||||
) -> Result<DownloadedSubscription> {
|
||||
let accept_invalid_certs = option.is_some_and(|o| o.danger_accept_invalid_certs.unwrap_or(false));
|
||||
let user_agent = option.and_then(|o| o.user_agent.clone());
|
||||
let timeout = option.and_then(|o| o.timeout_seconds).unwrap_or(20);
|
||||
let url = fix_dirty_url(url)?;
|
||||
|
||||
let resp = match NetworkManager::new()
|
||||
.get(
|
||||
url.as_str(),
|
||||
proxy_type,
|
||||
Some(timeout),
|
||||
user_agent,
|
||||
accept_invalid_certs,
|
||||
)
|
||||
.get(url.as_str(), proxy, Some(timeout), user_agent, accept_invalid_certs)
|
||||
.await
|
||||
{
|
||||
Ok(r) => r,
|
||||
@@ -232,31 +216,14 @@ pub(crate) async fn prepare_remote_refresh(
|
||||
downloaded: DownloadedSubscription,
|
||||
option: Option<&PrfOption>,
|
||||
) -> Result<RemoteProfileRefresh> {
|
||||
let mut resolved = PrfOption {
|
||||
update_interval: option
|
||||
.and_then(|o| o.update_interval)
|
||||
.or(downloaded.update_interval_minutes),
|
||||
merge: option.and_then(|o| o.merge.clone()),
|
||||
script: option.and_then(|o| o.script.clone()),
|
||||
rules: option.and_then(|o| o.rules.clone()),
|
||||
proxies: option.and_then(|o| o.proxies.clone()),
|
||||
groups: option.and_then(|o| o.groups.clone()),
|
||||
allow_auto_update: Some(allow_auto_update_enabled(option)),
|
||||
..PrfOption::default()
|
||||
};
|
||||
ensure_companion_items(
|
||||
&mut resolved.merge,
|
||||
&mut resolved.script,
|
||||
&mut resolved.rules,
|
||||
&mut resolved.proxies,
|
||||
&mut resolved.groups,
|
||||
)
|
||||
.await?;
|
||||
let mut options = prepare_profile_options(option).await?;
|
||||
options.update_interval = options.update_interval.or(downloaded.update_interval_minutes);
|
||||
options.allow_auto_update = Some(option.and_then(|options| options.allow_auto_update).unwrap_or(true));
|
||||
Ok(RemoteProfileRefresh {
|
||||
extra: downloaded.extra,
|
||||
home: downloaded.home,
|
||||
updated: chrono::Local::now().timestamp() as usize,
|
||||
option: resolved,
|
||||
option: options,
|
||||
body: downloaded.body,
|
||||
})
|
||||
}
|
||||
@@ -331,10 +298,6 @@ pub(crate) async fn read_profile_item_file(file: Option<&str>) -> Result<String>
|
||||
Ok(content.into())
|
||||
}
|
||||
|
||||
fn allow_auto_update_enabled(option: Option<&PrfOption>) -> bool {
|
||||
option.and_then(|o| o.allow_auto_update).unwrap_or(true)
|
||||
}
|
||||
|
||||
/// Fix URLs where query parameters are incorrectly appended to the path segment
|
||||
///
|
||||
/// Incorrect Example: https://example.com/path¶m1=value1
|
||||
@@ -416,7 +379,7 @@ mod tests {
|
||||
update_interval: None,
|
||||
..option
|
||||
};
|
||||
let downloaded = download_subscription(&url, Some(&refresh_option)).await?;
|
||||
let downloaded = download_subscription(&url, Some(&refresh_option), ProxyType::None).await?;
|
||||
let refresh = prepare_remote_refresh(downloaded, Some(&refresh_option)).await?;
|
||||
server.await??;
|
||||
assert_eq!(item.itype.as_deref(), Some("remote"));
|
||||
|
||||
@@ -193,32 +193,6 @@ fn validate_profile_file(file: &str) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Updates fields returned by a remote profile refresh.
|
||||
async fn apply_remote_refresh(profiles: &mut IProfiles, uid: &str, refresh: RemoteProfileRefresh) -> Result<()> {
|
||||
let _ = profiles.get_item(uid)?;
|
||||
|
||||
if let Some(each) = profiles
|
||||
.items
|
||||
.iter_mut()
|
||||
.flatten()
|
||||
.find(|item| item.uid.as_deref() == Some(uid))
|
||||
{
|
||||
each.extra = refresh.extra;
|
||||
each.updated = Some(refresh.updated);
|
||||
each.home = refresh.home;
|
||||
each.option = PrfOption::merge(each.option.as_ref(), Some(&refresh.option));
|
||||
let file = each
|
||||
.file
|
||||
.get_or_insert_with(|| format!("{}.yaml", help::get_uid("R")).into());
|
||||
let path = dirs::app_profiles_dir()?.join(file.as_str());
|
||||
fs::write(&path, refresh.body.as_bytes())
|
||||
.await
|
||||
.with_context(|| format!("failed to write to file \"{file}\""))?;
|
||||
}
|
||||
|
||||
save_profiles(profiles).await
|
||||
}
|
||||
|
||||
/// Raise intervals below `min_minutes`. `None`/`0` mean "never auto-update", left alone.
|
||||
/// Returns how many changed so the caller can skip a pointless write.
|
||||
pub(crate) fn raise_short_update_intervals(profiles: &mut IProfiles, min_minutes: u64) -> usize {
|
||||
@@ -259,9 +233,9 @@ pub(crate) async fn current_mapping(profiles: &IProfiles) -> Result<Mapping> {
|
||||
// These helpers serialize asynchronous operations against committed profile data.
|
||||
use crate::config::Config;
|
||||
|
||||
pub(crate) async fn profiles_append_item_with_filedata_safe(item: &PrfItem, file_data: Option<String>) -> Result<()> {
|
||||
pub(crate) async fn create_profile(item: &PrfItem, file_data: Option<String>) -> Result<()> {
|
||||
let item = &mut build_profile(item, file_data).await?;
|
||||
profiles_append_item_safe(item).await
|
||||
append_profile(item).await
|
||||
}
|
||||
|
||||
/// Applies `edit` to the committed profiles; commits only when the edit succeeds.
|
||||
@@ -279,12 +253,12 @@ where
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn profiles_append_item_safe(item: &mut PrfItem) -> Result<()> {
|
||||
pub(crate) async fn append_profile(item: &mut PrfItem) -> Result<()> {
|
||||
let profiles = Config::profiles().await;
|
||||
profiles_append_item_to_safe(&profiles, item).await
|
||||
append_to_profile_index(&profiles, item).await
|
||||
}
|
||||
|
||||
pub(super) async fn profiles_append_item_to_safe(profiles: &Draft<IProfiles>, item: &mut PrfItem) -> Result<()> {
|
||||
pub(super) async fn append_to_profile_index(profiles: &Draft<IProfiles>, item: &mut PrfItem) -> Result<()> {
|
||||
profiles
|
||||
.with_data_modify(|mut profiles| async move {
|
||||
append_item(&mut profiles, item).await?;
|
||||
@@ -293,7 +267,7 @@ pub(super) async fn profiles_append_item_to_safe(profiles: &Draft<IProfiles>, it
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn profiles_patch_item_safe(index: &str, item: &PrfItem) -> Result<()> {
|
||||
pub(crate) async fn patch_profile_item(index: &str, item: &PrfItem) -> Result<()> {
|
||||
with_profiles_edit(|mut profiles| async move {
|
||||
patch_item(&mut profiles, index, item).await?;
|
||||
Ok(profiles)
|
||||
@@ -301,7 +275,7 @@ pub(crate) async fn profiles_patch_item_safe(index: &str, item: &PrfItem) -> Res
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn profiles_reorder_safe(active_id: &str, over_id: &str) -> Result<()> {
|
||||
pub(crate) async fn reorder_profiles(active_id: &str, over_id: &str) -> Result<()> {
|
||||
with_profiles_edit(|mut profiles| async move {
|
||||
if profiles.reorder(active_id, over_id) {
|
||||
save_profiles(&profiles).await?;
|
||||
@@ -311,18 +285,29 @@ pub(crate) async fn profiles_reorder_safe(active_id: &str, over_id: &str) -> Res
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn profiles_save_file_safe() -> Result<()> {
|
||||
pub(crate) async fn save_committed_profiles() -> Result<()> {
|
||||
with_profiles_edit(|profiles| async move { save_profiles(&profiles).await.map(|_| profiles) }).await
|
||||
}
|
||||
|
||||
pub(crate) async fn apply_remote_refresh_safe(index: &str, url: &str, refresh: RemoteProfileRefresh) -> Result<()> {
|
||||
pub(crate) async fn save_remote_refresh(uid: &str, url: &str, refresh: RemoteProfileRefresh) -> Result<()> {
|
||||
with_profiles_edit(|mut profiles| async move {
|
||||
let current = profiles.get_item(index)?;
|
||||
let profile = profiles.get_item_mut(uid)?;
|
||||
anyhow::ensure!(
|
||||
current.itype.as_deref() == Some("remote") && current.url.as_deref() == Some(url),
|
||||
profile.itype.as_deref() == Some("remote") && profile.url.as_deref() == Some(url),
|
||||
"profile source changed during refresh"
|
||||
);
|
||||
apply_remote_refresh(&mut profiles, index, refresh).await?;
|
||||
profile.extra = refresh.extra;
|
||||
profile.updated = Some(refresh.updated);
|
||||
profile.home = refresh.home;
|
||||
profile.option = PrfOption::merge(profile.option.as_ref(), Some(&refresh.option));
|
||||
let file = profile
|
||||
.file
|
||||
.get_or_insert_with(|| format!("{}.yaml", help::get_uid("R")).into());
|
||||
let path = dirs::app_profiles_dir()?.join(file.as_str());
|
||||
fs::write(&path, refresh.body.as_bytes())
|
||||
.await
|
||||
.with_context(|| format!("failed to write to file \"{file}\""))?;
|
||||
save_profiles(&profiles).await?;
|
||||
Ok(profiles)
|
||||
})
|
||||
.await
|
||||
|
||||
@@ -3,7 +3,11 @@ use crate::process::AsyncHandler;
|
||||
use crate::singleton;
|
||||
use crate::utils::notification::{NotificationEvent, notify_event};
|
||||
use crate::utils::window_manager::WindowManager;
|
||||
use crate::{config::Config, core::handle, core::lightweight::entry_lightweight_mode, feat};
|
||||
use crate::{
|
||||
config::Config,
|
||||
core::{CoreManager, handle, lightweight::entry_lightweight_mode},
|
||||
feat,
|
||||
};
|
||||
use anyhow::{Result, bail};
|
||||
use arc_swap::ArcSwap;
|
||||
use clash_verge_logging::{Type, logging};
|
||||
@@ -165,7 +169,7 @@ impl Hotkey {
|
||||
});
|
||||
}
|
||||
HotkeyFunction::ReactivateProfiles => {
|
||||
AsyncHandler::spawn(async move || match feat::enhance_profiles().await {
|
||||
AsyncHandler::spawn(async move || match CoreManager::global().update_config_forced().await {
|
||||
Ok(outcome) if outcome.is_valid() => {
|
||||
handle::Handle::refresh_clash();
|
||||
notify_event(NotificationEvent::ProfilesReactivated).await;
|
||||
|
||||
@@ -296,19 +296,16 @@ impl Tray {
|
||||
|
||||
let (_is_custom_icon, icon_bytes) = TrayState::get_tray_icon(verge).await;
|
||||
|
||||
let template = {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
verge.tray_icon.as_ref().is_none_or(|v| v == "monochrome")
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
false
|
||||
}
|
||||
};
|
||||
let icon = Some(tauri::image::Image::from_bytes(&icon_bytes)?);
|
||||
|
||||
logging_error!(Type::Tray, tray.set_icon_with_as_template(icon, template));
|
||||
#[cfg(target_os = "macos")]
|
||||
let result = if verge.tray_icon.as_ref().is_none_or(|v| v == "monochrome") {
|
||||
tray.set_icon_templated(icon)
|
||||
} else {
|
||||
tray.set_icon(icon)
|
||||
};
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let result = tray.set_icon(icon);
|
||||
logging_error!(Type::Tray, result);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -404,26 +401,21 @@ impl Tray {
|
||||
let icon_bytes = TrayState::get_tray_icon(&verge).await.1;
|
||||
let icon = tauri::image::Image::from_bytes(&icon_bytes)?;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
let builder = TrayIconBuilder::with_id(TRAY_ID).icon(icon).icon_as_template(false);
|
||||
let builder = TrayIconBuilder::with_id(TRAY_ID);
|
||||
#[cfg(target_os = "macos")]
|
||||
let builder = if verge.tray_icon.as_ref().is_none_or(|v| v == "monochrome") {
|
||||
builder.icon_templated(icon)
|
||||
} else {
|
||||
builder.icon(icon)
|
||||
};
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
let builder = builder.icon(icon);
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
let show_menu_on_left_click = verge.tray_event.as_ref().is_some_and(|v| v == "tray_menu");
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let mut builder = TrayIconBuilder::with_id(TRAY_ID).icon(icon).icon_as_template(false);
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let is_monochrome = verge.tray_icon.as_ref().is_none_or(|v| v == "monochrome");
|
||||
builder = builder.icon_as_template(is_monochrome);
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
{
|
||||
if !show_menu_on_left_click {
|
||||
builder = builder.show_menu_on_left_click(false);
|
||||
}
|
||||
}
|
||||
let builder = builder.show_menu_on_left_click(show_menu_on_left_click);
|
||||
|
||||
let tray = builder.build(app_handle)?;
|
||||
tray.on_tray_icon_event(on_tray_icon_event);
|
||||
@@ -870,9 +862,14 @@ fn on_tray_icon_event(_tray_icon: &TrayIcon, tray_event: TrayIconEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
const CLICK_STATE: MouseButtonState = if cfg!(target_os = "linux") {
|
||||
MouseButtonState::Up
|
||||
} else {
|
||||
MouseButtonState::Down
|
||||
};
|
||||
if let TrayIconEvent::Click {
|
||||
button: MouseButton::Left,
|
||||
button_state: MouseButtonState::Down,
|
||||
button_state: CLICK_STATE,
|
||||
..
|
||||
} = tray_event
|
||||
{
|
||||
@@ -882,9 +879,13 @@ fn on_tray_icon_event(_tray_icon: &TrayIcon, tray_event: TrayIconEvent) {
|
||||
}
|
||||
|
||||
AsyncHandler::spawn(|| async move {
|
||||
let verge = Config::verge().await.data_arc();
|
||||
let verge_tray_event = verge.tray_event.clone().unwrap_or_else(|| "main_window".into());
|
||||
let verge_tray_action = TrayAction::from(verge_tray_event.as_str());
|
||||
let configured_event = if cfg!(target_os = "linux") {
|
||||
None
|
||||
} else {
|
||||
Config::verge().await.data_arc().tray_event.clone()
|
||||
};
|
||||
let verge_tray_event = configured_event.as_deref().unwrap_or("main_window");
|
||||
let verge_tray_action = TrayAction::from(verge_tray_event);
|
||||
logging!(debug, Type::Tray, "tray event: {verge_tray_action:?}");
|
||||
match verge_tray_action {
|
||||
TrayAction::SystemProxy => {
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::{
|
||||
sync::LazyLock,
|
||||
sync::atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
use tauri::Manager as _;
|
||||
use tauri_plugin_shell::ShellExt as _;
|
||||
use tokio::fs;
|
||||
use tristr::alias::String;
|
||||
@@ -27,9 +28,10 @@ async fn validation_fingerprint(yaml: &str) -> u64 {
|
||||
let mut hasher = DefaultHasher::new();
|
||||
yaml.hash(&mut hasher);
|
||||
core.as_str().hash(&mut hasher);
|
||||
let binary = std::env::current_exe()
|
||||
.into_iter()
|
||||
.map(|exe| exe.with_file_name(format!("{}{}", core.as_str(), std::env::consts::EXE_SUFFIX)));
|
||||
let binary = handle::Handle::app_handle()
|
||||
.path()
|
||||
.resolve_external_bin(core.as_str())
|
||||
.into_iter();
|
||||
// The test run reads geo databases from the app dir; a geo update must revalidate.
|
||||
let geo = dirs::app_home_dir().into_iter().flat_map(|dir| {
|
||||
clash_verge_runtime_bundle::GEO_ASSETS
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::core::notify::{Refresh, announce};
|
||||
use crate::{
|
||||
cmd,
|
||||
config::Config,
|
||||
core::{CoreManager, handle, tray, validate::ValidationOutcome},
|
||||
core::{handle, tray},
|
||||
process::AsyncHandler,
|
||||
};
|
||||
use anyhow::Result;
|
||||
@@ -199,11 +199,6 @@ async fn finish_proxy_switch(stale_proxies: Vec<std::string::String>) {
|
||||
}
|
||||
}
|
||||
|
||||
/// 增强配置
|
||||
pub async fn enhance_profiles() -> Result<ValidationOutcome> {
|
||||
CoreManager::global().update_config_forced().await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
use crate::{
|
||||
config::{Config, PrfOption, download_subscription, prepare_remote_refresh, profiles::apply_remote_refresh_safe},
|
||||
config::{
|
||||
Config, PrfOption, download_subscription, prepare_remote_refresh, profiles::save_remote_refresh,
|
||||
subscription_proxy,
|
||||
},
|
||||
core::{
|
||||
CoreManager, handle,
|
||||
notify::{NoticeStatus, Refresh, announce},
|
||||
validate::ValidationOutcome,
|
||||
},
|
||||
utils::help::{mask_err, mask_url},
|
||||
utils::{
|
||||
help::{mask_err, mask_url},
|
||||
network::ProxyType,
|
||||
},
|
||||
};
|
||||
use anyhow::{Result, bail};
|
||||
use clash_verge_logging::{Type, logging};
|
||||
@@ -48,11 +54,13 @@ async fn should_update_profile(uid: &str, ignore_auto_update: bool) -> Result<Op
|
||||
async fn perform_profile_update(
|
||||
uid: &str,
|
||||
url: &str,
|
||||
opt: Option<&PrfOption>,
|
||||
option: Option<&PrfOption>,
|
||||
profile_options: Option<&PrfOption>,
|
||||
overrides: Option<&PrfOption>,
|
||||
is_manual_trigger: bool,
|
||||
) -> Result<()> {
|
||||
let merged_opt = PrfOption::merge(opt, option);
|
||||
let options = PrfOption::merge(profile_options, overrides);
|
||||
let options = options.as_ref();
|
||||
let configured_proxy = subscription_proxy(options);
|
||||
let profiles = Config::profiles().await;
|
||||
let profiles_arc = profiles.latest_arc();
|
||||
let profile_name = profiles_arc
|
||||
@@ -71,54 +79,44 @@ async fn perform_profile_update(
|
||||
let result = clash_verge_task::retry::try_strategies(
|
||||
Strategy::Configured,
|
||||
[Strategy::Clash, Strategy::System],
|
||||
|strategy| {
|
||||
let mut options = merged_opt.clone();
|
||||
async move {
|
||||
let (name, success, failure) = match strategy {
|
||||
Strategy::Configured => (
|
||||
"configured",
|
||||
"[订阅更新] 更新订阅配置成功",
|
||||
"[订阅更新] 直接更新失败: {},尝试使用Clash代理更新",
|
||||
),
|
||||
Strategy::Clash => (
|
||||
"clash",
|
||||
"[订阅更新] 使用 Clash代理 更新订阅配置成功",
|
||||
"[订阅更新] Clash代理更新失败: {},尝试使用系统代理更新",
|
||||
),
|
||||
Strategy::System => (
|
||||
"system",
|
||||
"[订阅更新] 使用 系统代理 更新订阅配置成功",
|
||||
"[订阅更新] 系统代理更新失败: {},所有重试均已失败",
|
||||
),
|
||||
};
|
||||
match strategy {
|
||||
Strategy::Configured => {}
|
||||
Strategy::Clash | Strategy::System => {
|
||||
let option = options.get_or_insert_with(PrfOption::default);
|
||||
option.self_proxy = Some(matches!(strategy, Strategy::Clash));
|
||||
option.with_proxy = Some(matches!(strategy, Strategy::System));
|
||||
}
|
||||
}
|
||||
tracing::Span::current().record("strategy", name);
|
||||
let started = std::time::Instant::now();
|
||||
let result = download_subscription(url, options.as_ref()).await;
|
||||
let elapsed_field = match strategy {
|
||||
Strategy::Configured => "configured_elapsed",
|
||||
Strategy::Clash => "clash_elapsed",
|
||||
Strategy::System => "system_elapsed",
|
||||
};
|
||||
tracing::Span::current().record(elapsed_field, tracing::field::debug(started.elapsed()));
|
||||
match &result {
|
||||
Ok(_) => logging!(info, Type::Config, "{success}"),
|
||||
Err(error) => logging!(
|
||||
warn,
|
||||
Type::Config,
|
||||
"{}",
|
||||
failure.replace("{}", &mask_err(&format!("{error:#}")))
|
||||
),
|
||||
}
|
||||
result
|
||||
|strategy| async move {
|
||||
let (name, proxy, elapsed_field, success, failure) = match strategy {
|
||||
Strategy::Configured => (
|
||||
"configured",
|
||||
configured_proxy,
|
||||
"configured_elapsed",
|
||||
"[订阅更新] 更新订阅配置成功",
|
||||
"[订阅更新] 直接更新失败: {},尝试使用Clash代理更新",
|
||||
),
|
||||
Strategy::Clash => (
|
||||
"clash",
|
||||
ProxyType::Localhost,
|
||||
"clash_elapsed",
|
||||
"[订阅更新] 使用 Clash代理 更新订阅配置成功",
|
||||
"[订阅更新] Clash代理更新失败: {},尝试使用系统代理更新",
|
||||
),
|
||||
Strategy::System => (
|
||||
"system",
|
||||
ProxyType::System,
|
||||
"system_elapsed",
|
||||
"[订阅更新] 使用 系统代理 更新订阅配置成功",
|
||||
"[订阅更新] 系统代理更新失败: {},所有重试均已失败",
|
||||
),
|
||||
};
|
||||
tracing::Span::current().record("strategy", name);
|
||||
let started = std::time::Instant::now();
|
||||
let result = download_subscription(url, options, proxy).await;
|
||||
tracing::Span::current().record(elapsed_field, tracing::field::debug(started.elapsed()));
|
||||
match &result {
|
||||
Ok(_) => logging!(info, Type::Config, "{success}"),
|
||||
Err(error) => logging!(
|
||||
warn,
|
||||
Type::Config,
|
||||
"{}",
|
||||
failure.replace("{}", &mask_err(&format!("{error:#}")))
|
||||
),
|
||||
}
|
||||
result
|
||||
},
|
||||
)
|
||||
.await;
|
||||
@@ -132,8 +130,8 @@ async fn perform_profile_update(
|
||||
current.itype.as_deref() == Some("remote") && current.url.as_deref() == Some(url),
|
||||
"profile source changed during refresh"
|
||||
);
|
||||
let refresh = prepare_remote_refresh(downloaded, merged_opt.as_ref()).await?;
|
||||
apply_remote_refresh_safe(uid, url, refresh).await?;
|
||||
let refresh = prepare_remote_refresh(downloaded, options).await?;
|
||||
save_remote_refresh(uid, url, refresh).await?;
|
||||
if !matches!(strategy, Strategy::Configured) {
|
||||
handle::Handle::notice(NoticeStatus::UpdateWithClashProxy, profile_name.as_str());
|
||||
}
|
||||
@@ -154,11 +152,11 @@ async fn perform_profile_update(
|
||||
|
||||
#[tracing::instrument(skip_all, level = "info", fields(uid = %uid, manual = is_manual_trigger))]
|
||||
pub async fn update_profile(uid: &str, option: Option<&PrfOption>, is_manual_trigger: bool) -> Result<()> {
|
||||
let url_opt = should_update_profile(uid, is_manual_trigger).await?;
|
||||
let subscription = should_update_profile(uid, is_manual_trigger).await?;
|
||||
|
||||
let profile_persisted = match url_opt {
|
||||
Some((url, opt)) => {
|
||||
perform_profile_update(uid, &url, opt.as_ref(), option, is_manual_trigger).await?;
|
||||
let profile_persisted = match subscription {
|
||||
Some((url, profile_options)) => {
|
||||
perform_profile_update(uid, &url, profile_options.as_ref(), option, is_manual_trigger).await?;
|
||||
true
|
||||
}
|
||||
None => false,
|
||||
|
||||
@@ -51,14 +51,14 @@ async fn import_subscription(url: &str, name: Option<&String>) {
|
||||
};
|
||||
|
||||
let uid = item.uid.clone().unwrap_or_default();
|
||||
if let Err(e) = profiles::profiles_append_item_safe(&mut item).await {
|
||||
if let Err(e) = profiles::append_profile(&mut item).await {
|
||||
logging!(error, Type::Config, "failed to import subscription url: {:?}", e);
|
||||
Config::profiles().await.discard();
|
||||
handle::Handle::notice(NoticeStatus::ImportSubUrlError, e.to_string());
|
||||
return;
|
||||
}
|
||||
|
||||
if let Err(e) = profiles::profiles_save_file_safe().await {
|
||||
if let Err(e) = profiles::save_committed_profiles().await {
|
||||
logging!(error, Type::Config, "failed to save imported subscription: {e:#}");
|
||||
handle::Handle::notice(NoticeStatus::ImportSubUrlError, e.to_string());
|
||||
return;
|
||||
|
||||
@@ -30,6 +30,29 @@ pub(crate) fn report_error(error: &anyhow::Error) {
|
||||
}
|
||||
};
|
||||
|
||||
show_error_dialog(&message);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn show_error_dialog(message: &str) {
|
||||
use gtk::prelude::DialogExt as _;
|
||||
|
||||
// rfd's GTK3 MessageDialog waits indefinitely if its GTK worker fails to initialize.
|
||||
if gtk::init().is_err() {
|
||||
return;
|
||||
}
|
||||
|
||||
gtk::MessageDialog::builder()
|
||||
.message_type(gtk::MessageType::Error)
|
||||
.title("Clash Verge startup failed")
|
||||
.text(message)
|
||||
.buttons(gtk::ButtonsType::Ok)
|
||||
.build()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn show_error_dialog(message: &str) {
|
||||
let _ = rfd::MessageDialog::new()
|
||||
.set_level(rfd::MessageLevel::Error)
|
||||
.set_title("Clash Verge startup failed")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useTheme } from '@mui/material/styles'
|
||||
import { useLocalStorage } from 'foxact/use-local-storage'
|
||||
import {
|
||||
memo,
|
||||
useCallback,
|
||||
@@ -13,6 +12,8 @@ import {
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
|
||||
import {
|
||||
ConnectionColumnManager,
|
||||
type ConnectionColumnOption,
|
||||
@@ -62,6 +63,19 @@ type ColumnField =
|
||||
type ColumnSizingState = Record<string, number>
|
||||
type VisibilityState = Record<string, boolean>
|
||||
|
||||
const EMPTY_RECORD = {}
|
||||
const EMPTY_COLUMN_ORDER: string[] = []
|
||||
|
||||
const parseColumnVisibility = (value: string): VisibilityState => {
|
||||
const parsed = JSON.parse(value)
|
||||
return parsed && typeof parsed === 'object' ? parsed : EMPTY_RECORD
|
||||
}
|
||||
|
||||
const parseColumnOrder = (value: string): string[] => {
|
||||
const parsed = JSON.parse(value)
|
||||
return Array.isArray(parsed) ? parsed : EMPTY_COLUMN_ORDER
|
||||
}
|
||||
|
||||
interface BaseColumn {
|
||||
field: ColumnField
|
||||
headerName: string
|
||||
@@ -368,42 +382,20 @@ export const ConnectionTable = (props: Props) => {
|
||||
const theme = useTheme()
|
||||
const [columnWidths, setColumnWidths] = useLocalStorage<ColumnSizingState>(
|
||||
'connection-table-widths',
|
||||
{},
|
||||
EMPTY_RECORD,
|
||||
)
|
||||
|
||||
const [columnVisibilityModel, setColumnVisibilityModel] =
|
||||
useLocalStorage<VisibilityState>(
|
||||
'connection-table-visibility',
|
||||
{},
|
||||
{
|
||||
serializer: JSON.stringify,
|
||||
deserializer: (value) => {
|
||||
try {
|
||||
const parsed = JSON.parse(value)
|
||||
if (parsed && typeof parsed === 'object') return parsed
|
||||
} catch (err) {
|
||||
console.warn('Failed to parse connection-table-visibility', err)
|
||||
}
|
||||
return {}
|
||||
},
|
||||
},
|
||||
EMPTY_RECORD,
|
||||
parseColumnVisibility,
|
||||
)
|
||||
|
||||
const [columnOrder, setColumnOrder] = useLocalStorage<string[]>(
|
||||
'connection-table-order',
|
||||
[],
|
||||
{
|
||||
serializer: JSON.stringify,
|
||||
deserializer: (value) => {
|
||||
try {
|
||||
const parsed = JSON.parse(value)
|
||||
if (Array.isArray(parsed)) return parsed
|
||||
} catch (err) {
|
||||
console.warn('Failed to parse connection-table-order', err)
|
||||
}
|
||||
return []
|
||||
},
|
||||
},
|
||||
EMPTY_COLUMN_ORDER,
|
||||
parseColumnOrder,
|
||||
)
|
||||
|
||||
const baseColumns = useMemo<BaseColumn[]>(() => {
|
||||
|
||||
@@ -14,20 +14,18 @@ import {
|
||||
Typography,
|
||||
} from '@mui/material'
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
import { useEffect } from 'foxact/use-abortable-effect'
|
||||
import { useIntersection } from 'foxact/use-intersection'
|
||||
import { useLocalStorage } from 'foxact/use-local-storage'
|
||||
import type { XOR } from 'foxts/ts-xor'
|
||||
import {
|
||||
forwardRef,
|
||||
memo,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useEffectEvent,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { getIpInfo } from '@/services/api'
|
||||
import { useQuery } from '@/services/query-client'
|
||||
import getSystem from '@/utils/get-system'
|
||||
@@ -72,15 +70,14 @@ const getCountryFlag = (countryCode: string | undefined) => {
|
||||
return String.fromCodePoint(...codePoints)
|
||||
}
|
||||
|
||||
type CountDownState = XOR<
|
||||
{
|
||||
type: 'countdown'
|
||||
remainingSeconds: number
|
||||
},
|
||||
{
|
||||
type: 'revalidating'
|
||||
}
|
||||
>
|
||||
type CountDownState =
|
||||
| {
|
||||
type: 'countdown'
|
||||
remainingSeconds: number
|
||||
}
|
||||
| {
|
||||
type: 'revalidating'
|
||||
}
|
||||
|
||||
const IPInfoCardContainer = forwardRef<HTMLElement, React.PropsWithChildren>(
|
||||
({ children }, ref) => {
|
||||
@@ -114,10 +111,19 @@ export const IpInfoCard = () => {
|
||||
)
|
||||
const appWindow = useMemo(() => getCurrentWebviewWindow(), [])
|
||||
|
||||
const [hasIntersected, setHasIntersected] = useState(false)
|
||||
// Once intersected, the card stays eligible for refresh until unmount.
|
||||
const [containerRef, hasIntersected, _resetIntersected] = useIntersection({
|
||||
rootMargin: '0px',
|
||||
})
|
||||
const containerRef = useCallback((element: HTMLElement | null) => {
|
||||
if (!element) return
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
if (entries.some((e) => e.isIntersecting || e.intersectionRatio > 0)) {
|
||||
setHasIntersected(true)
|
||||
observer.disconnect()
|
||||
}
|
||||
})
|
||||
observer.observe(element)
|
||||
return () => observer.disconnect()
|
||||
}, [])
|
||||
|
||||
const [countdown, setCountdown] = useState<CountDownState>({
|
||||
type: 'countdown',
|
||||
|
||||
@@ -19,10 +19,6 @@ import {
|
||||
styled,
|
||||
} from '@mui/material'
|
||||
import { useLockFn } from 'ahooks'
|
||||
import {
|
||||
cancelIdleCallback,
|
||||
requestIdleCallback,
|
||||
} from 'foxact/request-idle-callback'
|
||||
import * as yaml from 'js-yaml'
|
||||
import {
|
||||
startTransition,
|
||||
@@ -350,10 +346,12 @@ export const GroupsEditorViewer = (props: Props) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handle = requestIdleCallback(serialize)
|
||||
return () => {
|
||||
cancelIdleCallback(handle)
|
||||
if (typeof window.requestIdleCallback === 'function') {
|
||||
const handle = window.requestIdleCallback(serialize)
|
||||
return () => window.cancelIdleCallback(handle)
|
||||
}
|
||||
const handle = window.setTimeout(serialize, 1)
|
||||
return () => window.clearTimeout(handle)
|
||||
}
|
||||
}, [prependSeq, appendSeq, deleteSeq])
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useEffect, useReducer } from 'react'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
|
||||
import { useLocalStorage } from '@/hooks/use-local-storage'
|
||||
import { useProfiles } from '@/hooks/use-profiles'
|
||||
|
||||
import { ProxySortType } from './use-filter-sort'
|
||||
@@ -16,9 +17,13 @@ export interface HeadState {
|
||||
testUrl: string
|
||||
}
|
||||
|
||||
type HeadStateStorage = Record<string, Record<string, HeadState>>
|
||||
type ProfileHeadState = Record<string, HeadState>
|
||||
type HeadStateStorage = Record<string, ProfileHeadState>
|
||||
|
||||
const HEAD_STATE_KEY = 'proxy-head-state'
|
||||
const EMPTY_STORAGE: HeadStateStorage = {}
|
||||
const EMPTY_PROFILE: ProfileHeadState = {}
|
||||
|
||||
export const DEFAULT_STATE: HeadState = {
|
||||
open: false,
|
||||
showType: true,
|
||||
@@ -31,77 +36,65 @@ export const DEFAULT_STATE: HeadState = {
|
||||
testUrl: '',
|
||||
}
|
||||
|
||||
type HeadStateAction =
|
||||
| { type: 'reset' }
|
||||
| { type: 'replace'; payload: Record<string, HeadState> }
|
||||
| { type: 'update'; groupName: string; patch: Partial<HeadState> }
|
||||
const parseStorage = (raw: string): HeadStateStorage => {
|
||||
const value = JSON.parse(raw) as HeadStateStorage | null
|
||||
return value && typeof value === 'object' && !Array.isArray(value)
|
||||
? value
|
||||
: EMPTY_STORAGE
|
||||
}
|
||||
|
||||
function headStateReducer(
|
||||
state: Record<string, HeadState>,
|
||||
action: HeadStateAction,
|
||||
): Record<string, HeadState> {
|
||||
switch (action.type) {
|
||||
case 'reset':
|
||||
return {}
|
||||
case 'replace':
|
||||
return action.payload
|
||||
case 'update': {
|
||||
const prev = state[action.groupName] || DEFAULT_STATE
|
||||
return { ...state, [action.groupName]: { ...prev, ...action.patch } }
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
const getProfileState = (storage: HeadStateStorage, profile: string) => {
|
||||
const state = storage[profile]
|
||||
return state && typeof state === 'object' && !Array.isArray(state)
|
||||
? state
|
||||
: EMPTY_PROFILE
|
||||
}
|
||||
|
||||
export function useHeadStateNew() {
|
||||
const { profiles } = useProfiles()
|
||||
const current = profiles?.current || ''
|
||||
|
||||
const [state, dispatch] = useReducer(headStateReducer, {})
|
||||
|
||||
useEffect(() => {
|
||||
try {
|
||||
const data = JSON.parse(
|
||||
localStorage.getItem(HEAD_STATE_KEY)!,
|
||||
) as HeadStateStorage
|
||||
|
||||
const value = data[current] || {}
|
||||
|
||||
if (value && typeof value === 'object') {
|
||||
dispatch({ type: 'replace', payload: value })
|
||||
} else {
|
||||
dispatch({ type: 'reset' })
|
||||
}
|
||||
} catch {
|
||||
dispatch({ type: 'reset' })
|
||||
}
|
||||
}, [current])
|
||||
const [storage, setStorage] = useLocalStorage(
|
||||
HEAD_STATE_KEY,
|
||||
EMPTY_STORAGE,
|
||||
parseStorage,
|
||||
)
|
||||
const saved = getProfileState(storage, current)
|
||||
// The active profile owns its live state even if persistence fails.
|
||||
const [state, setState] = useState(() => ({
|
||||
profile: { id: current, initialGroups: saved },
|
||||
groups: saved,
|
||||
}))
|
||||
const { profile, groups } = state
|
||||
if (profile.id !== current) {
|
||||
setState({ profile: { id: current, initialGroups: saved }, groups: saved })
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (groups === profile.initialGroups) return
|
||||
const timer = setTimeout(() => {
|
||||
try {
|
||||
const item = localStorage.getItem(HEAD_STATE_KEY)
|
||||
|
||||
let data = (item ? JSON.parse(item) : {}) as HeadStateStorage
|
||||
|
||||
if (!data || typeof data !== 'object') data = {}
|
||||
|
||||
data[current] = state
|
||||
|
||||
localStorage.setItem(HEAD_STATE_KEY, JSON.stringify(data))
|
||||
} catch {}
|
||||
setStorage((previous) => ({
|
||||
...previous,
|
||||
[profile.id]: groups,
|
||||
}))
|
||||
})
|
||||
|
||||
return () => clearTimeout(timer)
|
||||
}, [state, current])
|
||||
}, [groups, profile, setStorage])
|
||||
|
||||
const setHeadState = useCallback(
|
||||
(groupName: string, obj: Partial<HeadState>) => {
|
||||
dispatch({ type: 'update', groupName, patch: obj })
|
||||
(groupName: string, patch: Partial<HeadState>) => {
|
||||
setState((previous) => {
|
||||
if (previous.profile !== profile) return previous
|
||||
const group = previous.groups[groupName] ?? DEFAULT_STATE
|
||||
return {
|
||||
profile,
|
||||
groups: { ...previous.groups, [groupName]: { ...group, ...patch } },
|
||||
}
|
||||
})
|
||||
},
|
||||
[],
|
||||
[profile],
|
||||
)
|
||||
|
||||
return [state, setHeadState] as const
|
||||
return [groups, setHeadState] as const
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useLocalStorage } from 'foxact/use-local-storage'
|
||||
import { useLocalStorage } from './use-local-storage'
|
||||
|
||||
const defaultClashLog: IClashLog = {
|
||||
enable: true,
|
||||
@@ -8,7 +8,4 @@ const defaultClashLog: IClashLog = {
|
||||
}
|
||||
|
||||
export const useClashLog = () =>
|
||||
useLocalStorage<IClashLog>('clash-log', defaultClashLog, {
|
||||
serializer: JSON.stringify,
|
||||
deserializer: JSON.parse,
|
||||
})
|
||||
useLocalStorage<IClashLog>('clash-log', defaultClashLog)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useLocalStorage } from 'foxact/use-local-storage'
|
||||
import { useLocalStorage } from './use-local-storage'
|
||||
|
||||
const defaultConnectionSetting: IConnectionSetting = { layout: 'table' }
|
||||
|
||||
@@ -6,8 +6,4 @@ export const useConnectionSetting = () =>
|
||||
useLocalStorage<IConnectionSetting>(
|
||||
'connections-setting',
|
||||
defaultConnectionSetting,
|
||||
{
|
||||
serializer: JSON.stringify,
|
||||
deserializer: JSON.parse,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @eslint-react/set-state-in-effect */
|
||||
import { useEffect } from 'foxact/use-abortable-effect'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
|
||||
import { showNotice } from '@/services/notice-service'
|
||||
|
||||
@@ -42,26 +41,28 @@ export const useEditorDocument = ({ open, load }: UseEditorDocumentOptions) => {
|
||||
}
|
||||
}, [applyLoadedValue, load])
|
||||
|
||||
useEffect(
|
||||
(signal) => {
|
||||
resetDocumentState()
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
resetDocumentState()
|
||||
|
||||
if (!open) return
|
||||
if (!open) return
|
||||
|
||||
load()
|
||||
.then((nextValue) => {
|
||||
if (signal.aborted) return
|
||||
applyLoadedValue(nextValue)
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!signal.aborted) showNotice.error(error)
|
||||
})
|
||||
.finally(() => {
|
||||
if (!signal.aborted) setLoading(false)
|
||||
})
|
||||
},
|
||||
[applyLoadedValue, load, open, resetDocumentState],
|
||||
)
|
||||
load()
|
||||
.then((nextValue) => {
|
||||
if (cancelled) return
|
||||
applyLoadedValue(nextValue)
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!cancelled) showNotice.error(error)
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false)
|
||||
})
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [applyLoadedValue, load, open, resetDocumentState])
|
||||
|
||||
const markSaved = useCallback((nextValue: string) => {
|
||||
setSavedValue(nextValue)
|
||||
|
||||
+6
-20
@@ -1,21 +1,16 @@
|
||||
import { useState, useCallback } from 'react'
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import {
|
||||
changeLanguage,
|
||||
resolveLanguage,
|
||||
supportedLanguages,
|
||||
} from '@/services/i18n'
|
||||
import { changeLanguage, resolveSupportedLanguage } from '@/services/i18n'
|
||||
|
||||
export const useI18n = () => {
|
||||
const { i18n, t } = useTranslation()
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const { i18n } = useTranslation()
|
||||
|
||||
const switchLanguage = useCallback(
|
||||
async (language: string) => {
|
||||
const targetLanguage = resolveLanguage(language)
|
||||
const targetLanguage = resolveSupportedLanguage(language)
|
||||
|
||||
if (!supportedLanguages.includes(targetLanguage)) {
|
||||
if (!targetLanguage) {
|
||||
console.warn(`Unsupported language: ${language}`)
|
||||
return
|
||||
}
|
||||
@@ -24,23 +19,14 @@ export const useI18n = () => {
|
||||
return
|
||||
}
|
||||
|
||||
setIsLoading(true)
|
||||
try {
|
||||
await changeLanguage(targetLanguage)
|
||||
} catch (error) {
|
||||
console.error('Failed to change language:', error)
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
}
|
||||
},
|
||||
[i18n.language],
|
||||
)
|
||||
|
||||
return {
|
||||
currentLanguage: i18n.language,
|
||||
supportedLanguages,
|
||||
switchLanguage,
|
||||
isLoading,
|
||||
t,
|
||||
}
|
||||
return { switchLanguage }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
import { useCallback, useMemo, useSyncExternalStore } from 'react'
|
||||
|
||||
interface StorageEntry {
|
||||
listeners: Set<() => void>
|
||||
raw: string | null
|
||||
parsedRaw: string | null
|
||||
parsed: unknown
|
||||
deserializer?: (value: string) => unknown
|
||||
}
|
||||
|
||||
const entries = new Map<string, StorageEntry>()
|
||||
|
||||
const readRaw = (key: string): string | null => {
|
||||
try {
|
||||
return window.localStorage.getItem(key)
|
||||
} catch (error) {
|
||||
console.warn(`[useLocalStorage] Failed to read "${key}"`, error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
const getRaw = (key: string): string | null => {
|
||||
const entry = entries.get(key)
|
||||
return entry ? entry.raw : readRaw(key)
|
||||
}
|
||||
|
||||
const handleStorageEvent = (event: StorageEvent) => {
|
||||
if (event.storageArea !== window.localStorage) return
|
||||
|
||||
if (event.key === null) {
|
||||
entries.forEach((entry) => {
|
||||
entry.raw = null
|
||||
entry.parsedRaw = null
|
||||
entry.parsed = undefined
|
||||
entry.listeners.forEach((listener) => listener())
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const entry = entries.get(event.key)
|
||||
if (!entry) return
|
||||
entry.raw = event.newValue
|
||||
entry.parsedRaw = null
|
||||
entry.parsed = undefined
|
||||
entry.listeners.forEach((listener) => listener())
|
||||
}
|
||||
|
||||
const subscribeKey = (key: string, listener: () => void) => {
|
||||
if (entries.size === 0) {
|
||||
window.addEventListener('storage', handleStorageEvent)
|
||||
}
|
||||
|
||||
let entry = entries.get(key)
|
||||
if (!entry) {
|
||||
entry = {
|
||||
listeners: new Set(),
|
||||
raw: readRaw(key),
|
||||
parsedRaw: null,
|
||||
parsed: undefined,
|
||||
}
|
||||
entries.set(key, entry)
|
||||
}
|
||||
entry.listeners.add(listener)
|
||||
|
||||
return () => {
|
||||
const current = entries.get(key)
|
||||
if (current) {
|
||||
current.listeners.delete(listener)
|
||||
if (current.listeners.size === 0) entries.delete(key)
|
||||
}
|
||||
if (entries.size === 0) {
|
||||
window.removeEventListener('storage', handleStorageEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const parseRaw = <T>(
|
||||
key: string,
|
||||
raw: string | null,
|
||||
defaultValue: T,
|
||||
deserializer: (value: string) => T,
|
||||
): T => {
|
||||
if (raw === null) return defaultValue
|
||||
const entry = entries.get(key)
|
||||
if (entry && entry.parsedRaw === raw && entry.deserializer === deserializer) {
|
||||
return entry.parsed as T
|
||||
}
|
||||
try {
|
||||
const value = deserializer(raw)
|
||||
if (entry) {
|
||||
entry.parsedRaw = raw
|
||||
entry.parsed = value
|
||||
entry.deserializer = deserializer
|
||||
}
|
||||
return value
|
||||
} catch (error) {
|
||||
console.warn(`[useLocalStorage] Failed to deserialize "${key}"`, error)
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
export const useLocalStorage = <T>(
|
||||
key: string,
|
||||
defaultValue: T,
|
||||
deserializer: (value: string) => T = JSON.parse,
|
||||
): [T, (value: T | ((prev: T) => T)) => void] => {
|
||||
const subscribe = useCallback(
|
||||
(listener: () => void) => subscribeKey(key, listener),
|
||||
[key],
|
||||
)
|
||||
|
||||
const raw = useSyncExternalStore(subscribe, () => getRaw(key))
|
||||
|
||||
const value = useMemo<T>(
|
||||
() => parseRaw(key, raw, defaultValue, deserializer),
|
||||
[key, raw, defaultValue, deserializer],
|
||||
)
|
||||
|
||||
const setValue = useCallback(
|
||||
(next: T | ((prev: T) => T)) => {
|
||||
try {
|
||||
const entry = entries.get(key)
|
||||
const currentRaw = entry ? entry.raw : readRaw(key)
|
||||
const resolved =
|
||||
typeof next === 'function'
|
||||
? (next as (prev: T) => T)(
|
||||
parseRaw(key, currentRaw, defaultValue, deserializer),
|
||||
)
|
||||
: next
|
||||
|
||||
const serialized = JSON.stringify(resolved)
|
||||
if (currentRaw === serialized) return
|
||||
window.localStorage.setItem(key, serialized)
|
||||
if (entry) {
|
||||
entry.raw = serialized
|
||||
entry.parsedRaw = null
|
||||
entry.parsed = undefined
|
||||
entry.listeners.forEach((listener) => listener())
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`[useLocalStorage] Failed to write "${key}"`, error)
|
||||
}
|
||||
},
|
||||
[key, defaultValue, deserializer],
|
||||
)
|
||||
|
||||
return [value, setValue]
|
||||
}
|
||||
+15
-18
@@ -1,7 +1,6 @@
|
||||
import './assets/styles/index.scss'
|
||||
|
||||
import { ResizeObserver } from '@juggle/resize-observer'
|
||||
import { ComposeContextProvider } from 'foxact/compose-context-provider'
|
||||
import React from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { RouterProvider } from 'react-router'
|
||||
@@ -38,26 +37,24 @@ if (!container) {
|
||||
disableWebViewShortcuts()
|
||||
|
||||
const initializeApp = (initialThemeMode: 'light' | 'dark') => {
|
||||
const contexts = [
|
||||
<ThemeModeProvider key="theme" initialState={initialThemeMode} />,
|
||||
<AppStoreProvider key="app-store" />,
|
||||
<UpdateStateProvider key="update" />,
|
||||
]
|
||||
|
||||
const root = createRoot(container)
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<ComposeContextProvider contexts={contexts}>
|
||||
<BaseErrorBoundary>
|
||||
<SWRConfig value={swrConfig}>
|
||||
<WindowProvider>
|
||||
<AppDataProvider>
|
||||
<RouterProvider router={router} />
|
||||
</AppDataProvider>
|
||||
</WindowProvider>
|
||||
</SWRConfig>
|
||||
</BaseErrorBoundary>
|
||||
</ComposeContextProvider>
|
||||
<ThemeModeProvider initialState={initialThemeMode}>
|
||||
<AppStoreProvider>
|
||||
<UpdateStateProvider>
|
||||
<BaseErrorBoundary>
|
||||
<SWRConfig value={swrConfig}>
|
||||
<WindowProvider>
|
||||
<AppDataProvider>
|
||||
<RouterProvider router={router} />
|
||||
</AppDataProvider>
|
||||
</WindowProvider>
|
||||
</SWRConfig>
|
||||
</BaseErrorBoundary>
|
||||
</UpdateStateProvider>
|
||||
</AppStoreProvider>
|
||||
</ThemeModeProvider>
|
||||
</React.StrictMode>,
|
||||
)
|
||||
}
|
||||
|
||||
+78
-62
@@ -1,8 +1,5 @@
|
||||
import { getName, getVersion } from '@tauri-apps/api/app'
|
||||
import { fetch } from '@tauri-apps/plugin-http'
|
||||
import { asyncRetry } from 'foxts/async-retry'
|
||||
import { extractErrorMessage } from 'foxts/extract-error-message'
|
||||
import { once } from 'foxts/once'
|
||||
import i18n from 'i18next'
|
||||
import { getBaseConfig } from 'tauri-plugin-mihomo-api'
|
||||
|
||||
@@ -10,15 +7,42 @@ import { debugLog } from '@/utils/debug'
|
||||
|
||||
import { getRuntimeConfig } from './cmds'
|
||||
|
||||
const getUserAgentPromise = once(async () => {
|
||||
try {
|
||||
const [name, version] = await Promise.all([getName(), getVersion()])
|
||||
return `${name}/${version}`
|
||||
} catch (error) {
|
||||
console.debug('Failed to build User-Agent, fallback to default', error)
|
||||
return 'clash-verge-rev'
|
||||
let userAgentPromise: Promise<string> | null = null
|
||||
const getUserAgentPromise = () =>
|
||||
(userAgentPromise ??= Promise.all([getName(), getVersion()])
|
||||
.then(([name, version]) => `${name}/${version}`)
|
||||
.catch((error) => {
|
||||
console.debug('Failed to build User-Agent, fallback to default', error)
|
||||
return 'clash-verge-rev'
|
||||
}))
|
||||
|
||||
const extractErrorMessage = (error: unknown): string | null =>
|
||||
error instanceof Error ? `${error.name}: ${error.message}`.trim() : null
|
||||
|
||||
const retryWithBackoff = async <T>(
|
||||
fn: (bail: (error: unknown) => never) => Promise<T>,
|
||||
retries: number,
|
||||
): Promise<T> => {
|
||||
let bailed = false
|
||||
const bail = (error: unknown): never => {
|
||||
bailed = true
|
||||
throw error
|
||||
}
|
||||
})
|
||||
|
||||
for (let attempt = 0; ; attempt++) {
|
||||
try {
|
||||
return await fn(bail)
|
||||
} catch (error) {
|
||||
if (bailed || attempt >= retries) throw error
|
||||
|
||||
const delay = Math.min(
|
||||
Math.round((Math.random() + 1) * 1000 * 2 ** attempt),
|
||||
4000,
|
||||
)
|
||||
await new Promise((resolve) => setTimeout(resolve, delay))
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get current IP and geolocation information (refactored IP detection with service-specific mappings)
|
||||
interface IpInfo {
|
||||
ip: string
|
||||
@@ -249,61 +273,53 @@ export const getIpInfo = async (): Promise<
|
||||
debugLog(`尝试IP检测服务: ${service.url}`)
|
||||
|
||||
try {
|
||||
return await asyncRetry(
|
||||
async (bail) => {
|
||||
console.debug('Fetching IP information:', service.url)
|
||||
return await retryWithBackoff(async (bail) => {
|
||||
console.debug('Fetching IP information:', service.url)
|
||||
|
||||
const timeoutController = new AbortController()
|
||||
const timeoutId = setTimeout(() => {
|
||||
timeoutController.abort()
|
||||
}, serviceTimeout)
|
||||
const timeoutController = new AbortController()
|
||||
const timeoutId = setTimeout(() => {
|
||||
timeoutController.abort()
|
||||
}, serviceTimeout)
|
||||
|
||||
try {
|
||||
const response = await fetch(service.url, {
|
||||
method: 'GET',
|
||||
proxy,
|
||||
signal: timeoutController.signal,
|
||||
connectTimeout: serviceTimeout,
|
||||
headers: {
|
||||
'User-Agent': userAgent,
|
||||
},
|
||||
})
|
||||
try {
|
||||
const response = await fetch(service.url, {
|
||||
method: 'GET',
|
||||
proxy,
|
||||
signal: timeoutController.signal,
|
||||
connectTimeout: serviceTimeout,
|
||||
headers: {
|
||||
'User-Agent': userAgent,
|
||||
},
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
return bail(
|
||||
new Error(
|
||||
`IP 检测服务出错,状态码: ${response.status} from ${service.url}`,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
let data: any
|
||||
try {
|
||||
data = await response.json()
|
||||
} catch {
|
||||
return bail(new Error(`无法解析 JSON 响应 from ${service.url}`))
|
||||
}
|
||||
|
||||
if (data && data.ip) {
|
||||
debugLog(`IP检测成功,使用服务: ${service.url}`)
|
||||
return Object.assign(service.mapping(data), {
|
||||
// use last fetch success timestamp
|
||||
lastFetchTs: Date.now(),
|
||||
})
|
||||
} else {
|
||||
return bail(new Error(`无效的响应格式 from ${service.url}`))
|
||||
}
|
||||
} finally {
|
||||
clearTimeout(timeoutId)
|
||||
if (!response.ok) {
|
||||
return bail(
|
||||
new Error(
|
||||
`IP 检测服务出错,状态码: ${response.status} from ${service.url}`,
|
||||
),
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
retries: maxRetries,
|
||||
minTimeout: 1000,
|
||||
maxTimeout: 4000,
|
||||
randomize: true,
|
||||
},
|
||||
)
|
||||
|
||||
let data: any
|
||||
try {
|
||||
data = await response.json()
|
||||
} catch {
|
||||
return bail(new Error(`无法解析 JSON 响应 from ${service.url}`))
|
||||
}
|
||||
|
||||
if (data && data.ip) {
|
||||
debugLog(`IP检测成功,使用服务: ${service.url}`)
|
||||
return Object.assign(service.mapping(data), {
|
||||
// use last fetch success timestamp
|
||||
lastFetchTs: Date.now(),
|
||||
})
|
||||
} else {
|
||||
return bail(new Error(`无效的响应格式 from ${service.url}`))
|
||||
}
|
||||
} finally {
|
||||
clearTimeout(timeoutId)
|
||||
}
|
||||
}, maxRetries)
|
||||
} catch (error) {
|
||||
debugLog(`IP检测服务失败: ${service.url}`, error)
|
||||
lastError = error
|
||||
|
||||
+34
-18
@@ -24,27 +24,43 @@ const LANGUAGE_STORAGE_KEY = 'verge-language'
|
||||
const normalizeLanguage = (language?: string) =>
|
||||
language?.toLowerCase().replace(/_/g, '-')
|
||||
|
||||
export const resolveLanguage = (language?: string) => {
|
||||
// Aliases whose catalog differs from the base tag, as in clash-verge-i18n.
|
||||
const languageAliases = new Map([
|
||||
['ja', 'jp'],
|
||||
['zh-tw', 'zhtw'],
|
||||
['zh-hk', 'zhtw'],
|
||||
['zh-hant', 'zhtw'],
|
||||
['zh-mo', 'zhtw'],
|
||||
['zh-cht', 'zhtw'],
|
||||
])
|
||||
const maxLanguageTagLength = Math.max(
|
||||
...[...supportedLanguages, ...languageAliases.keys()].map(
|
||||
(tag) => tag.length,
|
||||
),
|
||||
)
|
||||
|
||||
export const resolveSupportedLanguage = (language?: string) => {
|
||||
const normalized = normalizeLanguage(language)
|
||||
if (!normalized) {
|
||||
return FALLBACK_LANGUAGE
|
||||
if (!normalized) return undefined
|
||||
|
||||
// Longer prefixes cannot match a catalog or alias.
|
||||
let end =
|
||||
normalized.length <= maxLanguageTagLength
|
||||
? normalized.length
|
||||
: normalized.lastIndexOf('-', maxLanguageTagLength)
|
||||
while (end > 0) {
|
||||
const prefix = normalized.slice(0, end)
|
||||
const alias = languageAliases.get(prefix)
|
||||
if (alias) return alias
|
||||
if (supportedLanguages.includes(prefix)) return prefix
|
||||
end = normalized.lastIndexOf('-', end - 1)
|
||||
}
|
||||
|
||||
if (normalized === 'zh-tw') return 'zhtw'
|
||||
if (normalized === 'zh-cn') return 'zh'
|
||||
|
||||
if (supportedLanguages.includes(normalized)) {
|
||||
return normalized
|
||||
}
|
||||
|
||||
const baseLanguage = normalized.split('-')[0]
|
||||
if (supportedLanguages.includes(baseLanguage)) {
|
||||
return baseLanguage
|
||||
}
|
||||
|
||||
return FALLBACK_LANGUAGE
|
||||
return undefined
|
||||
}
|
||||
|
||||
export const resolveLanguage = (language?: string) =>
|
||||
resolveSupportedLanguage(language) ?? FALLBACK_LANGUAGE
|
||||
|
||||
const getLanguageStorage = () => {
|
||||
if (typeof window === 'undefined') return null
|
||||
try {
|
||||
@@ -54,7 +70,7 @@ const getLanguageStorage = () => {
|
||||
}
|
||||
}
|
||||
|
||||
export const cacheLanguage = (language: string) => {
|
||||
const cacheLanguage = (language: string) => {
|
||||
const storage = getLanguageStorage()
|
||||
if (!storage) return
|
||||
|
||||
|
||||
+9
-44
@@ -1,9 +1,9 @@
|
||||
import { getVergeConfig } from './cmds'
|
||||
import {
|
||||
cacheLanguage,
|
||||
getCachedLanguage,
|
||||
initializeLanguage,
|
||||
resolveLanguage,
|
||||
resolveSupportedLanguage,
|
||||
} from './i18n'
|
||||
|
||||
let vergeConfigCache: IVergeConfig | null | undefined
|
||||
@@ -57,50 +57,15 @@ const preloadConfig = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const preloadLanguage = async (
|
||||
vergeConfig?: IVergeConfig | null,
|
||||
loadConfig: () => Promise<IVergeConfig | null> = preloadConfig,
|
||||
) => {
|
||||
const cachedLanguage = getCachedLanguage()
|
||||
if (cachedLanguage) {
|
||||
return cachedLanguage
|
||||
}
|
||||
|
||||
let resolvedConfig = vergeConfig
|
||||
|
||||
if (resolvedConfig === undefined) {
|
||||
try {
|
||||
resolvedConfig = await loadConfig()
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
'[preload.ts] Failed to read language from Verge config:',
|
||||
error,
|
||||
)
|
||||
resolvedConfig = null
|
||||
}
|
||||
}
|
||||
|
||||
const languageFromConfig = resolvedConfig?.language
|
||||
if (languageFromConfig) {
|
||||
const resolved = resolveLanguage(languageFromConfig)
|
||||
cacheLanguage(resolved)
|
||||
return resolved
|
||||
}
|
||||
|
||||
const browserLanguage = resolveLanguage(
|
||||
typeof navigator !== 'undefined' ? navigator.language : undefined,
|
||||
)
|
||||
cacheLanguage(browserLanguage)
|
||||
return browserLanguage
|
||||
}
|
||||
|
||||
export const preloadAppData = async () => {
|
||||
const configPromise = preloadConfig()
|
||||
const initialLanguage = await preloadLanguage(undefined, () => configPromise)
|
||||
const [config] = await Promise.all([
|
||||
configPromise,
|
||||
initializeLanguage(initialLanguage),
|
||||
])
|
||||
const config = await preloadConfig()
|
||||
const initialLanguage =
|
||||
resolveSupportedLanguage(config?.language ?? undefined) ??
|
||||
getCachedLanguage() ??
|
||||
resolveLanguage(
|
||||
typeof navigator !== 'undefined' ? navigator.language : undefined,
|
||||
)
|
||||
await initializeLanguage(initialLanguage)
|
||||
const initialThemeMode = resolveThemeMode(config)
|
||||
return { initialThemeMode }
|
||||
}
|
||||
|
||||
+47
-14
@@ -1,18 +1,51 @@
|
||||
import { createContextState } from 'foxact/create-context-state'
|
||||
import {
|
||||
createContext,
|
||||
createElement,
|
||||
use,
|
||||
useState,
|
||||
type Dispatch,
|
||||
type ReactNode,
|
||||
type SetStateAction,
|
||||
} from 'react'
|
||||
|
||||
const [ThemeModeProvider, useThemeMode, useSetThemeMode] = createContextState<
|
||||
'light' | 'dark'
|
||||
>()
|
||||
import noop from '@/utils/noop'
|
||||
|
||||
// save update state
|
||||
const [UpdateStateProvider, useUpdateState, useSetUpdateState] =
|
||||
createContextState<boolean>(false)
|
||||
type ThemeMode = 'light' | 'dark'
|
||||
|
||||
export {
|
||||
ThemeModeProvider,
|
||||
useThemeMode,
|
||||
useSetThemeMode,
|
||||
UpdateStateProvider,
|
||||
useUpdateState,
|
||||
useSetUpdateState,
|
||||
const ThemeModeContext = createContext<ThemeMode>('light')
|
||||
const SetThemeModeContext =
|
||||
createContext<Dispatch<SetStateAction<ThemeMode>>>(noop)
|
||||
|
||||
export const ThemeModeProvider = ({
|
||||
initialState,
|
||||
children,
|
||||
}: {
|
||||
initialState: ThemeMode
|
||||
children?: ReactNode
|
||||
}) => {
|
||||
const [mode, setMode] = useState<ThemeMode>(initialState)
|
||||
return createElement(
|
||||
ThemeModeContext,
|
||||
{ value: mode },
|
||||
createElement(SetThemeModeContext, { value: setMode }, children),
|
||||
)
|
||||
}
|
||||
|
||||
export const useThemeMode = () => use(ThemeModeContext)
|
||||
export const useSetThemeMode = () => use(SetThemeModeContext)
|
||||
|
||||
const UpdateStateContext = createContext<boolean>(false)
|
||||
const SetUpdateStateContext =
|
||||
createContext<Dispatch<SetStateAction<boolean>>>(noop)
|
||||
|
||||
export const UpdateStateProvider = ({ children }: { children?: ReactNode }) => {
|
||||
const [state, setState] = useState(false)
|
||||
return createElement(
|
||||
UpdateStateContext,
|
||||
{ value: state },
|
||||
createElement(SetUpdateStateContext, { value: setState }, children),
|
||||
)
|
||||
}
|
||||
|
||||
export const useUpdateState = () => use(UpdateStateContext)
|
||||
export const useSetUpdateState = () => use(SetUpdateStateContext)
|
||||
|
||||
Reference in New Issue
Block a user