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) 地址,本地清单走下面的文件导入