fix(ui): сохранять точный выбор пира при экспорте WireGuard
This commit is contained in:
1 parent
4aa4726c6b
commit
425a77a1ca
8 files changed
+68
-10
No files matched your search
@@ -59,6 +59,7 @@ import {
|
||||
type ServerTileItem,
|
||||
} from "@/components/server-tile-rail"
|
||||
import { toast } from "sonner"
|
||||
import { selectWgExportPeer } from "@/lib/wg-export-peer"
|
||||
import { ConfigHistorySheet } from "@/components/config-history-sheet"
|
||||
import type { ConfigRevisionDto } from "@/lib/config-revisions"
|
||||
import {
|
||||
@@ -601,12 +602,14 @@ function WireGuardPageContent({ selectedServerId, selectedInterfaceId, allInterf
|
||||
exportPending.current = epoch
|
||||
setExportBusy(true)
|
||||
try {
|
||||
const peer = format === "peer-conf" ? selectWgExportPeer(exportIface.peers, exportPeerId) : undefined
|
||||
if (format === "peer-conf" && !peer) throw new Error("Выбранный пир не найден. Обновите список и выберите пира заново.")
|
||||
const res = await exportWireGuard(backendUrl, {
|
||||
serverId: exportIface.serverId,
|
||||
interfaceName: exportIface.name,
|
||||
format,
|
||||
includePrivateKey: format !== "peer-conf",
|
||||
peerId: format === "peer-conf" ? (exportPeerId ?? undefined) : undefined,
|
||||
peerId: peer?.rosId ?? peer?.id,
|
||||
})
|
||||
if (epoch !== exportEpoch.current) return
|
||||
setLiveExport((prev) => ({
|
||||
|
||||
Reference in new issue
Block a user