feat(api, web): интеграция хостера 4VPS.SU — синк VPS, баланса и тарифов
Docker / build (push) Has been cancelled

Добавлен адаптер 4vps, обобщён pipeline синхронизации через ProviderAdapter и обновлён UI для Panel ID и API Key.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Denozordec
2026-06-29 01:13:50 +07:00
co-authored by Cursor
parent 05e7bf829e
commit 9be50aa03b
33 changed files with 1564 additions and 174 deletions
+33
View File
@@ -0,0 +1,33 @@
import type { schema } from '@cfdm/db'
import { parseFourVpsCredentials } from '@cfdm/shared/utils/api-credentials'
type AccountRow = typeof schema.providerAccounts.$inferSelect
type ProviderRow = typeof schema.providers.$inferSelect
export interface FourvpsSyncAccount extends AccountRow {
apiType: '4vps'
apiBaseUrl: string
panelId: number | null
apiKey: string
}
export function resolveFourvpsApi(
accountRow: AccountRow | null | undefined,
providerRow: ProviderRow | null | undefined,
): { apiType: string; apiBaseUrl: string } {
const apiType = String(providerRow?.apiType || accountRow?.apiType || '').trim()
const apiBaseUrl = String(providerRow?.apiBaseUrl || accountRow?.apiBaseUrl || '').trim()
return { apiType, apiBaseUrl }
}
export function fourvpsAccountRowForSync(
accountRow: AccountRow | null | undefined,
providerRow: ProviderRow | null | undefined,
): FourvpsSyncAccount | null {
if (!accountRow) return null
const { apiType, apiBaseUrl } = resolveFourvpsApi(accountRow, providerRow)
const cred = String(accountRow.apiCredentials || '').trim()
const { panelId, apiKey } = parseFourVpsCredentials(cred)
if (apiType !== '4vps' || !apiBaseUrl || !apiKey) return null
return { ...accountRow, apiType: '4vps', apiBaseUrl, panelId, apiKey }
}