Skip to content

Commit e783694

Browse files
author
clash-dev
committed
feat: dashboard panel selector in advanced settings (v1.4.0)
- Add 4-option radio selector in Advanced sub-tab: metacubexd / Yacd Meta / Zashboard / Custom - Custom URL input with placeholder example, enabled only when Custom selected - Unified placeholder substitution: %host / %port / %secret replaced at runtime - DASHBOARD_PRESETS const in popup.js; presets not persisted in settings - Fallback to metacubexd when custom URL empty (avoid about:blank) - zh/en/ja i18n for 4 new keys - Bump version 1.3.9 -> 1.4.0 (minor: new feature)
1 parent 691be94 commit e783694

12 files changed

Lines changed: 235 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,69 @@
22

33
---
44

5+
## v1.4.0 (2026-07-04)
6+
7+
**设置页「高级」标签新增控制台面板选择,支持 metacubexd / Yacd Meta / Zashboard / 自定义。**
8+
9+
---
10+
11+
### 一、新功能
12+
13+
- **「高级」子标签页新增「控制台面板」选择器**:4 选 1 单选按钮
14+
- `metacubexd``https://metacubex.github.io/metacubexd/`(默认)
15+
- `Yacd Meta``https://yacd.metacubex.one/`
16+
- `Zashboard``https://board.zash.run.place/`
17+
- `自定义`:用户填入 URL 模板,含占位符 `%host` / `%port` / `%secret`
18+
- **占位符替换机制**:所有面板(预设和自定义)统一使用 `%host` / `%port` / `%secret` 占位符,运行时被 Clash API 实际值替换(encodeURIComponent 编码,避免特殊字符破坏 URL)
19+
- **自定义 URL 输入框**:仅当选择「自定义」radio 时启用,否则 disabled;切换到 custom 时自动聚焦输入框
20+
- **placeholder 示例**`https://example.com/#/setup?hostname=%host&port=%port&secret=%secret`,用户照着填即可
21+
- **多语言适配**:zh_CN / en / ja 三语言完整翻译面板名、自定义标签、placeholder、提示语
22+
23+
### 二、关键决策
24+
25+
| 决策 | 理由 |
26+
|---|---|
27+
|`%host` 等占位符而非 `${host}` 模板字符串 | URL 中 `$` 可能与某些面板自带的模板语法冲突,`%` 更安全且无歧义 |
28+
| 预设 URL 写在代码常量 `DASHBOARD_PRESETS` 而非 settings | 预设固定不需要持久化,settings 只存类型枚举 + 自定义 URL |
29+
| 自定义为空时回退到 metacubexd | 避免用户选了 custom 但忘了填 URL 导致打开 `about:blank` |
30+
| radio 而非 select | 4 个选项用 radio 一目了然,配合 URL 副标题更直观 |
31+
| 自定义 URL 输入框默认 disabled | 视觉上明确"只有选 custom 才能用",避免误填了 URL 但实际选的是预设 |
32+
| minor 版本号 bump(1.3.9→1.4.0) | 新增功能而非纯 bug 修复,按 semver 应 minor bump |
33+
34+
### 三、URL 拼接逻辑
35+
36+
三个面板的实际 URL 模板(运行时被实际值替换):
37+
38+
```
39+
metacubexd: https://metacubex.github.io/metacubexd/#/setup?http=true&hostname=%host&port=%port&secret=%secret
40+
yacd: https://yacd.metacubex.one/?hostname=%host&port=%port&secret=%secret
41+
zashboard: https://board.zash.run.place/#/setup?http=true&hostname=%host&port=%port&secret=%secret
42+
```
43+
44+
注意 yacd 使用查询参数(`?`),metacubexd 和 zashboard 使用 hash 路由(`#/setup?`),yacd 不需要 `http=true` 参数。
45+
46+
### 四、文件变更清单
47+
48+
| 文件 | 变更 |
49+
|------|------|
50+
| `extension/popup/popup.html` | 「高级」子标签页新增 4 个 radio + 自定义 URL 输入框 + 提示语 |
51+
| `extension/popup/popup.css` | 新增 `.settings-dashboard-options` / `.settings-radio-row` / `.dashboard-name` / `.dashboard-url` 样式,玻璃拟态主题自动适配 |
52+
| `extension/popup/popup.js` | 新增 `DASHBOARD_PRESETS` 常量;重写 `openWebDashboard()` 走占位符替换;settings 保存/加载添加 `dashboardType` / `dashboardCustomUrl`;radio change 事件动态启用/禁用自定义 URL 输入框 |
53+
| `extension/background.js` | 默认 settings 新增 `dashboardType: 'metacubexd'` / `dashboardCustomUrl: ''` |
54+
| `extension/locales/zh_CN.json` | 新增 4 个翻译键:`settings_dashboard_panel` / `settings_dashboard_custom` / `settings_dashboard_custom_placeholder` / `settings_dashboard_hint` |
55+
| `extension/locales/en.json` | 同上(英文翻译) |
56+
| `extension/locales/ja.json` | 同上(日文翻译) |
57+
| `extension/manifest.json` | 版本号 1.3.9 → 1.4.0 |
58+
| `README.md` / `README_EN.md` | 版本徽章 1.3.9 → 1.4.0 |
59+
| `docs/index.html` | hero_badge 版本号 1.3.9 → 1.4.0(中/英) |
60+
61+
### 五、向后兼容
62+
63+
- 旧版 settings(无 `dashboardType` 字段)打开 popup 时自动默认 `metacubexd`,且保存设置后会自动补全字段
64+
- 自定义 URL 输入框为空时打开控制台不报错,回退到 metacubexd
65+
66+
---
67+
568
## v1.3.9 (2026-07-04)
669

770
**顶部操作栏新增「控制台」按钮,一键打开 metacubexd 网页面板。**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<img src="extension/icons/logo128_white.png" width="128" height="128" alt="ClashOmega Logo">
88

9-
[![Version](https://img.shields.io/badge/version-1.3.9-blue?style=flat-square)](https://github.com/ciskonc/ClashOmega)
9+
[![Version](https://img.shields.io/badge/version-1.4.0-blue?style=flat-square)](https://github.com/ciskonc/ClashOmega)
1010
[![Platform](https://img.shields.io/badge/platform-Chromium%20Browsers-green?style=flat-square)](https://github.com/ciskonc/ClashOmega)
1111
[![License](https://img.shields.io/badge/license-MIT-orange?style=flat-square)](LICENSE)
1212
[![Manifest](https://img.shields.io/badge/Manifest-V3-purple?style=flat-square)](https://developer.chrome.com/docs/extensions/mv3/intro/)

README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<img src="extension/icons/logo128_white.png" width="128" height="128" alt="ClashOmega Logo">
88

9-
[![Version](https://img.shields.io/badge/version-1.3.9-blue?style=flat-square)](https://github.com/ciskonc/ClashOmega)
9+
[![Version](https://img.shields.io/badge/version-1.4.0-blue?style=flat-square)](https://github.com/ciskonc/ClashOmega)
1010
[![Platform](https://img.shields.io/badge/platform-Chromium%20Browsers-green?style=flat-square)](https://github.com/ciskonc/ClashOmega)
1111
[![License](https://img.shields.io/badge/license-MIT-orange?style=flat-square)](LICENSE)
1212
[![Manifest](https://img.shields.io/badge/Manifest-V3-purple?style=flat-square)](https://developer.chrome.com/docs/extensions/mv3/intro/)

docs/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@
868868
<div class="hero-content">
869869
<div class="hero-badge">
870870
<span class="dot"></span>
871-
<span data-i18n="hero_badge">Chrome 扩展 · v1.3.9 · 致敬 SwitchyOmega</span>
871+
<span data-i18n="hero_badge">Chrome 扩展 · v1.4.0 · 致敬 SwitchyOmega</span>
872872
</div>
873873
<h1 class="hero-title">
874874
<span data-i18n="hero_title_1">掌控 Clash</span>
@@ -1183,7 +1183,7 @@ <h4 data-i18n="footer_related">相关</h4>
11831183
doc_title: 'ClashOmega — Clash 代理规则管理扩展 | 致敬 SwitchyOmega',
11841184
nav_features: '功能', nav_compare: '对比', nav_flow: '流程',
11851185
nav_modes: '模式', nav_install: '安装', nav_compat: '兼容',
1186-
hero_badge: 'Chrome 扩展 · v1.3.9 · 致敬 SwitchyOmega',
1186+
hero_badge: 'Chrome 扩展 · v1.4.0 · 致敬 SwitchyOmega',
11871187
hero_title_1: '掌控 Clash', hero_title_2: '一键切换 Ω',
11881188
hero_subtitle: 'ClashOmega 是一款 Chrome 浏览器扩展,让你<strong>三模式切换</strong>、<strong>域名匹配检测</strong>、<strong>快捷规则管理</strong>,告别繁琐的 Clash 配置文件手动编辑。',
11891189
stat_features: '功能特性', stat_browsers: '浏览器', stat_languages: '语言', stat_deps: '依赖',
@@ -1239,7 +1239,7 @@ <h4 data-i18n="footer_related">相关</h4>
12391239
doc_title: 'ClashOmega — Clash Proxy Rule Manager | Tribute to SwitchyOmega',
12401240
nav_features: 'Features', nav_compare: 'Compare', nav_flow: 'Workflow',
12411241
nav_modes: 'Modes', nav_install: 'Install', nav_compat: 'Compat',
1242-
hero_badge: 'Chrome Extension · v1.3.9 · Tribute to SwitchyOmega',
1242+
hero_badge: 'Chrome Extension · v1.4.0 · Tribute to SwitchyOmega',
12431243
hero_title_1: 'Master Clash', hero_title_2: 'One Switch Ω',
12441244
hero_subtitle: 'ClashOmega is a Chrome extension that lets you <strong>switch between three modes</strong>, <strong>detect domain matching</strong>, and <strong>manage rules instantly</strong> — say goodbye to manual Clash config editing.',
12451245
stat_features: 'Features', stat_browsers: 'Browsers', stat_languages: 'Languages', stat_deps: 'Dependencies',

extension/background.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ chrome.runtime.onInstalled.addListener(async () => {
2626
clashConfigPath: '',
2727
writeToYaml: false,
2828
disableFallback: false,
29+
// 控制台面板类型:metacubexd | yacd | zashboard | custom
30+
dashboardType: 'metacubexd',
31+
// 自定义控制台 URL 模板(仅当 dashboardType='custom' 时使用)
32+
// 必须含占位符 %host / %port / %secret,运行时会被实际值替换
33+
dashboardCustomUrl: '',
2934
language: 'zh_CN'
3035
}
3136
});

extension/locales/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
"settings_write_to_yaml": "Write to YAML config file",
7676
"settings_write_to_yaml_hint": "Default: write to Script.js extension script. If checked, write to the current subscription's YAML config file (.yaml in profiles dir). Requires Clash restart.",
7777

78+
"settings_dashboard_panel": "Dashboard Panel",
79+
"settings_dashboard_custom": "Custom",
80+
"settings_dashboard_custom_placeholder": "https://example.com/#/setup?hostname=%host&port=%port&secret=%secret",
81+
"settings_dashboard_hint": "Click the \"Console\" button at the top of popup to open this panel in a new tab. Clash API host/port/secret are auto-filled (placeholders %host / %port / %secret are replaced with actual values).",
82+
7883
"settings_title": "Settings",
7984
"settings_api_url": "Clash API URL",
8085
"settings_api_hint": "Auto-generated from host+port. You can also edit the full URL manually.",

extension/locales/ja.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
"settings_write_to_yaml": "YAML 設定ファイルに書き込む",
7676
"settings_write_to_yaml_hint": "デフォルト: Script.js 拡張スクリプトに書き込み。チェックすると現在のサブスクリプションの YAML 設定ファイル(profiles ディレクトリ内の .yaml)に書き込み。Clash の再起動が必要",
7777

78+
"settings_dashboard_panel": "コンソールパネル",
79+
"settings_dashboard_custom": "カスタム",
80+
"settings_dashboard_custom_placeholder": "https://example.com/#/setup?hostname=%host&port=%port&secret=%secret",
81+
"settings_dashboard_hint": "popup 上部の「コンソール」ボタンをクリックすると新しいタブでこのパネルを開きます。Clash API の host/port/secret が自動入力されます(プレースホルダー %host / %port / %secret は実際の値に置換されます)",
82+
7883
"settings_title": "設定",
7984
"settings_api_url": "Clash API URL",
8085
"settings_api_hint": "ホスト+ポートから自動生成。完全なURLを手動で編集することも可能。",

extension/locales/zh_CN.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@
7171
"settings_write_to_yaml": "写入 YAML 配置文件",
7272
"settings_write_to_yaml_hint": "默认写入 Script.js 扩展脚本;勾选后写入当前订阅的 YAML 配置文件(profiles 目录下的 .yaml),需重启 Clash 生效",
7373

74+
"settings_dashboard_panel": "控制台面板",
75+
"settings_dashboard_custom": "自定义",
76+
"settings_dashboard_custom_placeholder": "https://example.com/#/setup?hostname=%host&port=%port&secret=%secret",
77+
"settings_dashboard_hint": "点击 popup 顶部「控制台」按钮在新标签页打开此面板,自动填入 Clash API 地址与密钥(占位符 %host / %port / %secret 会被实际值替换)",
78+
7479
"settings_title": "设置",
7580
"settings_api_url": "Clash API 地址",
7681
"settings_api_hint": "修改 API 地址和端口后自动拼接,也可手动编辑完整 URL",

extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "ClashOmega",
4-
"version": "1.3.9",
4+
"version": "1.4.0",
55
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6E2OkWEYxSLKTaKIEPoetsEO5X7epTeeu831FNeICghst6xVhku1TOHxj371CjbRDUWdnQTI+xlD8UtGW0Kkx4j7mWNOvIDnW/idpiORExFn7/vMaEXeEfM18qBN9PSldChG3FAZ2PLhinZYoZPXRI63eVt5aU1yCn+Jw9va+OS1SZs+esjj1wPv12jaju3J5Uf1F/v7qUoYu3FPuPak/O0k+5LJbd29zKcDF5Vnp49g/fLuqzYjqi+RyJUMNnzxMsf2HOsvIK3Ynxr2mkWeVdcdwptFOdQFegldflLPo5f4E3A7XMiGG8cix5ceGMSKme0sR3Vl9P8aimB+4IsObwIDAQAB",
66
"description": "控制 Clash 代理模式,直接管理 YAML 规则(致敬 SwitchyOmega / ZeroOmega)",
77
"permissions": [

extension/popup/popup.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,57 @@ input, button, select, textarea {
757757
font: var(--md-typescale-body-medium);
758758
color: var(--md-sys-color-on-surface);
759759
}
760+
761+
/* ──── 控制台面板选择(radio + 自定义 URL) ──── */
762+
.settings-dashboard-options {
763+
display: flex;
764+
flex-direction: column;
765+
gap: var(--md-spacing-1);
766+
margin-top: var(--md-spacing-2);
767+
}
768+
.settings-radio-row {
769+
display: flex;
770+
align-items: flex-start;
771+
gap: var(--md-spacing-2);
772+
padding: var(--md-spacing-1) 0;
773+
cursor: pointer;
774+
user-select: none;
775+
}
776+
.settings-radio-row input[type="radio"] {
777+
width: 16px;
778+
height: 16px;
779+
margin-top: 2px;
780+
cursor: pointer;
781+
accent-color: var(--md-sys-color-primary);
782+
flex-shrink: 0;
783+
}
784+
.settings-radio-row label {
785+
display: flex;
786+
flex-direction: column;
787+
cursor: pointer;
788+
flex: 1;
789+
}
790+
.settings-radio-row .dashboard-name {
791+
font: var(--md-typescale-body-medium);
792+
color: var(--md-sys-color-on-surface);
793+
}
794+
.settings-radio-row .dashboard-url {
795+
font: var(--md-typescale-body-small);
796+
color: var(--md-sys-color-on-surface-variant);
797+
word-break: break-all;
798+
}
799+
.settings-radio-row input[type="radio"]:disabled ~ label,
800+
.settings-radio-row input[type="radio"]:disabled + label {
801+
opacity: 0.5;
802+
cursor: not-allowed;
803+
}
804+
#settings-dashboard-custom-url {
805+
margin-top: var(--md-spacing-1);
806+
}
807+
#settings-dashboard-custom-url:disabled {
808+
opacity: 0.5;
809+
cursor: not-allowed;
810+
}
760811
.native-host-status-hint {
761812
width: 100%;
762813
margin-top: var(--md-spacing-1);

0 commit comments

Comments
 (0)