From 7d08f37248b069edadf35f8496029aad3341f21a Mon Sep 17 00:00:00 2001 From: Jz0ojiang Date: Wed, 12 Aug 2026 00:13:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E5=88=99=E8=A1=A8=E5=8D=95=EF=BC=9A?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=80=99=E9=80=89=E8=A1=A5=E5=85=A8=E4=B8=BA?= =?UTF-8?q?=E5=86=85=E6=A0=B8=E5=85=A8=E9=9B=86=EF=BC=8C=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E5=80=99=E9=80=89=E7=B2=BE=E7=AE=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 类型照抄内核解析器的 switch(rules/parser.go:17-98),37 种全给—— 候选列表是过滤式的,全集不构成负担,缺项才是。目标反着来:只建议 DIRECT 和 REJECT,策略组名手填——全列出来的话,每路入站自动生成的 三个专属组会把列表灌成一面墙。 按原文编辑的输入框给一个完整的逻辑规则做占位例子(原文模式存在的 理由就是这类规则)。弹层滚动条改细杆透明轨道。 --- web/components/ComboBox.vue | 3 ++ web/components/SelectBox.vue | 3 ++ web/components/SourcePicker.vue | 3 ++ web/views/RuleForm.vue | 50 +++++++++++++++++++++++++++------ web/views/RulesPage.vue | 1 - 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/web/components/ComboBox.vue b/web/components/ComboBox.vue index 520addc..89e8100 100644 --- a/web/components/ComboBox.vue +++ b/web/components/ComboBox.vue @@ -230,6 +230,9 @@ function onFocusOut(event: FocusEvent) { max-width: min(360px, calc(100vw - 2 * var(--s-4))); max-height: 200px; overflow-y: auto; + /* 细杆加透明轨道,别让弹层里出现一根系统灰滚动条 */ + scrollbar-width: thin; + scrollbar-color: var(--c-border-strong) transparent; list-style: none; margin: 0; padding: var(--s-1); diff --git a/web/components/SelectBox.vue b/web/components/SelectBox.vue index 0f8146c..652110c 100644 --- a/web/components/SelectBox.vue +++ b/web/components/SelectBox.vue @@ -242,6 +242,9 @@ function groupAt(index: number): string | null { max-width: min(360px, calc(100vw - 2 * var(--s-4))); max-height: 200px; overflow-y: auto; + /* 细杆加透明轨道,别让弹层里出现一根系统灰滚动条 */ + scrollbar-width: thin; + scrollbar-color: var(--c-border-strong) transparent; list-style: none; margin: 0; padding: var(--s-1); diff --git a/web/components/SourcePicker.vue b/web/components/SourcePicker.vue index 021b4ff..92aaede 100644 --- a/web/components/SourcePicker.vue +++ b/web/components/SourcePicker.vue @@ -238,6 +238,9 @@ function onFocusOut(event: FocusEvent) { max-width: min(360px, calc(100vw - 2 * var(--s-4))); max-height: 240px; overflow-y: auto; + /* 细杆加透明轨道,别让弹层里出现一根系统灰滚动条 */ + scrollbar-width: thin; + scrollbar-color: var(--c-border-strong) transparent; list-style: none; margin: 0; padding: var(--s-1); diff --git a/web/views/RuleForm.vue b/web/views/RuleForm.vue index 604e3cf..2235787 100644 --- a/web/views/RuleForm.vue +++ b/web/views/RuleForm.vue @@ -16,8 +16,6 @@ const props = defineProps<{ open: boolean /** 传了就是编辑:下标加原文;没传就是新增 */ editing: { index: number; raw: string } | null - /** 目标出站的候选:内置出站、策略组、自有线路。之外也允许手填 */ - outboundNames: string[] /** RULE-SET 载荷的候选:已声明的规则组 */ providerNames: string[] saving: boolean @@ -25,27 +23,56 @@ const props = defineProps<{ const emit = defineEmits<{ close: []; submit: [rule: string] }>() -/** 常见的规则类型。不在里面的手填,填了就自动按原文编辑。 */ -const COMMON_TYPES = [ +/** + * 内核认识的全部规则类型,照抄解析器的 switch(rules/parser.go:17-98), + * 按域名、地理、IP、端口、进程、入站、逻辑的次序排。 + */ +const RULE_TYPES = [ 'DOMAIN', 'DOMAIN-SUFFIX', 'DOMAIN-KEYWORD', + 'DOMAIN-REGEX', + 'DOMAIN-WILDCARD', 'GEOSITE', 'GEOIP', + 'SRC-GEOIP', 'IP-CIDR', 'IP-CIDR6', - 'IP-ASN', 'SRC-IP-CIDR', + 'IP-SUFFIX', + 'SRC-IP-SUFFIX', + 'IP-ASN', + 'SRC-IP-ASN', 'DST-PORT', 'SRC-PORT', 'IN-PORT', 'PROCESS-NAME', 'PROCESS-PATH', + 'PROCESS-NAME-REGEX', + 'PROCESS-PATH-REGEX', + 'PROCESS-NAME-WILDCARD', + 'PROCESS-PATH-WILDCARD', 'NETWORK', + 'UID', + 'DSCP', + 'IN-TYPE', + 'IN-USER', + 'IN-NAME', + 'REMATCH-NAME', + 'AND', + 'OR', + 'NOT', + 'SUB-RULE', 'RULE-SET', 'MATCH', ] +/** + * 目标的建议只给内置出站里日常用的两个。策略组名允许手填—— + * 全部列出来的话,每路入站自动生成的三个专属组会把列表灌成一面墙。 + */ +const TARGET_SUGGESTIONS = ['DIRECT', 'REJECT'] + const dialog = ref(null) const rawMode = ref(false) const raw = ref('') @@ -135,7 +162,14 @@ function submit() { @@ -144,7 +178,7 @@ function submit() { @@ -173,7 +207,7 @@ function submit() { diff --git a/web/views/RulesPage.vue b/web/views/RulesPage.vue index eeea541..89ec675 100644 --- a/web/views/RulesPage.vue +++ b/web/views/RulesPage.vue @@ -450,7 +450,6 @@ async function updateNow(name: string) {