feat: 调整Frp版本筛选逻辑为平台下拉选择

将原有的两个架构开关替换为平台下拉筛选器,统一Frp相关文本表述,版本号升级至1.4.0
This commit is contained in:
Yuhang Wu
2026-10-26 09:56:55 +08:00
parent ffd0ef7935
commit fafc87f4c6
7 changed files with 69 additions and 34 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "frpcpilot",
"private": true,
"version": "1.3.2",
"version": "1.4.0",
"type": "module",
"scripts": {
"dev": "vite",
+2 -2
View File
@@ -174,8 +174,8 @@ fn emit_progress(
/// 获取 Frp 版本列表(返回所有架构的发行包,并合并本机已下载 / 已导入记录)
///
/// 前端根据「展示所有架构的 Frpc / Frps」开关在本地过滤,避免频繁请求
/// GitHub API 触发限流;默认仅展示当前运行平台由前端完成。
/// 前端根据平台下拉列表在本地过滤,避免频繁请求 GitHub API 触发限流;
/// 默认仅展示当前运行平台由前端完成。
#[tauri::command]
#[auto_collect_command]
pub async fn get_frp_releases(
+1 -1
View File
@@ -22,7 +22,7 @@ async function call<T>(command: string, args?: Record<string, unknown>): Promise
}
/**
* 获取 Frp 版本列表(返回所有架构,前端按开关过滤)
* 获取 Frp 版本列表(返回所有架构,前端按平台筛选)
*/
export function getFrpReleases() {
return call<FrpRelease[]>("get_frp_releases")
+1 -2
View File
@@ -11,7 +11,7 @@
<div class="mt-1 flex flex-wrap items-center gap-2">
<a-tag color="blue" class="!me-0">{{ release.platform }}</a-tag>
<a-tag class="!me-0">frpc</a-tag>
<a-tag v-if="showFrps" color="cyan" class="!me-0">frps</a-tag>
<a-tag color="cyan" class="!me-0">frps</a-tag>
</div>
</div>
</div>
@@ -93,7 +93,6 @@ import type { FrpDownloadProgress, FrpRelease } from "@/types/frp"
const props = defineProps<{
release: FrpRelease
progress?: FrpDownloadProgress | null
showFrps?: boolean
}>()
const emit = defineEmits<{
+6 -6
View File
@@ -25,7 +25,7 @@
"dashboard": "Dashboard",
"servers": "Servers",
"tunnels": "Tunnels",
"download": "Download frpc",
"download": "Frp Download",
"setting": "Settings"
},
"tray": {
@@ -62,7 +62,7 @@
"arch": "Architecture",
"ip": "IP address",
"frpcVersion": "Frpc version",
"frpcVersionEmpty": "No downloaded version yet. Download one from the Frpc download page first.",
"frpcVersionEmpty": "No downloaded version yet. Download one from the Frp download page first.",
"start": "One-click start",
"stop": "Stop",
"logs": "Live logs",
@@ -236,8 +236,8 @@
"frp": {
"refresh": "Refresh",
"import": "Import local",
"showAllArchFrpc": "All-arch Frpc",
"showAllArchFrps": "All-arch Frps",
"platformFilter": "Platform",
"allPlatforms": "All",
"empty": "No Frp release data. Click Refresh to retry.",
"downloaded": "Downloaded",
"local": "Local",
@@ -272,8 +272,8 @@
"intro": "FrpcPilot is a visual client for frp built with Tauri 2 + Vue 3 + TypeScript. Manage frpc versions, servers and tunnels through a friendly GUI — and say goodbye to hand-writing frpc.toml.",
"flowTitle": "How to use",
"flow": {
"step1Title": "Download frpc",
"step1Desc": "Open \"Download frpc\", grab the build for your platform and architecture, or import a local one.",
"step1Title": "Download Frp",
"step1Desc": "Open \"Frp Download\", grab the build for your platform and architecture, or import a local one.",
"step2Title": "Configure a server",
"step2Desc": "Add the frps address, port and auth token under \"Servers\", then enable one of them.",
"step3Title": "Configure tunnels",
+6 -6
View File
@@ -25,7 +25,7 @@
"dashboard": "仪表盘",
"servers": "服务器",
"tunnels": "隧道列表",
"download": "Frpc 下载",
"download": "Frp下载",
"setting": "设置"
},
"tray": {
@@ -62,7 +62,7 @@
"arch": "系统架构",
"ip": "IP 地址",
"frpcVersion": "Frpc 版本",
"frpcVersionEmpty": "暂无已下载版本,请先前往 Frpc 下载页面下载",
"frpcVersionEmpty": "暂无已下载版本,请先前往 Frp下载页面下载",
"start": "一键启动",
"stop": "停止",
"logs": "实时日志",
@@ -236,8 +236,8 @@
"frp": {
"refresh": "刷新",
"import": "导入本地",
"showAllArchFrpc": "所有架构 Frpc",
"showAllArchFrps": "所有架构 Frps",
"platformFilter": "架构",
"allPlatforms": "全部",
"empty": "暂无 Frp 版本数据,点击刷新重试",
"downloaded": "已下载",
"local": "本地",
@@ -272,8 +272,8 @@
"intro": "FrpcPilot 是一个基于 Tauri 2 + Vue 3 + TypeScript 打造的 frp 可视化客户端,帮你用图形界面管理 frpc 版本、服务器与隧道,从此告别手写 frpc.toml。",
"flowTitle": "使用流程",
"flow": {
"step1Title": "下载 frpc",
"step1Desc": "进入「Frpc 下载」,按平台与架构下载,或导入本地已有的 frpc。",
"step1Title": "下载 Frp",
"step1Desc": "进入「Frp下载」,按平台与架构下载,或导入本地已有的 frpc。",
"step2Title": "配置服务器",
"step2Desc": "在「服务器」中填写 frps 地址、端口与鉴权 Token,并启用其中一台。",
"step3Title": "配置隧道",
+52 -16
View File
@@ -10,13 +10,15 @@
</div>
<div class="flex flex-wrap items-center gap-x-5 gap-y-2">
<label class="flex cursor-pointer items-center gap-2 text-xs">
<a-switch v-model:checked="showAllArchFrpc" size="small" />
<span>{{ t("frp.showAllArchFrpc") }}</span>
</label>
<label class="flex cursor-pointer items-center gap-2 text-xs">
<a-switch v-model:checked="showAllArchFrps" size="small" />
<span>{{ t("frp.showAllArchFrps") }}</span>
<label class="flex items-center gap-2 text-xs">
<span class="shrink-0 opacity-70">{{ t("frp.platformFilter") }}</span>
<a-select
v-model:value="selectedPlatform"
:aria-label="t('frp.platformFilter')"
:options="platformOptions"
class="w-44"
size="small"
/>
</label>
<a-space>
@@ -41,7 +43,6 @@
:key="`${item.version}-${item.platform}-${item.file_name}`"
:release="item"
:progress="progressMap[item.file_name]"
:show-frps="showAllArchFrps"
@download="onDownload(item)"
@copy="onCopy(item)"
@delete="onDelete(item)"
@@ -71,21 +72,46 @@ defineOptions({ name: "Download" })
const loading = ref(false)
const importing = ref(false)
/** 是否展示所有架构的 Frpc */
const showAllArchFrpc = useStorage("frpcpilot:frp:allArchFrpc", false)
/** 是否作为 frp 下载器展示所有架构的 Frps */
const showAllArchFrps = useStorage("frpcpilot:frp:allArchFrps", false)
const ALL_PLATFORMS = "all"
const selectedPlatform = ref(ALL_PLATFORMS)
const platformInitialized = ref(false)
/** 后端返回的全部发行包(含所有架构) */
const allReleases = ref<FrpRelease[]>([])
/**
* 按开关过滤后的展示列表:
* 默认仅展示当前运行平台(以及已下载的记录);开启任一开关后展示所有架构。
* 从发行包数据中生成平台筛选项,首项固定为“全部”。
*/
const platformOptions = computed(() => [
{ value: ALL_PLATFORMS, label: t("frp.allPlatforms") },
...Array.from(new Set(allReleases.value.map((item) => item.platform)))
.sort((a, b) => a.localeCompare(b))
.map((platform) => ({ value: platform, label: platform })),
])
/** 按版本降序排列;同版本按平台稳定排序,保证“全部”视图按版本分组展示。 */
function compareReleases(a: FrpRelease, b: FrpRelease) {
const aVersion = (a.version.match(/\d+/g) ?? []).slice(0, 3).map(Number)
const bVersion = (b.version.match(/\d+/g) ?? []).slice(0, 3).map(Number)
for (let index = 0; index < 3; index += 1) {
const difference = (bVersion[index] ?? 0) - (aVersion[index] ?? 0)
if (difference !== 0) return difference
}
return (
b.published_at.localeCompare(a.published_at) ||
a.platform.localeCompare(b.platform) ||
a.file_name.localeCompare(b.file_name)
)
}
const releases = computed(() => {
if (showAllArchFrpc.value || showAllArchFrps.value) return allReleases.value
return allReleases.value.filter((item) => item.is_current || item.downloaded)
const filtered =
selectedPlatform.value === ALL_PLATFORMS
? allReleases.value
: allReleases.value.filter((item) => item.platform === selectedPlatform.value)
return [...filtered].sort(compareReleases)
})
/** 各发行包的下载进度(以文件名为键) */
@@ -101,6 +127,16 @@ async function refresh(silent = false) {
if (!silent) loading.value = true
try {
allReleases.value = (await getFrpReleases()) ?? []
if (!platformInitialized.value) {
selectedPlatform.value =
allReleases.value.find((item) => item.is_current)?.platform ?? ALL_PLATFORMS
platformInitialized.value = true
} else if (
selectedPlatform.value !== ALL_PLATFORMS &&
!allReleases.value.some((item) => item.platform === selectedPlatform.value)
) {
selectedPlatform.value = ALL_PLATFORMS
}
} catch (e) {
message.error(errMsg(e))
} finally {