feat: add url search, update version

This commit is contained in:
putyy
2025-12-30 23:46:47 +08:00
committed by putyy
parent 8aaf95fd36
commit b562f76c69
7 changed files with 110 additions and 10 deletions

View File

@@ -23,7 +23,7 @@
</NIcon>
</template>
<div class="flex flex-col">
<div class="flex items-center justify-start p-1.5 cursor-pointer" v-if="row.Status === 'running'" @click="action('cancel')">
<div class="flex items-center justify-start p-1.5 cursor-pointer" v-if="row.Status === 'running' || row.Status === 'pending'" @click="action('cancel')">
<n-icon
size="28"
class="text-red-500 dark:text-red-300 bg-red-500/20 dark:bg-red-500/30 rounded-full flex items-center justify-center p-1.5 cursor-pointer hover:bg-red-500/40 transition-colors"

View File

@@ -120,7 +120,7 @@
"connections_tip": "Keep default if unsure, usually CPU cores * 2, for faster downloads",
"down_number": "Download Number",
"down_number_tip": "Number of downloads executed simultaneously",
"use_headers_tip": "Define headers for downloads, comma separated",
"use_headers_tip": "Default system filtering, Define headers for downloads, comma separated",
"mime_map": "Intercept Rules",
"mime_map_tip": "JSON format, keep default if unsure, please restart software after modification",
"domain_rule": "Domain Rule",

View File

@@ -120,7 +120,7 @@
"connections_tip": "如不清楚请保持默认通常CPU核心数*2用于加速下载",
"down_number": "下载数",
"down_number_tip": "同时进行的下载数量",
"use_headers_tip": "定义下载时可使用的header参数逗号分割",
"use_headers_tip": "默认系统过滤,定义下载时可使用的header参数逗号分割",
"mime_map": "拦截规则",
"mime_map_tip": "json格式如果不清楚保持默认就行修改后请重启软件",
"domain_rule": "域名规则",

View File

@@ -189,6 +189,10 @@ const filteredData = computed(() => {
result = result.filter(item => item.Description?.toLowerCase().includes(descriptionSearchValue.value.toLowerCase()))
}
if (urlSearchValue.value) {
result = result.filter(item => item.Url?.toLowerCase().includes(urlSearchValue.value.toLowerCase()))
}
return result
})
@@ -232,6 +236,7 @@ const classify = ref([
])
const descriptionSearchValue = ref("")
const urlSearchValue = ref("")
const rememberChoice = ref(false)
const rememberChoiceTmp = ref(false)
@@ -240,11 +245,49 @@ const columns = ref<any[]>([
type: "selection",
},
{
title: computed(() => {
return checkedRowKeysValue.value.length > 0 ? h(NGradientText, {type: "success"}, t("index.choice") + `(${checkedRowKeysValue.value.length})`) : t("index.domain")
}),
title: () => {
if (checkedRowKeysValue.value.length > 0) {
return h(NGradientText, {type: "success"}, t("index.choice") + `(${checkedRowKeysValue.value.length})`)
}
return h('div', {class: 'flex items-center'}, [
t('index.domain'),
h(NPopover, {
style: "--wails-draggable:no-drag",
trigger: 'click',
placement: 'bottom',
showArrow: true,
}, {
trigger: () => h(NIcon, {
size: "18",
class: `ml-1 cursor-pointer ${urlSearchValue.value ? "text-green-600": "text-gray-500"}`,
onClick: (e: MouseEvent) => e.stopPropagation()
}, h(SearchOutline)),
default: () => h('div', {class: 'p-2 w-64'}, [
h(NInput, {
value: urlSearchValue.value,
'onUpdate:value': (val: string) => urlSearchValue.value = val,
placeholder: t('index.search_description'),
clearable: true
}, {
prefix: () => h(NIcon, {component: SearchOutline})
})
])
})
])
},
key: "Domain",
width: 90,
render: (row: appType.MediaInfo) => {
return h(NTooltip, {
trigger: 'hover',
placement: 'top'
}, {
trigger: () => h('span', {
class: 'cursor-default'
}, row.Domain),
default: () => row.Url
})
}
},
{
title: computed(() => t("index.type")),
@@ -590,7 +633,17 @@ const dataAction = (row: appType.MediaInfo, index: number, type: string) => {
download(row, index)
break
case "cancel":
if (row.Status === "running") {
if (row.Status === "pending") {
const queueIndex = downloadQueue.value.findIndex(item => item.Id === row.Id)
if (queueIndex !== -1) {
downloadQueue.value.splice(queueIndex, 1)
}
updateItem(row.Id, item => {
item.Status = 'ready'
item.SavePath = ''
})
cacheData()
} else if (row.Status === "running") {
appApi.cancel({id: row.Id}).then((res) => {
updateItem(row.Id, item => {
item.Status = 'ready'
@@ -696,7 +749,21 @@ const batchCancel = async () => {
loading.value = true
const cancelTasks: Promise<any>[] = []
data.value.forEach((item, index) => {
if (checkedRowKeysValue.value.includes(item.Id) && item.Status === "running") {
if (!checkedRowKeysValue.value.includes(item.Id)) {
return
}
if (item.Status === "pending") {
const queueIndex = downloadQueue.value.findIndex(qItem => qItem.Id === item.Id)
if (queueIndex !== -1) {
downloadQueue.value.splice(queueIndex, 1)
}
item.Status = 'ready'
item.SavePath = ''
return
}
if (item.Status === "running") {
if (activeDownloads > 0) {
activeDownloads--
}