订阅列表可以调顺序

每行末尾两个箭头,鼠标划过那一行才显现。proxy-providers 是映射,顺序只
影响界面呈现,内核不看;交换的是两个用户订阅在映射里的位置,中间夹着的
链式副本留在原地——它们不在列表上,跟着挪只会把 diff 撑大。

顺序写在配置文件里,所以走保存链路,不是运行时动作。
This commit is contained in:
2026-08-14 14:06:11 +08:00
parent 23aa28fbea
commit 0f0ac3c4b7
4 changed files with 175 additions and 19 deletions
+17 -1
View File
@@ -13,6 +13,7 @@ import {
addFileSubscription,
addSubscription,
listSubscriptions,
moveSubscription,
providerNames,
removeSubscription,
renameSubscription,
@@ -272,6 +273,16 @@ async function check() {
}
}
/** 把一个订阅在列表里挪一位。顺序在配置文件里,所以要走 commit()。 */
async function move(name: string, delta: -1 | 1) {
if (saving.value) return
const before = clone()
const next = moveSubscription(before, name, delta)
// 到头了 moveSubscription 原样返回,这时不该发起一次什么都没改的保存
if (next === before) return
await commit(next, '顺序已保存')
}
const refreshingAll = ref(false)
/** 挨个让内核重新拉取所有订阅。失败的点名,成功的不逐个报。 */
@@ -326,7 +337,12 @@ async function refreshAll() {
</header>
<div class="split">
<ProviderList v-model:selected="selectedName" :rows="rows" />
<ProviderList
v-model:selected="selectedName"
:rows="rows"
:saving="saving"
@move="move"
/>
<SubscriptionDetail
v-if="selected"