Files
3x-ui/frontend/src/generated/zod.ts
T
71e38367c1 feat(sub): add Incy app-management parameters (#6650)
* feat(sub): add Incy app-management parameters

The panel already pushes a set of Happ headers, but INCY documents its own
lowercase header names and its own value domains, so a Happ-shaped payload gets
ignored by the client (per-app mode is bypass|proxy, not on|bypass, and
per-app-proxy-enable has no Happ counterpart at all). Add a sibling Incy path
that emits exactly the documented headers.

Covered, per https://docs.incy.cc/en/app-management/:
- profile-description, sort-order, support-email, announce-url, premium-url
- banner text/button/URL and the two hex colours
- hide-url, hide-check, no-limit-enabled
- per-app split tunnelling (enable/mode/list)
- TCP fragmentation (enable/length/interval/packets)
- UDP noise packets (enable/type/packet/delay)
- DoH pre-resolution (enable/domain/IP)

Each string setting is tri-state: an empty value omits the header, so an
untouched panel never overrides the subscriber's own choice in the app. Values
are validated against the documented domains and dropped when they do not
match, and non-ASCII text is base64-wrapped the way the docs require for
Cyrillic. INCY identifies itself as INCY/<version>/<platform>, which gates the
headers behind the same auto-detect switch the Happ path uses.

Headers the panel already emits for every client (Profile-Title, Support-Url,
Profile-Web-Page-Url, Announce, Profile-Update-Interval, Subscription-Userinfo)
and Incy's routing line are left as they are.

The Premium API (theme, defaultPingProtocol, fallbackHosts, ...) is a separate
encrypted endpoint and stays out of scope here.

* fix(sub): keep Incy per-app list entries separate on the wire

The Incy settings textarea takes one package per line, as Incy documents for
per-app-proxy-list, but the header path ran the value through
sanitizeHeaderValue, which deletes CR/LF. "com.google.chrome\norg.telegram.messenger"
reached the client as the single bogus package
"com.google.chromeorg.telegram.messenger", so per-app split tunnelling silently
matched no app. Join comma- or line-separated entries as CSV instead.

Also drop three tests that could not fail: TestIncyExcludesHappOnlyHeaders
(ApplyIncyHeaders has no path that emits Happ headers, and the non-Happ UA
gate is already pinned by TestApplyHappHeaders_Gating) and two UI tests that
only asserted updateSetting received the key the JSX passes it.

---------

Co-authored-by: DIMFLIX <dimflix@users.noreply.github.com>
Co-authored-by: MHSanaei <ho3ein.sanaei@gmail.com>
2026-09-27 01:06:17 +02:00

1161 lines
36 KiB
TypeScript

// Code generated by tools/openapigen. DO NOT EDIT.
import { z } from 'zod';
export const GeoKindSchema = z.string();
export type GeoKind = z.infer<typeof GeoKindSchema>;
export const OnlineAPISupportSchema = z.number().int();
export type OnlineAPISupport = z.infer<typeof OnlineAPISupportSchema>;
export const ProcessStateSchema = z.string();
export type ProcessState = z.infer<typeof ProcessStateSchema>;
export const ProtocolSchema = z.string();
export type Protocol = z.infer<typeof ProtocolSchema>;
export const addrFamilySchema = z.number().int();
export type addrFamily = z.infer<typeof addrFamilySchema>;
export const staticEgressResolverSchema = z.string();
export type staticEgressResolver = z.infer<typeof staticEgressResolverSchema>;
export const trafficLocalApplyActionSchema = z.number().int();
export type trafficLocalApplyAction = z.infer<typeof trafficLocalApplyActionSchema>;
export const transportBitsSchema = z.number().int();
export type transportBits = z.infer<typeof transportBitsSchema>;
export const AllSettingSchema = z.object({
datepicker: z.string(),
discordAdminIds: z.string(),
discordBotBackup: z.boolean(),
discordBotEnable: z.boolean(),
discordBotToken: z.string(),
discordChannelId: z.string(),
discordCpu: z.number().int().min(0).max(100),
discordEnabledEvents: z.string(),
discordLang: z.string(),
discordMemory: z.number().int().min(0).max(100),
discordRunTime: z.string(),
expireDiff: z.number().int().min(0),
externalSubUserAgent: z.string(),
externalTrafficInformEnable: z.boolean(),
externalTrafficInformURI: z.string(),
happLinkEnable: z.boolean(),
ipLimitAllowlist: z.string(),
ldapAutoCreate: z.boolean(),
ldapAutoDelete: z.boolean(),
ldapBaseDN: z.string(),
ldapBindDN: z.string(),
ldapDefaultExpiryDays: z.number().int().min(0),
ldapDefaultLimitIP: z.number().int().min(0),
ldapDefaultTotalGB: z.number().int().min(0),
ldapEnable: z.boolean(),
ldapFlagField: z.string(),
ldapHost: z.string(),
ldapInboundTags: z.string(),
ldapInsecureSkipVerify: z.boolean(),
ldapInvertFlag: z.boolean(),
ldapPassword: z.string(),
ldapPort: z.number().int().min(0).max(65535),
ldapSyncCron: z.string(),
ldapTruthyValues: z.string(),
ldapUseTLS: z.boolean(),
ldapUserAttr: z.string(),
ldapUserFilter: z.string(),
ldapVlessField: z.string(),
outboundDownThreshold: z.number().int().min(1).max(100),
pageSize: z.number().int().min(0).max(1000),
panelOutbound: z.string(),
realityScanCandidates: z.string(),
remarkTemplate: z.string(),
restartXrayOnClientDisable: z.boolean(),
sessionMaxAge: z.number().int().min(1).max(525600),
smtpCpu: z.number().int().min(0).max(100),
smtpEnable: z.boolean(),
smtpEnabledEvents: z.string(),
smtpEncryptionType: z.string(),
smtpFrom: z.string(),
smtpFromName: z.string(),
smtpHost: z.string(),
smtpMemory: z.number().int().min(0).max(100),
smtpPassword: z.string(),
smtpPort: z.number().int().min(1).max(65535),
smtpTo: z.string(),
smtpUsername: z.string(),
subAnnounce: z.string(),
subCalendarExpireInclusive: z.boolean(),
subCertFile: z.string(),
subClashAutoDetect: z.boolean(),
subClashEnable: z.boolean(),
subClashEnableRouting: z.boolean(),
subClashPath: z.string(),
subClashRules: z.string(),
subClashURI: z.string(),
subClashUserAgentRegex: z.string(),
subDomain: z.string(),
subEnable: z.boolean(),
subEnableRouting: z.boolean(),
subEncrypt: z.boolean(),
subExpiredTemplate: z.string(),
subHappAlwaysHwid: z.boolean(),
subHappAutoConnect: z.boolean(),
subHappAutoConnectType: z.string(),
subHappAutoDetect: z.boolean(),
subHappColorProfile: z.string(),
subHappExcludeApns: z.boolean(),
subHappExcludeRoutes: z.string(),
subHappFallbackUrl: z.string(),
subHappLocalProxyAuth: z.string(),
subHappNewUrl: z.string(),
subHappNoLimit: z.boolean(),
subHappNotificationExpire: z.boolean(),
subHappPerAppList: z.string(),
subHappPerAppMode: z.string(),
subHappPingType: z.string(),
subHappProviderId: z.string(),
subHappSubExpire: z.boolean(),
subHappSubExpireButtonLink: z.string(),
subHappSubInfoButtonLink: z.string(),
subHappSubInfoButtonText: z.string(),
subHappSubInfoColor: z.string(),
subHappSubInfoText: z.string(),
subHappTunMode: z.string(),
subHappTunType: z.string(),
subHideSettings: z.boolean(),
subIncyAnnounceUrl: z.string(),
subIncyAppAutoDetect: z.boolean(),
subIncyBannerBgColor: z.string(),
subIncyBannerButtonColor: z.string(),
subIncyBannerButtonText: z.string(),
subIncyBannerButtonUrl: z.string(),
subIncyBannerText: z.string(),
subIncyEnableRouting: z.boolean(),
subIncyFragmentInterval: z.string(),
subIncyFragmentLength: z.string(),
subIncyFragmentPackets: z.string(),
subIncyFragmentationEnable: z.string(),
subIncyHideCheck: z.string(),
subIncyHideUrl: z.string(),
subIncyNoLimitEnabled: z.string(),
subIncyNoisesDelay: z.string(),
subIncyNoisesEnable: z.string(),
subIncyNoisesPacket: z.string(),
subIncyNoisesType: z.string(),
subIncyPerAppEnable: z.string(),
subIncyPerAppList: z.string(),
subIncyPerAppMode: z.string(),
subIncyPremiumUrl: z.string(),
subIncyProfileDescription: z.string(),
subIncyResolveDnsDomain: z.string(),
subIncyResolveDnsIp: z.string(),
subIncyResolveEnable: z.string(),
subIncyRoutingRules: z.string(),
subIncySortOrder: z.string(),
subIncySupportEmail: z.string(),
subInfoNodeEnable: z.boolean(),
subJsonAlwaysArray: z.boolean(),
subJsonAutoDetect: z.boolean(),
subJsonDns: z.string(),
subJsonEnable: z.boolean(),
subJsonFinalMask: z.string(),
subJsonMux: z.string(),
subJsonObservatory: z.string(),
subJsonPath: z.string(),
subJsonRoutingRules: z.string(),
subJsonRules: z.string(),
subJsonURI: z.string(),
subJsonUserAgentRegex: z.string(),
subKeyFile: z.string(),
subListen: z.string(),
subPath: z.string(),
subPort: z.number().int().min(1).max(65535),
subProfileMode: z.string(),
subProfileUrl: z.string(),
subRoutingRules: z.string(),
subShowIdentityOnAllLinks: z.boolean(),
subSupportUrl: z.string(),
subThemeDir: z.string(),
subTitle: z.string(),
subTrafficDepletedTemplate: z.string(),
subURI: z.string(),
subUpdates: z.number().int().min(0).max(525600),
tgBotAPIServer: z.string(),
tgBotBackup: z.boolean(),
tgBotChatId: z.string(),
tgBotEnable: z.boolean(),
tgBotProxy: z.string(),
tgBotToken: z.string(),
tgCpu: z.number().int().min(0).max(100),
tgEnabledEvents: z.string(),
tgLang: z.string(),
tgMemory: z.number().int().min(0).max(100),
tgRunTime: z.string(),
timeLocation: z.string(),
trafficDiff: z.number().int().min(0).max(100),
trustedProxyCIDRs: z.string(),
twoFactorEnable: z.boolean(),
twoFactorToken: z.string(),
warpUpdateInterval: z.number().int().min(0),
webBasePath: z.string(),
webCertFile: z.string(),
webDomain: z.string(),
webKeyFile: z.string(),
webListen: z.string(),
webPort: z.number().int().min(1).max(65535),
});
export type AllSetting = z.infer<typeof AllSettingSchema>;
export const AllSettingViewSchema = z.object({
datepicker: z.string(),
discordAdminIds: z.string(),
discordBotBackup: z.boolean(),
discordBotEnable: z.boolean(),
discordBotToken: z.string(),
discordChannelId: z.string(),
discordCpu: z.number().int().min(0).max(100),
discordEnabledEvents: z.string(),
discordLang: z.string(),
discordMemory: z.number().int().min(0).max(100),
discordRunTime: z.string(),
expireDiff: z.number().int().min(0),
externalSubUserAgent: z.string(),
externalTrafficInformEnable: z.boolean(),
externalTrafficInformURI: z.string(),
happLinkEnable: z.boolean(),
hasApiToken: z.boolean(),
hasDiscordBotToken: z.boolean(),
hasLdapPassword: z.boolean(),
hasNordSecret: z.boolean(),
hasSmtpPassword: z.boolean(),
hasTgBotToken: z.boolean(),
hasTwoFactorToken: z.boolean(),
hasWarpSecret: z.boolean(),
ipLimitAllowlist: z.string(),
ldapAutoCreate: z.boolean(),
ldapAutoDelete: z.boolean(),
ldapBaseDN: z.string(),
ldapBindDN: z.string(),
ldapDefaultExpiryDays: z.number().int().min(0),
ldapDefaultLimitIP: z.number().int().min(0),
ldapDefaultTotalGB: z.number().int().min(0),
ldapEnable: z.boolean(),
ldapFlagField: z.string(),
ldapHost: z.string(),
ldapInboundTags: z.string(),
ldapInsecureSkipVerify: z.boolean(),
ldapInvertFlag: z.boolean(),
ldapPassword: z.string(),
ldapPort: z.number().int().min(0).max(65535),
ldapSyncCron: z.string(),
ldapTruthyValues: z.string(),
ldapUseTLS: z.boolean(),
ldapUserAttr: z.string(),
ldapUserFilter: z.string(),
ldapVlessField: z.string(),
outboundDownThreshold: z.number().int().min(1).max(100),
pageSize: z.number().int().min(0).max(1000),
panelOutbound: z.string(),
realityScanCandidates: z.string(),
remarkTemplate: z.string(),
restartXrayOnClientDisable: z.boolean(),
sessionMaxAge: z.number().int().min(1).max(525600),
smtpCpu: z.number().int().min(0).max(100),
smtpEnable: z.boolean(),
smtpEnabledEvents: z.string(),
smtpEncryptionType: z.string(),
smtpFrom: z.string(),
smtpFromName: z.string(),
smtpHost: z.string(),
smtpMemory: z.number().int().min(0).max(100),
smtpPassword: z.string(),
smtpPort: z.number().int().min(1).max(65535),
smtpTo: z.string(),
smtpUsername: z.string(),
subAnnounce: z.string(),
subCalendarExpireInclusive: z.boolean(),
subCertFile: z.string(),
subClashAutoDetect: z.boolean(),
subClashEnable: z.boolean(),
subClashEnableRouting: z.boolean(),
subClashPath: z.string(),
subClashRules: z.string(),
subClashURI: z.string(),
subClashUserAgentRegex: z.string(),
subDomain: z.string(),
subEnable: z.boolean(),
subEnableRouting: z.boolean(),
subEncrypt: z.boolean(),
subExpiredTemplate: z.string(),
subHappAlwaysHwid: z.boolean(),
subHappAutoConnect: z.boolean(),
subHappAutoConnectType: z.string(),
subHappAutoDetect: z.boolean(),
subHappColorProfile: z.string(),
subHappExcludeApns: z.boolean(),
subHappExcludeRoutes: z.string(),
subHappFallbackUrl: z.string(),
subHappLocalProxyAuth: z.string(),
subHappNewUrl: z.string(),
subHappNoLimit: z.boolean(),
subHappNotificationExpire: z.boolean(),
subHappPerAppList: z.string(),
subHappPerAppMode: z.string(),
subHappPingType: z.string(),
subHappProviderId: z.string(),
subHappSubExpire: z.boolean(),
subHappSubExpireButtonLink: z.string(),
subHappSubInfoButtonLink: z.string(),
subHappSubInfoButtonText: z.string(),
subHappSubInfoColor: z.string(),
subHappSubInfoText: z.string(),
subHappTunMode: z.string(),
subHappTunType: z.string(),
subHideSettings: z.boolean(),
subIncyAnnounceUrl: z.string(),
subIncyAppAutoDetect: z.boolean(),
subIncyBannerBgColor: z.string(),
subIncyBannerButtonColor: z.string(),
subIncyBannerButtonText: z.string(),
subIncyBannerButtonUrl: z.string(),
subIncyBannerText: z.string(),
subIncyEnableRouting: z.boolean(),
subIncyFragmentInterval: z.string(),
subIncyFragmentLength: z.string(),
subIncyFragmentPackets: z.string(),
subIncyFragmentationEnable: z.string(),
subIncyHideCheck: z.string(),
subIncyHideUrl: z.string(),
subIncyNoLimitEnabled: z.string(),
subIncyNoisesDelay: z.string(),
subIncyNoisesEnable: z.string(),
subIncyNoisesPacket: z.string(),
subIncyNoisesType: z.string(),
subIncyPerAppEnable: z.string(),
subIncyPerAppList: z.string(),
subIncyPerAppMode: z.string(),
subIncyPremiumUrl: z.string(),
subIncyProfileDescription: z.string(),
subIncyResolveDnsDomain: z.string(),
subIncyResolveDnsIp: z.string(),
subIncyResolveEnable: z.string(),
subIncyRoutingRules: z.string(),
subIncySortOrder: z.string(),
subIncySupportEmail: z.string(),
subInfoNodeEnable: z.boolean(),
subJsonAlwaysArray: z.boolean(),
subJsonAutoDetect: z.boolean(),
subJsonDns: z.string(),
subJsonEnable: z.boolean(),
subJsonFinalMask: z.string(),
subJsonMux: z.string(),
subJsonObservatory: z.string(),
subJsonPath: z.string(),
subJsonRoutingRules: z.string(),
subJsonRules: z.string(),
subJsonURI: z.string(),
subJsonUserAgentRegex: z.string(),
subKeyFile: z.string(),
subListen: z.string(),
subPath: z.string(),
subPort: z.number().int().min(1).max(65535),
subProfileMode: z.string(),
subProfileUrl: z.string(),
subRoutingRules: z.string(),
subShowIdentityOnAllLinks: z.boolean(),
subSupportUrl: z.string(),
subThemeDir: z.string(),
subTitle: z.string(),
subTrafficDepletedTemplate: z.string(),
subURI: z.string(),
subUpdates: z.number().int().min(0).max(525600),
tgBotAPIServer: z.string(),
tgBotBackup: z.boolean(),
tgBotChatId: z.string(),
tgBotEnable: z.boolean(),
tgBotProxy: z.string(),
tgBotToken: z.string(),
tgCpu: z.number().int().min(0).max(100),
tgEnabledEvents: z.string(),
tgLang: z.string(),
tgMemory: z.number().int().min(0).max(100),
tgRunTime: z.string(),
timeLocation: z.string(),
trafficDiff: z.number().int().min(0).max(100),
trustedProxyCIDRs: z.string(),
twoFactorEnable: z.boolean(),
twoFactorToken: z.string(),
warpUpdateInterval: z.number().int().min(0),
webBasePath: z.string(),
webCertFile: z.string(),
webDomain: z.string(),
webKeyFile: z.string(),
webListen: z.string(),
webPort: z.number().int().min(1).max(65535),
});
export type AllSettingView = z.infer<typeof AllSettingViewSchema>;
export const AmneziaWGLogsSchema = z.object({
events: z.array(z.string()),
peers: z.array(z.lazy(() => PeerActivitySchema)),
running: z.boolean(),
});
export type AmneziaWGLogs = z.infer<typeof AmneziaWGLogsSchema>;
export const ApiTokenSchema = z.object({
createdAt: z.number().int(),
enabled: z.boolean(),
expiresAt: z.number().int(),
id: z.number().int(),
name: z.string(),
scope: z.string(),
token: z.string(),
});
export type ApiToken = z.infer<typeof ApiTokenSchema>;
export const ApiTokenViewSchema = z.object({
createdAt: z.number().int(),
enabled: z.boolean(),
expiresAt: z.number().int(),
id: z.number().int(),
name: z.string(),
scope: z.string(),
token: z.string().optional(),
});
export type ApiTokenView = z.infer<typeof ApiTokenViewSchema>;
export const ClientSchema = z.object({
adTag: z.string().optional(),
allowedIPs: z.array(z.string()).optional(),
allowedIPsByInbound: z.record(z.number().int(), z.array(z.string())).optional(),
auth: z.string().optional(),
comment: z.string(),
created_at: z.number().int().optional(),
email: z.string(),
enable: z.boolean(),
expiryTime: z.number().int(),
flow: z.string().optional(),
forwardedPorts: z.string().optional(),
group: z.string().optional(),
id: z.string().optional(),
keepAlive: z.number().int().nullable().optional(),
limitIp: z.number().int(),
password: z.string().optional(),
preSharedKey: z.string().optional(),
privateKey: z.string().optional(),
publicKey: z.string().optional(),
reset: z.number().int(),
resetDay: z.number().int(),
resetMax: z.number().int(),
resetWeekday: z.number().int(),
reverse: z.lazy(() => ClientReverseSchema).nullable().optional(),
secret: z.string().optional(),
security: z.string(),
subId: z.string(),
tgId: z.number().int(),
totalGB: z.number().int(),
trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']).optional(),
trafficResetDay: z.number().int().min(1).max(31).optional(),
updated_at: z.number().int().optional(),
});
export type Client = z.infer<typeof ClientSchema>;
export const ClientInboundSchema = z.object({
clientId: z.number().int(),
createdAt: z.number().int(),
flowOverride: z.string(),
inboundId: z.number().int(),
});
export type ClientInbound = z.infer<typeof ClientInboundSchema>;
export const ClientPageResponseSchema = z.object({
filtered: z.number().int(),
groups: z.array(z.string()),
items: z.array(z.lazy(() => ClientSlimSchema)),
page: z.number().int(),
pageSize: z.number().int(),
summary: z.lazy(() => ClientsSummarySchema),
total: z.number().int(),
});
export type ClientPageResponse = z.infer<typeof ClientPageResponseSchema>;
export const ClientRecordSchema = z.object({
adTag: z.string(),
allowedIPs: z.string(),
auth: z.string(),
comment: z.string(),
createdAt: z.number().int(),
email: z.string(),
enable: z.boolean(),
expiryTime: z.number().int(),
flow: z.string(),
forwardedPorts: z.string(),
group: z.string(),
id: z.number().int(),
keepAlive: z.number().int(),
limitHwid: z.number().int(),
limitIp: z.number().int(),
password: z.string(),
preSharedKey: z.string(),
privateKey: z.string(),
publicKey: z.string(),
reset: z.number().int(),
resetDay: z.number().int(),
resetMax: z.number().int(),
resetWeekday: z.number().int(),
reverse: z.unknown(),
secret: z.string(),
security: z.string(),
subId: z.string(),
tgId: z.number().int(),
totalGB: z.number().int(),
trafficReset: z.string(),
trafficResetDay: z.number().int(),
updatedAt: z.number().int(),
uuid: z.string(),
});
export type ClientRecord = z.infer<typeof ClientRecordSchema>;
export const ClientRenewalPreviewSchema = z.object({
canRenew: z.boolean(),
delayedStart: z.boolean(),
nextExpiry: z.string(),
renewAt: z.string(),
renewals: z.number().int(),
suggestedExpiry: z.string(),
suggestedExpiryTime: z.number().int(),
timeZone: z.string(),
validThrough: z.string(),
});
export type ClientRenewalPreview = z.infer<typeof ClientRenewalPreviewSchema>;
export const ClientRenewalPreviewRequestSchema = z.object({
expiryTime: z.number().int(),
reset: z.number().int(),
resetCount: z.number().int(),
resetDay: z.number().int(),
resetMax: z.number().int(),
resetWeekday: z.number().int(),
});
export type ClientRenewalPreviewRequest = z.infer<typeof ClientRenewalPreviewRequestSchema>;
export const ClientReverseSchema = z.object({
tag: z.string(),
});
export type ClientReverse = z.infer<typeof ClientReverseSchema>;
export const ClientSlimSchema = z.object({
comment: z.string().optional(),
createdAt: z.number().int(),
email: z.string(),
enable: z.boolean(),
expiryTime: z.number().int(),
group: z.string().optional(),
inboundIds: z.array(z.number().int()),
limitHwid: z.number().int(),
limitIp: z.number().int(),
reset: z.number().int(),
resetDay: z.number().int(),
resetMax: z.number().int(),
resetWeekday: z.number().int(),
subId: z.string(),
totalGB: z.number().int(),
traffic: z.lazy(() => ClientTrafficSchema).nullable().optional(),
updatedAt: z.number().int(),
});
export type ClientSlim = z.infer<typeof ClientSlimSchema>;
export const ClientTrafficSchema = z.object({
down: z.number().int(),
email: z.string(),
enable: z.boolean(),
expiryTime: z.number().int(),
id: z.number().int(),
inboundId: z.number().int(),
lastOnline: z.number().int(),
lastSubFetch: z.number().int(),
reset: z.number().int(),
resetCount: z.number().int(),
resetDay: z.number().int(),
resetMax: z.number().int(),
resetWeekday: z.number().int(),
subId: z.string(),
total: z.number().int(),
up: z.number().int(),
uuid: z.string(),
});
export type ClientTraffic = z.infer<typeof ClientTrafficSchema>;
export const ClientsSummarySchema = z.object({
active: z.number().int(),
deactive: z.array(z.string()),
deactiveCount: z.number().int(),
depleted: z.array(z.string()),
depletedCount: z.number().int(),
expiring: z.array(z.string()),
expiringCount: z.number().int(),
online: z.array(z.string()),
onlineCount: z.number().int(),
total: z.number().int(),
});
export type ClientsSummary = z.infer<typeof ClientsSummarySchema>;
export const FallbackParentInfoSchema = z.object({
masterId: z.number().int(),
path: z.string().optional(),
});
export type FallbackParentInfo = z.infer<typeof FallbackParentInfoSchema>;
export const GeoCategorySchema = z.object({
attributes: z.array(z.string()),
code: z.string(),
entries: z.number().int(),
});
export type GeoCategory = z.infer<typeof GeoCategorySchema>;
export const GeoCategoryPageSchema = z.object({
items: z.array(z.lazy(() => GeoCategorySchema)),
total: z.number().int(),
});
export type GeoCategoryPage = z.infer<typeof GeoCategoryPageSchema>;
export const GeoEntrySchema = z.object({
kind: z.string(),
value: z.string(),
});
export type GeoEntry = z.infer<typeof GeoEntrySchema>;
export const GeoEntryPageSchema = z.object({
items: z.array(z.lazy(() => GeoEntrySchema)),
total: z.number().int(),
});
export type GeoEntryPage = z.infer<typeof GeoEntryPageSchema>;
export const GeoFileSchema = z.object({
categories: z.number().int(),
error: z.string().optional(),
kind: z.lazy(() => GeoKindSchema),
modifiedAt: z.number().int(),
name: z.string(),
size: z.number().int(),
});
export type GeoFile = z.infer<typeof GeoFileSchema>;
export const GeodataTokenIssueSchema = z.object({
code: z.string().optional(),
file: z.string().optional(),
reason: z.string(),
token: z.string(),
});
export type GeodataTokenIssue = z.infer<typeof GeodataTokenIssueSchema>;
export const HappLinkResultSchema = z.object({
encryptedLink: z.string(),
});
export type HappLinkResult = z.infer<typeof HappLinkResultSchema>;
export const HistoryOfSeedersSchema = z.object({
id: z.number().int(),
seederName: z.string(),
});
export type HistoryOfSeeders = z.infer<typeof HistoryOfSeedersSchema>;
export const HostSchema = z.object({
address: z.string(),
allowInsecure: z.boolean(),
alpn: z.array(z.string()),
cipherSuites: z.string(),
createdAt: z.number().int(),
echConfigList: z.string(),
excludeFromSubTypes: z.array(z.string()),
finalMask: z.string(),
fingerprint: z.string(),
groupId: z.string(),
hostHeader: z.string(),
id: z.number().int(),
inboundId: z.number().int(),
isDisabled: z.boolean(),
isHidden: z.boolean(),
keepSniBlank: z.boolean(),
mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
mihomoX25519: z.boolean(),
muxParams: z.unknown(),
nodeGuids: z.array(z.string()).optional(),
overrideSniFromAddress: z.boolean(),
path: z.string(),
pinnedPeerCertSha256: z.array(z.string()),
port: z.number().int().min(0).max(65535),
remark: z.string().max(256),
security: z.enum(['same', 'tls', 'none', 'reality']),
serverDescription: z.string().max(64),
shuffleHost: z.boolean(),
sni: z.string(),
sockoptParams: z.unknown(),
sortOrder: z.number().int(),
tags: z.array(z.string()),
updatedAt: z.number().int(),
verifyPeerCertByName: z.string(),
vlessRoute: z.string(),
});
export type Host = z.infer<typeof HostSchema>;
export const HostGroupSchema = z.object({
allowInsecure: z.boolean(),
alpn: z.array(z.string()),
cipherSuites: z.string(),
echConfigList: z.string(),
excludeFromSubTypes: z.array(z.string()),
finalMask: z.string(),
fingerprint: z.string(),
groupId: z.string(),
hostHeader: z.string(),
hosts: z.array(z.string()),
inboundIds: z.array(z.number().int()),
isDisabled: z.boolean(),
isHidden: z.boolean(),
keepSniBlank: z.boolean(),
mihomoIpVersion: z.enum(['dual', 'ipv4', 'ipv6', 'ipv4-prefer', 'ipv6-prefer']),
mihomoX25519: z.boolean(),
muxParams: z.string(),
nodeGuids: z.array(z.string()),
overrideSniFromAddress: z.boolean(),
path: z.string(),
pinnedPeerCertSha256: z.array(z.string()),
port: z.number().int().min(0).max(65535),
remark: z.string().max(256),
security: z.enum(['same', 'tls', 'none', 'reality']),
serverDescription: z.string().max(64),
shuffleHost: z.boolean(),
sni: z.string(),
sockoptParams: z.string(),
sortOrder: z.number().int(),
tags: z.array(z.string()),
verifyPeerCertByName: z.string(),
vlessRoute: z.string(),
});
export type HostGroup = z.infer<typeof HostGroupSchema>;
export const HwidSlotStatusSchema = z.object({
active: z.boolean(),
full: z.boolean(),
limit: z.number().int(),
registered: z.number().int(),
remaining: z.number().int(),
});
export type HwidSlotStatus = z.infer<typeof HwidSlotStatusSchema>;
export const InboundSchema = z.object({
clientStats: z.array(z.lazy(() => ClientTrafficSchema)),
disableFlow: z.boolean(),
down: z.number().int(),
enable: z.boolean(),
expiryTime: z.number().int(),
fallbackParent: z.lazy(() => FallbackParentInfoSchema).nullable().optional(),
id: z.number().int(),
lastTrafficResetTime: z.number().int(),
listen: z.string(),
nodeId: z.number().int().nullable().optional(),
originNodeGuid: z.string().optional(),
port: z.number().int().min(0).max(65535),
protocol: z.enum(['vmess', 'vless', 'trojan', 'shadowsocks', 'wireguard', 'hysteria', 'http', 'mixed', 'tunnel', 'tun', 'mtproto', 'amneziawg', 'tuic']),
remark: z.string(),
settings: z.unknown(),
shareAddr: z.string(),
shareAddrStrategy: z.enum(['node', 'listen', 'custom']),
sniffing: z.unknown(),
streamSettings: z.unknown(),
subSortIndex: z.number().int(),
tag: z.string(),
total: z.number().int(),
trafficReset: z.enum(['never', 'hourly', 'daily', 'weekly', 'monthly']),
trafficResetDay: z.number().int().min(1).max(31),
up: z.number().int(),
});
export type Inbound = z.infer<typeof InboundSchema>;
export const InboundClientIpsSchema = z.object({
clientEmail: z.string(),
id: z.number().int(),
ips: z.unknown(),
});
export type InboundClientIps = z.infer<typeof InboundClientIpsSchema>;
export const InboundFallbackSchema = z.object({
alpn: z.string(),
childId: z.number().int(),
dest: z.string(),
id: z.number().int(),
masterId: z.number().int(),
name: z.string(),
path: z.string(),
sortOrder: z.number().int(),
xver: z.number().int(),
});
export type InboundFallback = z.infer<typeof InboundFallbackSchema>;
export const InboundOptionSchema = z.object({
awgServer: z.lazy(() => ServerSettingsSchema).nullable().optional(),
enable: z.boolean(),
id: z.number().int(),
listen: z.string().optional(),
mtprotoDomain: z.string().optional(),
network: z.string().optional(),
nodeAddress: z.string().optional(),
nodeId: z.number().int().nullable().optional(),
port: z.number().int(),
protocol: z.string(),
remark: z.string(),
security: z.string().optional(),
shareAddr: z.string().optional(),
shareAddrStrategy: z.string().optional(),
ssMethod: z.string(),
tag: z.string(),
tlsFlowCapable: z.boolean(),
tuicServer: z.lazy(() => TuicServerSettingsSchema).nullable().optional(),
wgDns: z.string().optional(),
wgMtu: z.number().int().optional(),
wgPublicKey: z.string().optional(),
});
export type InboundOption = z.infer<typeof InboundOptionSchema>;
export const InboundTrafficSummarySchema = z.object({
down: z.number().int(),
enable: z.boolean(),
id: z.number().int(),
total: z.number().int(),
up: z.number().int(),
});
export type InboundTrafficSummary = z.infer<typeof InboundTrafficSummarySchema>;
export const LogEntrySchema = z.object({
DateTime: z.string(),
Email: z.string(),
Event: z.number().int(),
FromAddress: z.string(),
Inbound: z.string(),
Outbound: z.string(),
ToAddress: z.string(),
});
export type LogEntry = z.infer<typeof LogEntrySchema>;
export const MLDSA65ResponseSchema = z.object({
seed: z.string(),
verify: z.string(),
});
export type MLDSA65Response = z.infer<typeof MLDSA65ResponseSchema>;
export const MLKEM768ResponseSchema = z.object({
client: z.string(),
seed: z.string(),
});
export type MLKEM768Response = z.infer<typeof MLKEM768ResponseSchema>;
export const MsgSchema = z.object({
msg: z.string(),
obj: z.unknown(),
success: z.boolean(),
});
export type Msg = z.infer<typeof MsgSchema>;
export const NewUUIDResponseSchema = z.object({
uuid: z.string(),
});
export type NewUUIDResponse = z.infer<typeof NewUUIDResponseSchema>;
export const NodeSchema = z.object({
activeCount: z.number().int(),
address: z.string(),
allowPrivateAddress: z.boolean(),
basePath: z.string(),
clientCount: z.number().int(),
configDirty: z.boolean(),
configDirtyAt: z.number().int(),
cpuPct: z.number(),
createdAt: z.number().int(),
depletedCount: z.number().int(),
disabledCount: z.number().int(),
enable: z.boolean(),
guid: z.string(),
id: z.number().int(),
inboundCount: z.number().int(),
inboundSyncMode: z.enum(['all', 'selected']),
inboundTags: z.array(z.string()),
lastError: z.string(),
lastHeartbeat: z.number().int(),
latencyMs: z.number().int(),
memPct: z.number(),
name: z.string(),
netDown: z.number().int(),
netUp: z.number().int(),
onlineCount: z.number().int(),
outboundTag: z.string(),
panelVersion: z.string(),
parentGuid: z.string().optional(),
pinnedCertSha256: z.string(),
port: z.number().int().min(1).max(65535),
remark: z.string(),
scheme: z.enum(['http', 'https']),
status: z.string(),
tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
transitive: z.boolean().optional(),
updatedAt: z.number().int(),
uptimeSecs: z.number().int(),
xrayError: z.string(),
xrayState: z.string(),
xrayVersion: z.string(),
});
export type Node = z.infer<typeof NodeSchema>;
export const NodeMutationRequestSchema = z.object({
address: z.string(),
allowPrivateAddress: z.boolean(),
apiToken: z.string().nullable().optional(),
basePath: z.string(),
clearApiToken: z.boolean().optional(),
enable: z.boolean(),
id: z.number().int(),
inboundSyncMode: z.enum(['all', 'selected']),
inboundTags: z.array(z.string()),
name: z.string(),
outboundTag: z.string(),
pinnedCertSha256: z.string(),
port: z.number().int().min(1).max(65535),
remark: z.string(),
scheme: z.enum(['http', 'https']),
tlsVerifyMode: z.enum(['verify', 'skip', 'pin', 'mtls']),
});
export type NodeMutationRequest = z.infer<typeof NodeMutationRequestSchema>;
export const NodeViewSchema = z.object({
activeCount: z.number().int(),
address: z.string(),
allowPrivateAddress: z.boolean(),
basePath: z.string(),
clientCount: z.number().int(),
configDirty: z.boolean(),
configDirtyAt: z.number().int(),
cpuPct: z.number(),
createdAt: z.number().int(),
depletedCount: z.number().int(),
disabledCount: z.number().int(),
enable: z.boolean(),
guid: z.string(),
hasApiToken: z.boolean(),
id: z.number().int(),
inboundCount: z.number().int(),
inboundSyncMode: z.string(),
inboundTags: z.array(z.string()),
lastError: z.string(),
lastHeartbeat: z.number().int(),
latencyMs: z.number().int(),
memPct: z.number(),
name: z.string(),
netDown: z.number().int(),
netUp: z.number().int(),
onlineCount: z.number().int(),
outboundTag: z.string(),
panelVersion: z.string(),
parentGuid: z.string().optional(),
pinnedCertSha256: z.string(),
port: z.number().int(),
remark: z.string(),
scheme: z.string(),
status: z.string(),
tlsVerifyMode: z.string(),
transitive: z.boolean().optional(),
updatedAt: z.number().int(),
uptimeSecs: z.number().int(),
xrayError: z.string(),
xrayState: z.string(),
xrayVersion: z.string(),
});
export type NodeView = z.infer<typeof NodeViewSchema>;
export const OutboundTrafficsSchema = z.object({
down: z.number().int(),
id: z.number().int(),
tag: z.string(),
total: z.number().int(),
up: z.number().int(),
});
export type OutboundTraffics = z.infer<typeof OutboundTrafficsSchema>;
export const PanelUpdateStatusSchema = z.object({
exitCode: z.number().int(),
finishedAt: z.number().int(),
runId: z.string(),
state: z.string(),
});
export type PanelUpdateStatus = z.infer<typeof PanelUpdateStatusSchema>;
export const PeerActivitySchema = z.object({
allowedIPs: z.string(),
down: z.number().int(),
email: z.string(),
endpoint: z.string(),
handshake: z.number().int(),
inboundId: z.number().int(),
interface: z.string(),
online: z.boolean(),
tag: z.string(),
up: z.number().int(),
});
export type PeerActivity = z.infer<typeof PeerActivitySchema>;
export const ProbeResultUISchema = z.object({
cpuPct: z.number(),
error: z.string(),
latencyMs: z.number().int(),
memPct: z.number(),
panelVersion: z.string(),
status: z.string(),
uptimeSecs: z.number().int(),
xrayError: z.string(),
xrayState: z.string(),
xrayVersion: z.string(),
});
export type ProbeResultUI = z.infer<typeof ProbeResultUISchema>;
export const RealityScanResultSchema = z.object({
alpn: z.string(),
certChainBytes: z.number().int(),
certChainValid: z.boolean(),
certIssuer: z.string(),
certSubject: z.string(),
certValid: z.boolean(),
curveID: z.string(),
feasible: z.boolean(),
h2: z.boolean(),
host: z.string(),
ip: z.string(),
latencyMs: z.number().int(),
notAfter: z.string(),
port: z.number().int(),
privateTarget: z.boolean(),
reason: z.string(),
serverNames: z.array(z.string()),
target: z.string(),
tls13: z.boolean(),
tlsVersion: z.string(),
x25519: z.boolean(),
});
export type RealityScanResult = z.infer<typeof RealityScanResultSchema>;
export const ServerSettingsSchema = z.object({
contentPaddingAddition: z.string().optional(),
disableCookies: z.boolean(),
externalInterface: z.string().optional(),
h1: z.string(),
h2: z.string(),
h3: z.string(),
h4: z.string(),
headerProtectionKey: z.string().optional(),
i1: z.string().optional(),
i2: z.string().optional(),
i3: z.string().optional(),
i4: z.string().optional(),
i5: z.string().optional(),
ipv6Enabled: z.boolean().optional(),
ipv6ExternalInterface: z.string().optional(),
ipv6Subnet: z.string().optional(),
jc: z.number().int(),
jmax: z.number().int(),
jmin: z.number().int(),
keepaliveTimeout: z.string().optional(),
maxHandshakeAttempts: z.string().optional(),
mtu: z.number().int().optional(),
primaryDns: z.string(),
privateKey: z.string(),
publicKey: z.string(),
randomTrailers: z.boolean(),
rejectAfterTime: z.string().optional(),
rekeyAfterTime: z.string().optional(),
rekeyTimeout: z.string().optional(),
routeThroughXray: z.boolean().optional(),
s1: z.number().int(),
s2: z.number().int(),
s3: z.number().int(),
s4: z.number().int(),
secondaryDns: z.string(),
subnetCidr: z.number().int(),
subnetIp: z.string(),
});
export type ServerSettings = z.infer<typeof ServerSettingsSchema>;
export const SettingSchema = z.object({
id: z.number().int(),
key: z.string(),
value: z.string(),
});
export type Setting = z.infer<typeof SettingSchema>;
export const SponsorSchema = z.object({
enable: z.boolean().nullable().optional(),
id: z.string(),
link: z.string(),
logo: z.string().optional(),
name: z.string(),
slots: z.array(z.string()),
text: z.record(z.string(), z.string()),
title: z.record(z.string(), z.string()),
until: z.string(),
});
export type Sponsor = z.infer<typeof SponsorSchema>;
export const SponsorListSchema = z.object({
contact: z.string().optional(),
sponsors: z.array(z.lazy(() => SponsorSchema)),
});
export type SponsorList = z.infer<typeof SponsorListSchema>;
export const SubBalancerSchema = z.object({
createdAt: z.number().int(),
enabled: z.boolean(),
id: z.number().int(),
inboundIds: z.array(z.number().int()),
memberWeights: z.record(z.number().int(), z.number()).optional(),
remark: z.string().max(256),
sortOrder: z.number().int().min(1),
strategy: z.enum(['leastLoad', 'leastPing', 'random', 'roundRobin']),
updatedAt: z.number().int(),
});
export type SubBalancer = z.infer<typeof SubBalancerSchema>;
export const TrafficSchema = z.object({
Down: z.number().int(),
IsInbound: z.boolean(),
IsOutbound: z.boolean(),
Tag: z.string(),
Up: z.number().int(),
});
export type Traffic = z.infer<typeof TrafficSchema>;
export const TuicClientSettingsSchema = z.object({
email: z.string(),
password: z.string(),
uuid: z.string(),
});
export type TuicClientSettings = z.infer<typeof TuicClientSettingsSchema>;
export const TuicServerSettingsSchema = z.object({
alpn: z.array(z.string()),
authentication_timeout: z.number().int(),
certificate: z.string(),
congestion_control: z.string(),
log_level: z.string(),
max_idle_time: z.number().int(),
max_udp_relay_packet_size: z.number().int(),
private_key: z.string(),
sni: z.string().optional(),
udp_relay_mode: z.string(),
zero_rtt_handshake: z.boolean(),
});
export type TuicServerSettings = z.infer<typeof TuicServerSettingsSchema>;
export const UserSchema = z.object({
id: z.number().int(),
password: z.string(),
username: z.string(),
});
export type User = z.infer<typeof UserSchema>;