mirror of
https://github.com/VaalaCat/frp-panel.git
synced 2025-10-23 15:23:15 +08:00
23 lines
1.1 KiB
TypeScript
23 lines
1.1 KiB
TypeScript
import * as z from "zod"
|
|
import { Client, Server } from "./pb/common"
|
|
import { GetPlatformInfoResponse } from "./pb/api_user"
|
|
|
|
export const API_PATH = '/api/v1'
|
|
export const SET_TOKEN_HEADER = 'x-set-authorization'
|
|
export const X_CLIENT_REQUEST_ID = 'x-client-request-id'
|
|
export const LOCAL_STORAGE_TOKEN_KEY = 'token'
|
|
export const ZodPortSchema = z.coerce.number().min(1, {
|
|
message: "端口号不能小于 1",
|
|
}).max(65535, { message: "端口号不能大于 65535" })
|
|
export const ZodIPSchema = z.string().regex(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
|
|
{ message: "请输入正确的IP地址" })
|
|
export const ZodStringSchema = z.string().min(1,
|
|
{ message: "不能为空" })
|
|
export const ZodEmailSchema = z.string()
|
|
.min(1, { message: "不能为空" })
|
|
.email("是不是输错了邮箱地址呢?")
|
|
// .refine((e) => e === "abcd@fg.com", "This email is not in our database")
|
|
|
|
export const ExecCommandStr = <T extends Client | Server>(type: string, item: T, info: GetPlatformInfoResponse) => {
|
|
return `APP_GLOBAL_SECRET=${info.globalSecret} MASTER_RPC_HOST=${info.masterRpcHost} frp-panel ${type} -s ${item.secret} -i ${item.id}`
|
|
} |