Синк VPS, баланса, платежей и тарифов через Bearer-токен из личного кабинета. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const API_TYPES = ['billmanager', '4vps', 'macloud', 'vdsina', 'veesp', 'none'] as const
|
||||
export const API_TYPES = ['billmanager', '4vps', 'macloud', 'vdsina', 'veesp', 'ruvds', 'none'] as const
|
||||
export type ApiType = (typeof API_TYPES)[number]
|
||||
export const apiTypeSchema = z.enum(API_TYPES).optional().default('none')
|
||||
|
||||
export const SYNC_API_TYPES = ['billmanager', '4vps', 'macloud', 'vdsina', 'veesp'] as const
|
||||
export const SYNC_API_TYPES = ['billmanager', '4vps', 'macloud', 'vdsina', 'veesp', 'ruvds'] as const
|
||||
export type SyncApiType = (typeof SYNC_API_TYPES)[number]
|
||||
|
||||
export const USER_API_TYPES = ['macloud', 'vdsina'] as const
|
||||
@@ -17,6 +17,16 @@ export const USER_API_DEFAULT_BASE_URL: Record<UserApiType, string> = {
|
||||
|
||||
export const VEESP_DEFAULT_BASE_URL = 'https://secure.veesp.com/api'
|
||||
|
||||
export const RUVDS_DEFAULT_BASE_URL = 'https://api.ruvds.com'
|
||||
|
||||
export const TOKEN_API_TYPES = ['macloud', 'vdsina', 'ruvds'] as const
|
||||
export type TokenApiType = (typeof TOKEN_API_TYPES)[number]
|
||||
|
||||
export function isTokenApiType(apiType?: string | null): apiType is TokenApiType {
|
||||
const key = String(apiType || '').toLowerCase()
|
||||
return (TOKEN_API_TYPES as readonly string[]).includes(key)
|
||||
}
|
||||
|
||||
export function isUserApiType(apiType?: string | null): apiType is UserApiType {
|
||||
const key = String(apiType || '').toLowerCase()
|
||||
return (USER_API_TYPES as readonly string[]).includes(key)
|
||||
|
||||
@@ -39,6 +39,11 @@ export function parseUserApiToken(credentials: string | null | undefined): strin
|
||||
return String(credentials ?? '').trim()
|
||||
}
|
||||
|
||||
/** Bearer token для RuVDS API v2. */
|
||||
export function parseRuvdsToken(credentials: string | null | undefined): string {
|
||||
return String(credentials ?? '').trim()
|
||||
}
|
||||
|
||||
/** Собрать 4VPS-креды: panelId + API key. */
|
||||
export function buildFourVpsCredentials(panelId: string, apiKey: string): string {
|
||||
const pid = panelId.trim()
|
||||
|
||||
Reference in New Issue
Block a user