From 27ebdac034fca9da5da3ac99e93eabb4043c2aad Mon Sep 17 00:00:00 2001 From: Jz0ojiang Date: Wed, 12 Aug 2026 14:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=84=E5=88=99=E7=BB=84?= =?UTF-8?q?=E7=9A=84=E6=9D=A5=E6=BA=90=E5=8F=AA=E6=94=B6=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浏览器里填服务器上的本地路径既没法验证也容易写错,真有本地清单走 文件上传,落盘位置由 Patchbay 统一管。已有的 file 类型声明不受影响。 --- web/views/RuleGroupForm.vue | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/web/views/RuleGroupForm.vue b/web/views/RuleGroupForm.vue index c7d3ed7..b799b61 100644 --- a/web/views/RuleGroupForm.vue +++ b/web/views/RuleGroupForm.vue @@ -3,8 +3,10 @@ * 新增一个规则组(rule-providers 里的一条声明)。 * * 内容的拉取、缓存、定时更新全是内核的活,这里只写声明:URL 生成 http 类型, - * 本地路径生成 file 类型,缓存路径自动补一个确定的——不写 path 时内核按 url - * 哈希自己生成,那个路径这里算不出来。 + * 上传的清单生成 file 类型。来源不收本地路径——浏览器里填服务器上的路径既没法 + * 验证也容易写错,真有本地清单走文件上传,落盘位置由 Patchbay 统一管。 + * 缓存路径自动补一个确定的——不写 path 时内核按 url 哈希自己生成,那个路径 + * 这里算不出来。 */ import { computed, ref, watch } from 'vue' import { inferRuleFormat, ruleProviderPath } from '@shared/rules.ts' @@ -61,7 +63,7 @@ const mrsConflict = computed(() => format.value === 'mrs' && behavior.value === const canSubmit = computed( () => name.value.trim() !== '' && - (file.value !== null || source.value.trim() !== '') && + (file.value !== null || isUrl.value) && !nameTaken.value && !mrsConflict.value && !props.saving, @@ -95,16 +97,14 @@ function submit() { path: ruleProviderPath(trimmedName, format.value), format: format.value, } - : isUrl.value - ? { - type: 'http', - behavior: behavior.value, - url: trimmedSource, - path: ruleProviderPath(trimmedName, format.value), - format: format.value, - interval: 86400, - } - : { type: 'file', behavior: behavior.value, path: trimmedSource, format: format.value } + : { + type: 'http', + behavior: behavior.value, + url: trimmedSource, + path: ruleProviderPath(trimmedName, format.value), + format: format.value, + interval: 86400, + } emit('submit', { name: trimmedName, declaration, @@ -158,12 +158,12 @@ function onBackdrop(event: MouseEvent) { v-model="source" class="mono" type="text" - placeholder="https://… 或本地文件路径" + placeholder="https://example.com/rules.list" autocomplete="off" spellcheck="false" /> - - {{ isUrl ? 'http 类型,由内核定时拉取' : 'file 类型,读本机文件' }} + + 来源要是 http(s) 地址,本地清单走下面的文件导入