fix: keep subscription copy actions only

This commit is contained in:
JetSprow
2026-04-29 15:09:51 +10:00
parent df74723b52
commit cf658ac026
2 changed files with 4 additions and 31 deletions

View File

@@ -1,6 +1,5 @@
import { Download, ExternalLink, FileCode2, Link2 } from "lucide-react"; import { Link2 } from "lucide-react";
import { CopyButton } from "@/components/shared/copy-button"; import { CopyButton } from "@/components/shared/copy-button";
import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
interface SubscriptionImportActionsProps { interface SubscriptionImportActionsProps {
@@ -11,10 +10,6 @@ interface SubscriptionImportActionsProps {
compact?: boolean; compact?: boolean;
} }
function buildClashImportUrl(url: string) {
return `clash://install-config?url=${encodeURIComponent(url)}`;
}
export function withSubscriptionFormat(url: string, format: "base64" | "uri" | "clash") { export function withSubscriptionFormat(url: string, format: "base64" | "uri" | "clash") {
const separator = url.includes("?") ? "&" : "?"; const separator = url.includes("?") ? "&" : "?";
return `${url}${separator}format=${format}`; return `${url}${separator}format=${format}`;
@@ -24,11 +19,9 @@ export function SubscriptionImportActions({
genericUrl, genericUrl,
clashUrl, clashUrl,
title = "客户端导入", title = "客户端导入",
description = "Clash 使用 YAML 订阅;其他客户端可继续使用通用 Base64 链接。", description = "复制适配 Clash 的订阅 URL其他客户端可复制通用订阅 URL。",
compact = false, compact = false,
}: SubscriptionImportActionsProps) { }: SubscriptionImportActionsProps) {
const clashImportUrl = buildClashImportUrl(clashUrl);
return ( return (
<div className="rounded-2xl border border-border/70 bg-background/70 p-3 backdrop-blur"> <div className="rounded-2xl border border-border/70 bg-background/70 p-3 backdrop-blur">
<div className={cn("flex flex-col gap-3", compact ? "" : "lg:flex-row lg:items-center lg:justify-between")}> <div className={cn("flex flex-col gap-3", compact ? "" : "lg:flex-row lg:items-center lg:justify-between")}>
@@ -42,28 +35,8 @@ export function SubscriptionImportActions({
</p> </p>
</div> </div>
<div className="grid gap-2 sm:grid-cols-2 lg:flex lg:shrink-0 lg:flex-wrap lg:justify-end"> <div className="grid gap-2 sm:grid-cols-2 lg:flex lg:shrink-0 lg:flex-wrap lg:justify-end">
<a
href={clashImportUrl}
className={cn(buttonVariants({ size: "sm" }), "sm:col-span-2 lg:col-span-1")}
>
<ExternalLink className="size-3.5" /> Clash
</a>
<CopyButton text={clashUrl} label="复制 Clash" /> <CopyButton text={clashUrl} label="复制 Clash" />
<CopyButton text={genericUrl} label="复制通用" /> <CopyButton text={genericUrl} label="复制通用" />
<a
href={clashUrl}
download
className={buttonVariants({ variant: "outline", size: "sm" })}
>
<FileCode2 className="size-3.5" /> YAML
</a>
<a
href={genericUrl}
download
className={buttonVariants({ variant: "ghost", size: "sm" })}
>
<Download className="size-3.5" />
</a>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -18,7 +18,7 @@ import { getAggregateSubscriptionToken } from "@/services/subscription";
export const metadata: Metadata = { export const metadata: Metadata = {
title: "我的订阅", title: "我的订阅",
description: "管理活跃订阅,并 Clash、通用订阅等格式导入客户端。", description: "管理活跃订阅,并复制适配 Clash 与通用客户端的订阅 URL。",
}; };
export default async function SubscriptionsPage() { export default async function SubscriptionsPage() {
@@ -39,7 +39,7 @@ export default async function SubscriptionsPage() {
<PageHeader <PageHeader
eyebrow="订阅管理" eyebrow="订阅管理"
title="我的订阅" title="我的订阅"
description="总订阅链接负责导入全部代理节点Clash 可一键导入 YAML其他客户端继续使用通用订阅。" description="总订阅链接负责导入全部代理节点;复制 Clash 或通用订阅 URL 后粘贴到客户端。"
/> />
<SubscriptionMetrics <SubscriptionMetrics