- 首次启动落试用起点(DATA_DIR/.trial-start 0600 + 库内 settings 双写,取最早防分次续命);
窗口内 IsPro() 等效 Pro——日志分析/告警/AI 助手/审计全解锁,到期自动回免费版
- 防刷三层:时间戳双写(删任一不重发)+ 机器级指纹(machine-id / hostname+cpu,
故意不含 DATA_DIR 特征——目录特征会因删除重建漂移等于后门);指纹命中则落已过期起点
- LicenseStatusPayload 返回 trial{active,daysLeft} 与 plan=trial;
设置页授权区显示「Pro 试用中 · 剩余 N 天」提示条
- 单测:全新安装 14 天/到期回落/删时间戳重装不重发(指纹防刷)三用例
- 滥用评估:删库重装同机器被指纹拦截;换机器/VM 必然可重试(接受,Pro 功能零边际成本,
追杀到硬件级得不偿失);正式授权随时激活覆盖试用
29 lines
952 B
TypeScript
29 lines
952 B
TypeScript
import { http } from '../http'
|
|
|
|
export interface TrialInfo { active: boolean; daysLeft: number }
|
|
export interface LicenseInfo {
|
|
trial?: TrialInfo
|
|
plan: 'free' | 'pro'
|
|
edition?: string
|
|
instances?: number
|
|
customer?: string
|
|
expiresAt?: number
|
|
expired?: boolean
|
|
source?: 'hmac' | 'opsx' | string
|
|
planType?: string
|
|
maxDevices?: number
|
|
deprecationNotice?: string
|
|
inGrace?: boolean
|
|
graceDaysLeft?: number
|
|
lastVerifiedAt?: number
|
|
instanceId?: string
|
|
/** expired | over_instance | revoked — 非有效 Pro 时红条 */
|
|
invalidReason?: 'expired' | 'over_instance' | 'revoked' | string
|
|
}
|
|
export const licenseApi = {
|
|
status: () => http.get<{ license: LicenseInfo; pro: boolean; features: string[] }>('/system/license'),
|
|
activate: (key: string) => http.post<LicenseInfo>('/system/license/activate', { key }),
|
|
deactivate: () =>
|
|
http.post<{ offlineLocalOnly?: boolean; message?: string }>('/system/license/deactivate'),
|
|
}
|