feat: Remove VLESS configuration download functionality and update Next.js type import path.
This commit is contained in:
parent
b336519122
commit
e412c33e0f
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
@ -380,11 +380,9 @@ type UserCenterOverviewTranslation = {
|
||||
copyLink: string
|
||||
copied: string
|
||||
downloadQr: string
|
||||
downloadConfig: string
|
||||
generating: string
|
||||
error: string
|
||||
missingUuid: string
|
||||
downloadTooltip: string
|
||||
warning: string
|
||||
macPath: string
|
||||
linuxPath: string
|
||||
@ -1033,12 +1031,9 @@ export const translations: Record<'en' | 'zh', Translation> = {
|
||||
copyLink: 'Copy link',
|
||||
copied: 'Link copied',
|
||||
downloadQr: 'Download QR',
|
||||
downloadConfig: 'Download config',
|
||||
generating: 'Generating QR code…',
|
||||
error: 'We could not generate the QR code. Try again later.',
|
||||
missingUuid: 'We could not locate your UUID. Refresh the page or sign in again.',
|
||||
downloadTooltip:
|
||||
'Your UUID is the only credential required to access this node. Keep it private and do not share it.\nmacOS: /opt/homebrew/etc/config.json\nLinux: /usr/local/etc/config.json',
|
||||
warning: 'Your UUID is the only credential required to access this node. Keep it private and do not share it.',
|
||||
macPath: '/opt/homebrew/etc/config.json',
|
||||
linuxPath: '/usr/local/etc/config.json',
|
||||
@ -1808,12 +1803,9 @@ export const translations: Record<'en' | 'zh', Translation> = {
|
||||
copyLink: '复制链接',
|
||||
copied: '链接已复制',
|
||||
downloadQr: '下载二维码',
|
||||
downloadConfig: '下载配置',
|
||||
generating: '二维码生成中…',
|
||||
error: '二维码生成失败,请稍后重试。',
|
||||
missingUuid: '无法获取您的 UUID,请刷新页面或重新登录。',
|
||||
downloadTooltip:
|
||||
'UUID 是访问节点的唯一凭证,请谨慎保存,勿随意分发。\nmacOS:/opt/homebrew/etc/config.json\nLinux:/usr/local/etc/config.json',
|
||||
warning: 'UUID 是访问节点的唯一凭证,请谨慎保存,勿随意分发。',
|
||||
macPath: '/opt/homebrew/etc/config.json',
|
||||
linuxPath: '/usr/local/etc/config.json',
|
||||
|
||||
@ -26,11 +26,9 @@ export type VlessQrCopy = {
|
||||
copyLink: string
|
||||
copied: string
|
||||
downloadQr: string
|
||||
downloadConfig: string
|
||||
generating: string
|
||||
error: string
|
||||
missingUuid: string
|
||||
downloadTooltip: string
|
||||
qrAlt: string
|
||||
}
|
||||
|
||||
@ -164,25 +162,7 @@ export default function VlessQrCard({ uuid, copy }: VlessQrCardProps) {
|
||||
document.body.removeChild(link)
|
||||
}, [qrDataUrl, effectiveNode?.name])
|
||||
|
||||
const handleDownloadConfig = useCallback(() => {
|
||||
const config = buildVlessConfig(uuid, effectiveNode)
|
||||
if (!config) {
|
||||
return
|
||||
}
|
||||
|
||||
const contents = serializeConfigForDownload(config)
|
||||
const blob = new Blob([contents], { type: 'application/json' })
|
||||
const url = URL.createObjectURL(blob)
|
||||
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = `xray-client-${effectiveNode?.name || 'config'}.json`
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
|
||||
URL.revokeObjectURL(url)
|
||||
}, [uuid, effectiveNode])
|
||||
|
||||
const isReady = Boolean(vlessUri && qrDataUrl && !generationError)
|
||||
const isDisabled = !vlessUri
|
||||
@ -303,17 +283,6 @@ export default function VlessQrCard({ uuid, copy }: VlessQrCardProps) {
|
||||
<QrCode className="h-3.5 w-3.5" />
|
||||
{copy.downloadQr}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleDownloadConfig}
|
||||
disabled={isDisabled}
|
||||
className="inline-flex items-center gap-2 rounded-md border border-[color:var(--color-surface-border)] px-3 py-2 text-xs font-medium text-[var(--color-text)] transition-colors hover:border-[color:var(--color-primary-border)] hover:text-[var(--color-primary)] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
title={copy.downloadTooltip}
|
||||
aria-label={copy.downloadTooltip}
|
||||
>
|
||||
<Download className="h-3.5 w-3.5" />
|
||||
{copy.downloadConfig}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user