update(ClashRuleProvider): 添加仪表盘组件

This commit is contained in:
wumode
2025-06-21 15:05:28 +08:00
parent 4e44a66df3
commit 6fbb669594
12 changed files with 16168 additions and 435 deletions

View File

@@ -450,11 +450,12 @@
"name": "Clash Rule Provider",
"description": "随时为Clash添加一些额外的规则。",
"labels": "工具",
"version": "1.1.1",
"version": "1.1.3",
"icon": "Mihomo_Meta_A.png",
"author": "wumode",
"level": 1,
"history": {
"v1.1.3": "添加仪表盘组件",
"v1.1.1": "支持解析 V2ray 订阅",
"v1.1.0": "支持规则集合; 添加ACL4SSR规则集; 配置说明",
"v1.0.1": "支持规则搜索, 优化细节",

View File

@@ -4,7 +4,6 @@ from typing import Any, Optional, List, Dict, Tuple, Union
import time
import yaml
import hashlib
from fastapi import Body, Response
from datetime import datetime, timedelta
import pytz
import copy
@@ -12,6 +11,12 @@ import math
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger
import httpx
import asyncio
import json
from fastapi import HTTPException, Request, status, Body, Response
import websockets
from sse_starlette.sse import EventSourceResponse
from app import schemas
from app.core.config import settings
@@ -32,7 +37,7 @@ class ClashRuleProvider(_PluginBase):
# 插件图标
plugin_icon = "Mihomo_Meta_A.png"
# 插件版本
plugin_version = "1.1.1"
plugin_version = "1.1.3"
# 插件作者
plugin_author = "wumode"
# 作者主页
@@ -67,6 +72,7 @@ class ClashRuleProvider(_PluginBase):
_refresh_delay: int = 5
_discard_rules: bool = False
_enable_acl4ssr: bool = False
_dashboard_components: List[str] = []
# 插件数据
_clash_config: Optional[Dict[str, Any]] = None
@@ -106,7 +112,12 @@ class ClashRuleProvider(_PluginBase):
self._proxy = config.get("proxy")
self._notify = config.get("notify"),
self._sub_links = config.get("sub_links") or []
self._clash_dashboard_url = config.get("clash_dashboard_url")
self._clash_dashboard_url = config.get("clash_dashboard_url") or ''
if self._clash_dashboard_url and self._clash_dashboard_url[-1] == '/':
self._clash_dashboard_url = self._clash_dashboard_url[:-1]
if not (self._clash_dashboard_url.startswith('http://') or
self._clash_dashboard_url.startswith('https://')):
self._clash_dashboard_url = 'http://' + self._clash_dashboard_url
self._clash_dashboard_secret = config.get("clash_dashboard_secret")
self._movie_pilot_url = config.get("movie_pilot_url")
if self._movie_pilot_url and self._movie_pilot_url[-1] == '/':
@@ -122,6 +133,7 @@ class ClashRuleProvider(_PluginBase):
self._refresh_delay = config.get("refresh_delay") or 5
self._discard_rules = config.get("discard_rules") or False
self._enable_acl4ssr = config.get("enable_acl4ssr") or False
self._dashboard_components = config.get("dashboard_components") or []
self._clash_rule_parser = ClashRuleParser()
self._ruleset_rule_parser = ClashRuleParser()
if self._enabled:
@@ -165,182 +177,198 @@ class ClashRuleProvider(_PluginBase):
"endpoint": self.get_clash_outbound,
"methods": ["GET"],
"auth": "bear",
"summary": "clash outbound",
"description": "clash outbound"
"summary": "获取所有出站",
"description": "获取所有出站"
},
{
"path": "/status",
"endpoint": self.get_status,
"methods": ["GET"],
"auth": "bear",
"summary": "stated",
"description": "state"
"summary": "插件状态",
"description": "插件状态"
},
{
"path": "/rules",
"endpoint": self.get_rules,
"methods": ["GET"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "获取指定集合中的规则",
"description": "获取指定集合中的规则"
},
{
"path": "/rules",
"endpoint": self.update_rules,
"methods": ["PUT"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "更新 Clash 规则",
"description": "更新 Clash 规则"
},
{
"path": "/reorder-rules",
"endpoint": self.reorder_rules,
"methods": ["PUT"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "重新排序两条规则",
"description": "重新排序两条规则"
},
{
"path": "/rule",
"endpoint": self.update_rule,
"methods": ["PUT"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "更新一条规则",
"description": "更新一条规则"
},
{
"path": "/rule",
"endpoint": self.add_rule,
"methods": ["POSt"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "添加一条规则",
"description": "添加一条规则"
},
{
"path": "/rule",
"endpoint": self.delete_rule,
"methods": ["DELETE"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "删除一条规则",
"description": "删除一条规则"
},
{
"path": "/subscription",
"endpoint": self.get_subscription,
"methods": ["GET"],
"auth": "bear",
"summary": "clash rules",
"description": "clash rules"
"summary": "获取原订阅链接",
"description": "获取原订阅链接"
},
{
"path": "/subscription",
"endpoint": self.refresh_subscription,
"methods": ["PUT"],
"auth": "bear",
"summary": "refresh clash configuration",
"description": "refresh clash configuration"
"summary": "更新订阅",
"description": "更新订阅"
},
{
"path": "/rule-providers",
"endpoint": self.get_rule_providers,
"methods": ["GET"],
"auth": "bear",
"summary": "rule providers",
"description": "rule providers"
"summary": "获取规则集合",
"description": "获取规则集合"
},
{
"path": "/extra-rule-providers",
"endpoint": self.get_extra_rule_providers,
"methods": ["GET"],
"auth": "bear",
"summary": "extra rule providers",
"description": "extra rule providers"
"summary": "添加规则集合",
"description": "添加规则集合"
},
{
"path": "/extra-rule-provider",
"endpoint": self.update_extra_rule_provider,
"methods": ["POST"],
"auth": "bear",
"summary": "update an extra rule provider",
"description": "update an rule provider"
"summary": "更新一个规则集合",
"description": "更新一个规则集合"
},
{
"path": "/extra-rule-provider",
"endpoint": self.delete_extra_rule_provider,
"methods": ["DELETE"],
"auth": "bear",
"summary": "add an extra rule provider",
"description": "add an rule provider"
"summary": "删除一个规则集合",
"description": "删除一个规则集合"
},
{
"path": "/extra-proxies",
"endpoint": self.get_extra_proxies,
"methods": ["GET"],
"auth": "bear",
"summary": "extra proxies",
"description": "extra proxies"
"summary": "获取附加出站代理",
"description": "获取附加出站代理"
},
{
"path": "/extra-proxies",
"endpoint": self.delete_extra_proxy,
"methods": ["DELETE"],
"auth": "bear",
"summary": "delete an extra proxy",
"description": "delete an extra proxy"
"summary": "删除一条出站代理",
"description": "删除一条出站代理"
},
{
"path": "/extra-proxies",
"endpoint": self.add_extra_proxies,
"methods": ["POST"],
"auth": "bear",
"summary": "add extra proxies",
"description": "add extra proxies"
"summary": "添加一条出站代理",
"description": "添加一条出站代理"
},
{
"path": "/proxy-groups",
"endpoint": self.get_proxy_groups,
"methods": ["GET"],
"auth": "bear",
"summary": "proxy groups",
"description": "proxy groups"
"summary": "获取代理组",
"description": "获取代理组"
},
{
"path": "/proxy-group",
"endpoint": self.delete_proxy_group,
"methods": ["DELETE"],
"auth": "bear",
"summary": "delete a proxy group",
"description": "delete a proxy group"
"summary": "删除一个代理组",
"description": "删除一个代理组"
},
{
"path": "/proxy-group",
"endpoint": self.add_proxy_group,
"methods": ["POST"],
"auth": "bear",
"summary": "add a proxy group",
"description": "add a proxy group"
"summary": "添加一个代理组",
"description": "添加一个代理组"
},
{
"path": "/ruleset",
"endpoint": self.get_ruleset,
"methods": ["GET"],
"summary": "update rule providers",
"description": "update rule providers"
"summary": "获取规则集规则",
"description": "获取规则集规则"
},
{
"path": "/import",
"endpoint": self.import_rules,
"methods": ["POST"],
"auth": "bear",
"summary": "import top rules",
"description": "import top rules"
"summary": "导入规则",
"description": "导入规则"
},
{
"path": "/config",
"endpoint": self.get_clash_config,
"methods": ["GET"],
"summary": "update rule providers",
"description": "update rule providers"
"summary": "获取 Clash 配置",
"description": "获取 Clash 配置"
},
{
"path": "/clash/proxy/{path:path}",
"auth": "bear",
"endpoint": self.clash_proxy,
"methods": ["GET"],
"summary": "转发 Clash API 请求",
"description": "转发 Clash API 请求"
},
{
"path": "/clash/ws/{endpoint}",
"endpoint": self.clash_websocket,
"methods": ["GET"],
"summary": "转发 Clash API Websocket 请求",
"description": "转发 Clash API Websocket 请求",
"allow_anonymous": True
}
]
@@ -358,6 +386,51 @@ class ClashRuleProvider(_PluginBase):
"""
return [], {}
def get_dashboard_meta(self) -> Optional[List[Dict[str, str]]]:
components = [
{
"key": "clash_info",
"name": "Clash Info"
},
{
"key": "traffic_stats",
"name": "Traffic Stats"
}
]
return [component for component in components if component.get("name") in self._dashboard_components]
def get_dashboard(self, key: str, **kwargs) -> Optional[Tuple[Dict[str, Any], Dict[str, Any], List[dict]]]:
"""
获取插件仪表盘页面需要返回1、仪表板col配置字典2、全局配置自动刷新等3、仪表板页面元素配置json含数据
1、col配置参考
{
"cols": 12, "md": 6
}
2、全局配置参考
{
"refresh": 10, // 自动刷新时间,单位秒
"border": True, // 是否显示边框默认True为False时取消组件边框和边距由插件自行控制
"title": "组件标题", // 组件标题,如有将显示该标题,否则显示插件名称
"subtitle": "组件子标题", // 组件子标题,缺省时不展示子标题
}
3、页面配置使用Vuetify组件拼装参考https://vuetifyjs.com/
kwargs参数可获取的值1、user_agent浏览器UA
:param key: 仪表盘key根据指定的key返回相应的仪表盘数据缺省时返回一个固定的仪表盘数据兼容旧版
"""
clash_available = bool(self._clash_dashboard_url and self._clash_dashboard_secret)
components = {'clash_info': {'title': 'Clash Info', 'md': 4},
'traffic_stats': {'title': 'Traffic Stats', 'md': 8}}
col_config = {'cols': 12, 'md': components.get(key, {}).get('md', 4)}
global_config = {
'title': components.get(key, {}).get('title', 'Clash Info'),
'border': True,
'clash_available': clash_available,
'secret': self._clash_dashboard_secret,
}
return col_config, global_config, []
def get_page(self) -> List[dict]:
return []
@@ -401,6 +474,59 @@ class ClashRuleProvider(_PluginBase):
self._clash_rule_parser.parse_rules_from_list(self._top_rules)
self._ruleset_rule_parser.parse_rules_from_list(self._ruleset_rules)
async def clash_websocket(self, request: Request, endpoint: str, secret: str):
if secret != self._clash_dashboard_secret:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail=f"Secret 校验不通过"
)
if endpoint not in ['traffic', 'connections', 'memory']:
raise HTTPException(status_code=400, detail="Invalid endpoint")
queue = asyncio.Queue()
ws_base = self._clash_dashboard_url.replace('http://', 'ws://').replace('https://', 'wss://')
url = f"{ws_base}/{endpoint}?token={self._clash_dashboard_secret}"
async def clash_ws_listener():
try:
async with websockets.connect(url, ping_interval=None) as ws:
async for message in ws:
data = json.loads(message)
await queue.put(data)
except Exception as e:
await queue.put({"error": str(e)})
listener_task = asyncio.create_task(clash_ws_listener())
async def event_generator():
try:
while True:
if await request.is_disconnected():
break
try:
data = await queue.get()
yield {
'event': endpoint,
'data': json.dumps(data)
}
except asyncio.CancelledError:
break
finally:
listener_task.cancel() # 停止与 Clash 的连接
return EventSourceResponse(event_generator())
async def fetch_clash_data(self, endpoint: str) -> Dict:
clash_headers = {"Authorization": f"Bearer {self._clash_dashboard_secret}"}
url = f"{self._clash_dashboard_url}/{endpoint}"
async with httpx.AsyncClient() as client:
try:
response = await client.get(url, headers=clash_headers, timeout=5.0)
response.raise_for_status()
return response.json()
except httpx.HTTPError as e:
raise HTTPException(status_code=502, detail=f"Failed to fetch {endpoint}: {str(e)}")
async def clash_proxy(self, path: str) -> Dict:
return await self.fetch_clash_data(path)
def test_connectivity(self, params: Dict[str, Any]) -> schemas.Response:
if not self._enabled:
return schemas.Response(success=False, message="")
@@ -442,6 +568,7 @@ class ClashRuleProvider(_PluginBase):
"sub_url": f"{self._movie_pilot_url}/api/v1/plugin/ClashRuleProvider/config?"
f"apikey={settings.API_TOKEN}"}}
def get_clash_config(self):
config = self.clash_config()
if not config:
@@ -840,7 +967,7 @@ class ClashRuleProvider(_PluginBase):
logger.error(f"Invalid links: {self._sub_links}")
return False
url = self._sub_links[0]
logger.info(f"Refreshing: {url}")
logger.info(f"正在更新: {url}")
ret = None
for i in range(0, self._retry_times):
ret = RequestUtils(accept_type="text/html",
@@ -858,6 +985,7 @@ class ClashRuleProvider(_PluginBase):
if not proxies:
raise ValueError(f"Unknown content: {rs}")
rs = {'proxies': proxies, 'proxy-groups': [all_proxies, ]}
logger.info(f"已更新: {url}. 节点数量: {len(rs['proxies'])}")
if rs.get('rules') is None:
rs['rules'] = []
if self._discard_rules:

View File

@@ -713,7 +713,7 @@ class Converter:
cipher = vmess_data.get("scy", "auto") or "auto"
alter_id = vmess_data.get("aid", 0)
# 智能调整 network 类型
# 调整 network 类型
if fake_type == "http":
net = "http"
elif net == "http":
@@ -734,7 +734,7 @@ class Converter:
"network": net
}
# === TLS、Reality 扩展 ===
# TLS、Reality 扩展
if proxy["tls"]:
proxy["client-fingerprint"] = vmess_data.get("fp", "chrome") or "chrome"
alpn = vmess_data.get("alpn")
@@ -753,7 +753,7 @@ class Converter:
path = vmess_data.get("path", "/")
host = vmess_data.get("host")
# === 不同 network 的扩展字段处理 ===
# 不同 network 的扩展字段处理
if net == "tcp":
if fake_type == "http":
proxy["http-opts"] = {
@@ -854,8 +854,7 @@ class Converter:
return proxy
except Exception as e:
print(f"VLESS parse error: {e}")
return None
raise ValueError(f"VLESS parse error: {e}") from e
elif scheme == "trojan":
try:
parsed = urlparse(line)
@@ -908,7 +907,7 @@ class Converter:
proxies.append(trojan)
except Exception as e:
print(f"Error parsing trojan:// link: {e}")
raise ValueError(f"Error parsing trojan:// link: {e}") from e
elif scheme == "hysteria":
try:
parsed = urlparse(line)
@@ -948,7 +947,7 @@ class Converter:
proxies.append(hysteria)
except Exception as e:
print(f"Hysteria parse error: {e}")
raise ValueError(f"Hysteria parse error: {e}") from e
elif scheme in ("socks", "socks5", "socks5h"):
try:
parsed = urlparse(line)
@@ -969,7 +968,7 @@ class Converter:
}
proxies.append(proxy)
except Exception as e:
print(f"SOCKS5 parse error: {e}")
raise ValueError(f"SOCKS5 parse error: {e}") from e
elif scheme == "ss":
try:
# 兼容 ss://base64 或 ss://base64#name
@@ -999,7 +998,7 @@ class Converter:
}
proxies.append(proxy)
except Exception as e:
print(f"SS parse error: {e}")
raise ValueError(f"SS parse error: {e}") from e
elif scheme == "ssr":
try:
decoded = Converter.decode_base64(body).decode()
@@ -1034,7 +1033,7 @@ class Converter:
proxies.append(proxy)
except Exception as e:
print(f"SSR parse error: {e}")
raise ValueError(f"SSR parse error: {e}") from e
elif scheme == "tuic":
try:
parsed = urlparse(line)
@@ -1073,7 +1072,7 @@ class Converter:
proxies.append(proxy)
except Exception as e:
print(f"TUIC parse error: {e}")
raise ValueError(f"TUIC parse error: {e}") from e
elif scheme == "anytls":
try:
parsed = urlparse(line)
@@ -1103,7 +1102,7 @@ class Converter:
proxies.append(proxy)
except Exception as e:
print(f"AnyTLS parse error: {e}")
raise ValueError(f"AnyTLS parse error: {e}") from e
elif scheme in ("hysteria2", "hy2"):
try:
parsed = urlparse(line)
@@ -1134,7 +1133,7 @@ class Converter:
proxies.append(proxy)
except Exception as e:
print(f"Hysteria2 parse error: {e}")
raise ValueError(f"Hysteria2 parse error: {e}") from e
if not proxies:
raise ValueError("convert v2ray subscribe error: format invalid")

View File

@@ -40,6 +40,7 @@ const saving = ref(false);
const testing = ref(false);
const showClashSecret = ref(false);
const selectedCronOption = ref('6hours');
const dashboardComponents = ['Clash Info', 'Traffic Stats'];
// Test result state
const testResult = reactive({
@@ -70,6 +71,7 @@ const defaultConfig = {
refresh_delay: 5,
discard_rules: false,
enable_acl4ssr: false,
dashboard_components: [],
};
// 响应式配置对象
@@ -90,14 +92,15 @@ onMounted(() => {
});
// 验证函数
function isValidUrl(url) {
const isValidUrl = (urlString) => {
if (!urlString) return false;
try {
new URL(url);
return true
} catch {
return false
const url = new URL(urlString);
return url.protocol === 'http:' || url.protocol === 'https:';
} catch (e) {
return false;
}
}
};
function validateSubLinks(links) {
if (!links || links.length === 0) {
@@ -232,6 +235,7 @@ return (_ctx, _cache) => {
const _component_v_chip = _resolveComponent("v-chip");
const _component_v_combobox = _resolveComponent("v-combobox");
const _component_v_text_field = _resolveComponent("v-text-field");
const _component_v_select = _resolveComponent("v-select");
const _component_v_cron_field = _resolveComponent("v-cron-field");
const _component_v_expansion_panel_title = _resolveComponent("v-expansion-panel-title");
const _component_v_expansion_panel_text = _resolveComponent("v-expansion-panel-text");
@@ -256,7 +260,7 @@ return (_ctx, _cache) => {
}, {
default: _withCtx(() => [
_createVNode(_component_v_icon, { left: "" }, {
default: _withCtx(() => _cache[22] || (_cache[22] = [
default: _withCtx(() => _cache[23] || (_cache[23] = [
_createTextVNode("mdi-close")
])),
_: 1
@@ -267,7 +271,7 @@ return (_ctx, _cache) => {
]),
default: _withCtx(() => [
_createVNode(_component_v_card_title, null, {
default: _withCtx(() => _cache[21] || (_cache[21] = [
default: _withCtx(() => _cache[22] || (_cache[22] = [
_createTextVNode("Clash Rule Provider 插件配置")
])),
_: 1
@@ -293,11 +297,11 @@ return (_ctx, _cache) => {
ref_key: "form",
ref: form,
modelValue: isFormValid.value,
"onUpdate:modelValue": _cache[19] || (_cache[19] = $event => ((isFormValid).value = $event)),
"onUpdate:modelValue": _cache[20] || (_cache[20] = $event => ((isFormValid).value = $event)),
onSubmit: _withModifiers(saveConfig, ["prevent"])
}, {
default: _withCtx(() => [
_cache[33] || (_cache[33] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "基本设置", -1)),
_cache[35] || (_cache[35] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "基本设置", -1)),
_createVNode(_component_v_row, null, {
default: _withCtx(() => [
_createVNode(_component_v_col, {
@@ -311,7 +315,8 @@ return (_ctx, _cache) => {
label: "启用插件",
color: "primary",
inset: "",
hint: "启用后插件将开始监控和同步"
hint: "启用后插件将开始监控和同步",
density: "compact"
}, null, 8, ["modelValue"])
]),
_: 1
@@ -327,7 +332,8 @@ return (_ctx, _cache) => {
label: "启用代理",
color: "primary",
inset: "",
hint: "是否使用系统代理进行网络请求"
hint: "是否使用系统代理进行网络请求",
density: "compact"
}, null, 8, ["modelValue"])
]),
_: 1
@@ -343,7 +349,8 @@ return (_ctx, _cache) => {
label: "启用通知",
color: "primary",
inset: "",
hint: "执行完成后发送通知消息"
hint: "执行完成后发送通知消息",
density: "compact"
}, null, 8, ["modelValue"])
]),
_: 1
@@ -359,7 +366,8 @@ return (_ctx, _cache) => {
label: "自动更新订阅",
color: "primary",
inset: "",
hint: "定期自动更新Clash订阅配置"
hint: "定期自动更新Clash订阅配置",
density: "compact"
}, null, 8, ["modelValue"])
]),
_: 1
@@ -367,7 +375,7 @@ return (_ctx, _cache) => {
]),
_: 1
}),
_cache[34] || (_cache[34] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "订阅配置", -1)),
_cache[36] || (_cache[36] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "订阅配置", -1)),
_createVNode(_component_v_row, null, {
default: _withCtx(() => [
_createVNode(_component_v_col, { cols: "12" }, {
@@ -431,7 +439,7 @@ return (_ctx, _cache) => {
]),
_: 1
}),
_cache[35] || (_cache[35] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "Clash 面板设置", -1)),
_cache[37] || (_cache[37] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "Clash 面板设置", -1)),
_createVNode(_component_v_row, null, {
default: _withCtx(() => [
_createVNode(_component_v_col, { cols: "12" }, {
@@ -447,7 +455,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "primary" }, {
default: _withCtx(() => _cache[23] || (_cache[23] = [
default: _withCtx(() => _cache[24] || (_cache[24] = [
_createTextVNode("mdi-web")
])),
_: 1
@@ -458,7 +466,10 @@ return (_ctx, _cache) => {
]),
_: 1
}),
_createVNode(_component_v_col, { cols: "12" }, {
_createVNode(_component_v_col, {
cols: "12",
md: "6"
}, {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.clash_dashboard_secret,
@@ -473,7 +484,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "warning" }, {
default: _withCtx(() => _cache[24] || (_cache[24] = [
default: _withCtx(() => _cache[25] || (_cache[25] = [
_createTextVNode("mdi-key")
])),
_: 1
@@ -483,18 +494,48 @@ return (_ctx, _cache) => {
}, 8, ["modelValue", "append-inner-icon", "type"])
]),
_: 1
}),
_createVNode(_component_v_col, {
cols: "12",
md: "6"
}, {
default: _withCtx(() => [
_createVNode(_component_v_select, {
modelValue: config.dashboard_components,
"onUpdate:modelValue": _cache[9] || (_cache[9] = $event => ((config.dashboard_components) = $event)),
items: dashboardComponents,
label: "仪表盘组件",
"hide-details": "",
variant: "outlined",
multiple: "",
chips: "",
class: "mb-4",
hint: "添加仪表盘组件"
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "info" }, {
default: _withCtx(() => _cache[26] || (_cache[26] = [
_createTextVNode("mdi-view-dashboard")
])),
_: 1
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
})
]),
_: 1
}),
_cache[36] || (_cache[36] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "MoviePilot 设置", -1)),
_cache[38] || (_cache[38] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "MoviePilot 设置", -1)),
_createVNode(_component_v_row, null, {
default: _withCtx(() => [
_createVNode(_component_v_col, { cols: "12" }, {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.movie_pilot_url,
"onUpdate:modelValue": _cache[9] || (_cache[9] = $event => ((config.movie_pilot_url) = $event)),
"onUpdate:modelValue": _cache[10] || (_cache[10] = $event => ((config.movie_pilot_url) = $event)),
label: "MoviePilot URL",
variant: "outlined",
placeholder: "http://localhost:3001",
@@ -503,7 +544,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "success" }, {
default: _withCtx(() => _cache[25] || (_cache[25] = [
default: _withCtx(() => _cache[27] || (_cache[27] = [
_createTextVNode("mdi-movie")
])),
_: 1
@@ -517,18 +558,28 @@ return (_ctx, _cache) => {
]),
_: 1
}),
_cache[37] || (_cache[37] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "执行设置", -1)),
_cache[39] || (_cache[39] = _createElementVNode("div", { class: "text-subtitle-1 font-weight-bold mt-4 mb-2" }, "执行设置", -1)),
_createVNode(_component_v_row, null, {
default: _withCtx(() => [
_createVNode(_component_v_col, { cols: "12" }, {
default: _withCtx(() => [
_createVNode(_component_v_cron_field, {
modelValue: config.cron_string,
"onUpdate:modelValue": _cache[10] || (_cache[10] = $event => ((config.cron_string) = $event)),
"onUpdate:modelValue": _cache[11] || (_cache[11] = $event => ((config.cron_string) = $event)),
label: "执行周期",
placeholder: "0 4 * * *",
hint: "使用标准Cron表达式格式 (分 时 日 月 周)"
}, null, 8, ["modelValue"])
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "info" }, {
default: _withCtx(() => _cache[28] || (_cache[28] = [
_createTextVNode("mdi-clock-time-four-outline")
])),
_: 1
})
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}),
@@ -539,7 +590,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.timeout,
"onUpdate:modelValue": _cache[11] || (_cache[11] = $event => ((config.timeout) = $event)),
"onUpdate:modelValue": _cache[12] || (_cache[12] = $event => ((config.timeout) = $event)),
modelModifiers: { number: true },
label: "超时时间 (秒)",
variant: "outlined",
@@ -548,17 +599,7 @@ return (_ctx, _cache) => {
max: "300",
hint: "请求的超时时间",
rules: [v => v > 0 || '超时时间必须大于0']
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "warning" }, {
default: _withCtx(() => _cache[26] || (_cache[26] = [
_createTextVNode("mdi-timer")
])),
_: 1
})
]),
_: 1
}, 8, ["modelValue", "rules"])
}, null, 8, ["modelValue", "rules"])
]),
_: 1
}),
@@ -569,7 +610,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.retry_times,
"onUpdate:modelValue": _cache[12] || (_cache[12] = $event => ((config.retry_times) = $event)),
"onUpdate:modelValue": _cache[13] || (_cache[13] = $event => ((config.retry_times) = $event)),
modelModifiers: { number: true },
label: "重试次数",
variant: "outlined",
@@ -581,7 +622,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "info" }, {
default: _withCtx(() => _cache[27] || (_cache[27] = [
default: _withCtx(() => _cache[29] || (_cache[29] = [
_createTextVNode("mdi-refresh")
])),
_: 1
@@ -605,12 +646,12 @@ return (_ctx, _cache) => {
_createVNode(_component_v_expansion_panel_title, null, {
default: _withCtx(() => [
_createVNode(_component_v_icon, { class: "mr-2" }, {
default: _withCtx(() => _cache[28] || (_cache[28] = [
default: _withCtx(() => _cache[30] || (_cache[30] = [
_createTextVNode("mdi-cog")
])),
_: 1
}),
_cache[29] || (_cache[29] = _createTextVNode(" 高级选项 "))
_cache[31] || (_cache[31] = _createTextVNode(" 高级选项 "))
]),
_: 1
}),
@@ -625,7 +666,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_switch, {
modelValue: config.discard_rules,
"onUpdate:modelValue": _cache[13] || (_cache[13] = $event => ((config.discard_rules) = $event)),
"onUpdate:modelValue": _cache[14] || (_cache[14] = $event => ((config.discard_rules) = $event)),
label: "丢弃订阅规则",
color: "primary",
inset: "",
@@ -641,7 +682,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_switch, {
modelValue: config.enable_acl4ssr,
"onUpdate:modelValue": _cache[14] || (_cache[14] = $event => ((config.enable_acl4ssr) = $event)),
"onUpdate:modelValue": _cache[15] || (_cache[15] = $event => ((config.enable_acl4ssr) = $event)),
label: "ACL4SSR规则集",
color: "primary",
inset: "",
@@ -657,7 +698,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_switch, {
modelValue: config.group_by_region,
"onUpdate:modelValue": _cache[15] || (_cache[15] = $event => ((config.group_by_region) = $event)),
"onUpdate:modelValue": _cache[16] || (_cache[16] = $event => ((config.group_by_region) = $event)),
label: "按大洲分组节点",
color: "primary",
inset: "",
@@ -678,7 +719,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.ruleset_prefix,
"onUpdate:modelValue": _cache[16] || (_cache[16] = $event => ((config.ruleset_prefix) = $event)),
"onUpdate:modelValue": _cache[17] || (_cache[17] = $event => ((config.ruleset_prefix) = $event)),
label: "规则集前缀",
variant: "outlined",
placeholder: "📂<=",
@@ -687,7 +728,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "info" }, {
default: _withCtx(() => _cache[30] || (_cache[30] = [
default: _withCtx(() => _cache[32] || (_cache[32] = [
_createTextVNode("mdi-palette")
])),
_: 1
@@ -705,7 +746,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.acl4ssr_prefix,
"onUpdate:modelValue": _cache[17] || (_cache[17] = $event => ((config.acl4ssr_prefix) = $event)),
"onUpdate:modelValue": _cache[18] || (_cache[18] = $event => ((config.acl4ssr_prefix) = $event)),
label: "ACL4SSR 规则集前缀",
variant: "outlined",
placeholder: "🗂️=>",
@@ -714,7 +755,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "primary" }, {
default: _withCtx(() => _cache[31] || (_cache[31] = [
default: _withCtx(() => _cache[33] || (_cache[33] = [
_createTextVNode("mdi-palette")
])),
_: 1
@@ -732,7 +773,7 @@ return (_ctx, _cache) => {
default: _withCtx(() => [
_createVNode(_component_v_text_field, {
modelValue: config.refresh_delay,
"onUpdate:modelValue": _cache[18] || (_cache[18] = $event => ((config.refresh_delay) = $event)),
"onUpdate:modelValue": _cache[19] || (_cache[19] = $event => ((config.refresh_delay) = $event)),
modelModifiers: { number: true },
label: "刷新延迟",
variant: "outlined",
@@ -745,7 +786,7 @@ return (_ctx, _cache) => {
}, {
"prepend-inner": _withCtx(() => [
_createVNode(_component_v_icon, { color: "info" }, {
default: _withCtx(() => _cache[32] || (_cache[32] = [
default: _withCtx(() => _cache[34] || (_cache[34] = [
_createTextVNode("mdi-clock-outline")
])),
_: 1
@@ -780,7 +821,7 @@ return (_ctx, _cache) => {
class: "mb-6",
variant: "tonal"
}, {
default: _withCtx(() => _cache[38] || (_cache[38] = [
default: _withCtx(() => _cache[40] || (_cache[40] = [
_createTextVNode(" 配置说明参考: "),
_createElementVNode("a", {
href: "https://github.com/wumode/MoviePilot-Plugins/tree/main/plugins.v2/clashruleprovider/README.md",
@@ -797,12 +838,12 @@ return (_ctx, _cache) => {
}, {
default: _withCtx(() => [
_createVNode(_component_v_icon, { left: "" }, {
default: _withCtx(() => _cache[39] || (_cache[39] = [
default: _withCtx(() => _cache[41] || (_cache[41] = [
_createTextVNode("mdi-view-dashboard-edit")
])),
_: 1
}),
_cache[40] || (_cache[40] = _createTextVNode(" 规则 "))
_cache[42] || (_cache[42] = _createTextVNode(" 规则 "))
]),
_: 1
}),
@@ -810,7 +851,7 @@ return (_ctx, _cache) => {
color: "secondary",
onClick: resetForm
}, {
default: _withCtx(() => _cache[41] || (_cache[41] = [
default: _withCtx(() => _cache[43] || (_cache[43] = [
_createTextVNode("重置")
])),
_: 1
@@ -820,7 +861,7 @@ return (_ctx, _cache) => {
onClick: testConnection,
loading: testing.value
}, {
default: _withCtx(() => _cache[42] || (_cache[42] = [
default: _withCtx(() => _cache[44] || (_cache[44] = [
_createTextVNode("测试连接")
])),
_: 1
@@ -832,7 +873,7 @@ return (_ctx, _cache) => {
onClick: saveConfig,
loading: saving.value
}, {
default: _withCtx(() => _cache[43] || (_cache[43] = [
default: _withCtx(() => _cache[45] || (_cache[45] = [
_createTextVNode(" 保存配置 ")
])),
_: 1
@@ -847,7 +888,7 @@ return (_ctx, _cache) => {
variant: "tonal",
closable: "",
class: "ma-4 mt-0",
"onClick:close": _cache[20] || (_cache[20] = $event => (testResult.show = false))
"onClick:close": _cache[21] || (_cache[21] = $event => (testResult.show = false))
}, {
default: _withCtx(() => [
_createElementVNode("div", _hoisted_2, [
@@ -874,6 +915,6 @@ return (_ctx, _cache) => {
}
};
const ConfigComponent = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-c50374dc"]]);
const ConfigComponent = /*#__PURE__*/_export_sfc(_sfc_main, [['__scopeId',"data-v-bd2044a8"]]);
export { ConfigComponent as default };

View File

@@ -1,5 +1,5 @@
.plugin-config[data-v-c50374dc] {
.plugin-config[data-v-bd2044a8] {
max-width: 800px;
margin: 0 auto;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +0,0 @@
import { importShared } from './__federation_fn_import-JrT3xvdd.js';
import { _ as _export_sfc } from './_plugin-vue_export-helper-pcqpp-6-.js';
const _sfc_main = {};
const {openBlock:_openBlock,createElementBlock:_createElementBlock} = await importShared('vue');
const _hoisted_1 = { class: "dashboard-widget" };
function _sfc_render(_ctx, _cache) {
return (_openBlock(), _createElementBlock("div", _hoisted_1))
}
const DashboardComponent = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
export { DashboardComponent as default };

View File

@@ -0,0 +1,4 @@
.dashboard-widget[data-v-6c8bed46] {
font-family: 'Inter', sans-serif;
}

View File

@@ -1,14 +1,14 @@
.plugin-page[data-v-455476d4] {
.plugin-page[data-v-eae2a1d4] {
max-width: 1200px;
margin: 0 auto;
}
/* 使卡片等宽并适应移动端 */
.d-flex.flex-wrap[data-v-455476d4] {
.d-flex.flex-wrap[data-v-eae2a1d4] {
gap: 16px;
}
.url-display[data-v-455476d4] {
.url-display[data-v-eae2a1d4] {
word-break: break-all;
padding: 8px;
background: rgba(0, 0, 0, 0.05);
@@ -17,19 +17,19 @@
/* 移动端堆叠布局 */
@media (max-width: 768px) {
.d-flex.flex-wrap[data-v-455476d4] {
.d-flex.flex-wrap[data-v-eae2a1d4] {
flex-direction: column;
}
}
/* Add visual distinction between sections */
.ruleset-section[data-v-455476d4] {
.ruleset-section[data-v-eae2a1d4] {
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 16px;
background-color: #f5f5f5;
}
.top-section[data-v-455476d4] {
.top-section[data-v-eae2a1d4] {
border: 1px solid #e0e0e0;
border-radius: 4px;
padding: 16px;
@@ -37,12 +37,12 @@
}
/* Optional: Add different border colors to further distinguish */
.ruleset-section[data-v-455476d4] {
.ruleset-section[data-v-eae2a1d4] {
border-left: 4px solid #2196F3; /* Blue accent */
}
.top-section[data-v-455476d4] {
.top-section[data-v-eae2a1d4] {
border-left: 4px solid #4CAF50; /* Green accent */
}
.drag-handle[data-v-455476d4] {
.drag-handle[data-v-eae2a1d4] {
cursor: move;
}

View File

@@ -2,14 +2,14 @@ const currentImports = {};
const exportSet = new Set(['Module', '__esModule', 'default', '_export_sfc']);
let moduleMap = {
"./Page":()=>{
dynamicLoadingCss(["__federation_expose_Page-Djrrbsow.css"], false, './Page');
return __federation_import('./__federation_expose_Page-D_nruYha.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},
dynamicLoadingCss(["__federation_expose_Page-DQjiFgWw.css"], false, './Page');
return __federation_import('./__federation_expose_Page--ZdI8TQS.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},
"./Config":()=>{
dynamicLoadingCss(["__federation_expose_Config-BJvXq0hj.css"], false, './Config');
return __federation_import('./__federation_expose_Config-Btg4HYx3.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},
dynamicLoadingCss(["__federation_expose_Config-xrxN2F1l.css"], false, './Config');
return __federation_import('./__federation_expose_Config-sTz3W3yr.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},
"./Dashboard":()=>{
dynamicLoadingCss([], false, './Dashboard');
return __federation_import('./__federation_expose_Dashboard-DKtydfsT.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},};
dynamicLoadingCss(["__federation_expose_Dashboard-IipjE6HA.css"], false, './Dashboard');
return __federation_import('./__federation_expose_Dashboard-DEFRy9WP.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},};
const seen = {};
const dynamicLoadingCss = (cssFilePaths, dontAppendStylesToHead, exposeItemName) => {
const metaUrl = import.meta.url;

View File

@@ -0,0 +1,3 @@
websockets
httpx~=0.28.1
sse_starlette~=2.3.6