Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf381d8034 | ||
|
|
f283b4eae0 | ||
|
|
78d4a7c3aa | ||
|
|
fb3f549acc | ||
|
|
336c41a90f | ||
|
|
5d9c2ca0c9 | ||
|
|
944c3f31b3 | ||
|
|
5b193181d1 | ||
|
|
b7461cee27 | ||
|
|
02bb727f33 | ||
|
|
9b7cc01c3a | ||
|
|
c21326eea8 | ||
|
|
98ca1a6190 | ||
|
|
7d1ad7a417 | ||
|
|
6067e9517e | ||
|
|
ccdf5bd19b | ||
|
|
a98c9a36ac | ||
|
|
40c930cdbb |
@@ -1,4 +1,4 @@
|
||||
// vfyfix — 修正 .vfy 壳头里的两个 CRC(crcV / crcFile)
|
||||
// vfyfix — 修正壳节(.load,旧产物 .vfy)头里的两个 CRC(crcV / crcFile)
|
||||
//
|
||||
// 场景:先用 verify 的加壳链路打壳(signed=false,壳会校验整文件 CRC),再用别的工具
|
||||
// (如 DogProtect)二次加壳。后者重写了 PE,壳一校验就退出。本工具在最后一步重算:
|
||||
@@ -27,7 +27,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
secName = ".vfy"
|
||||
secName = ".load"
|
||||
legacySecName = ".vfy"
|
||||
hdrSize = 48
|
||||
crcOff = 36
|
||||
)
|
||||
@@ -57,7 +58,7 @@ func main() {
|
||||
|
||||
var sec *pe.Section
|
||||
for _, s := range f.Sections {
|
||||
if strings.HasPrefix(s.Name, secName) {
|
||||
if strings.HasPrefix(s.Name, secName) || strings.HasPrefix(s.Name, legacySecName) {
|
||||
sec = s
|
||||
}
|
||||
}
|
||||
@@ -80,7 +81,7 @@ func main() {
|
||||
flags := binary.LittleEndian.Uint32(data[off+32:])
|
||||
oldV := binary.LittleEndian.Uint32(data[off+crcOff:])
|
||||
oldF := binary.LittleEndian.Uint32(data[off+crcOff+4:])
|
||||
fmt.Printf("%s\n .vfy 文件偏移=0x%x 原始大小=%d flags=0x%x(bit1=%d)\n", path, off, rawSize, flags, (flags>>1)&1)
|
||||
fmt.Printf("%s\n 壳节 %s 文件偏移=0x%x 原始大小=%d flags=0x%x(bit1=%d)\n", path, sec.Name, off, rawSize, flags, (flags>>1)&1)
|
||||
fmt.Printf(" 旧: crcV=%08x crcFile=%08x\n", oldV, oldF)
|
||||
|
||||
// ---- 重算 crcV:节内跳过 36..44 ----
|
||||
|
||||
@@ -240,6 +240,16 @@ func runMigrations() {
|
||||
// 导致心跳写设备时 Error 1265 Data truncated,设备表永远是空的。
|
||||
fixDeviceIDColumnType()
|
||||
|
||||
// 登录方式开关(login_mode)上线:enforce 为空的历史行补成 warn(只记录不拦截),
|
||||
// 这样升级后行为完全不变,面板也能显示真实状态;管理员确认影响面后再切 strict。
|
||||
if DB.Migrator().HasTable(&model.Application{}) {
|
||||
if err := DB.Model(&model.Application{}).
|
||||
Where("login_mode_enforce IS NULL OR login_mode_enforce = ''").
|
||||
Update("login_mode_enforce", "warn").Error; err != nil {
|
||||
log.Printf("[WARN] 回填 applications.login_mode_enforce 失败: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 迁移后复核:仍有表不存在时明确打出来,避免后续写库时报 1146 无从排查
|
||||
for _, m := range models {
|
||||
if !DB.Migrator().HasTable(m) {
|
||||
|
||||
@@ -174,7 +174,11 @@ type Application struct {
|
||||
AppKey string `gorm:"unique;size:50" json:"app_key"`
|
||||
BillingType string `gorm:"size:20" json:"billing_type"`
|
||||
LoginPolicy string `gorm:"size:20;default:loose" json:"login_policy"`
|
||||
LoginMode string `gorm:"size:20;default:account" json:"login_mode"` // account = 账号密码, card = 单卡直登, both = 两种都开
|
||||
LoginMode string `gorm:"size:20;default:both" json:"login_mode"` // account = 账号密码, card = 单卡直登, both = 两种都开
|
||||
// 登录方式开关的生效级别:off = 不校验(旧行为), warn = 只记录不拦截(灰度用), strict = 真正拦截
|
||||
LoginModeEnforce string `gorm:"size:16;default:warn" json:"login_mode_enforce"`
|
||||
// 切换登录方式后的宽限期截止时间:在此之前旧凭证仍然可用(避免一刀切锁死存量用户)
|
||||
LoginModeGraceUntil *time.Time `json:"login_mode_grace_until"`
|
||||
CardLoginBindDevice bool `gorm:"default:true" json:"card_login_bind_device"` // 卡密登录是否也受设备上限约束
|
||||
CardLoginAllowPassword bool `gorm:"default:false" json:"card_login_allow_password"` // 卡密主体是否允许再设一个登录密码
|
||||
EncryptType string `gorm:"size:20" json:"encrypt_type"`
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
// Package protect:服务端给 PE 注入验证壳(改入口 + 内嵌壳 DLL + 双层 CRC32)
|
||||
//
|
||||
// 产物结构:原 exe 追加 .vfy 节 = [48B 头][引导 blob][壳 DLL][配置 JSON]
|
||||
// 入口指向 .vfy 内的引导代码;引导代码反射加载 DLL(零落盘)。
|
||||
// 产物结构:原 exe 追加 .load 节 = [48B 头][引导 blob][壳 DLL][配置 JSON]
|
||||
// 入口指向 .load 内的引导代码;引导代码反射加载 DLL(零落盘)。
|
||||
package protect
|
||||
|
||||
import (
|
||||
@@ -24,7 +24,8 @@ var assets embed.FS
|
||||
const (
|
||||
hdrSize = 48
|
||||
crcOff = 36
|
||||
secName = ".vfy"
|
||||
secName = ".load"
|
||||
legacySec = ".vfy" // 旧产物用 .vfy,检测时一并识别(新产物一律写 .load)
|
||||
shellVer = 8
|
||||
secAttrib = 0x60000020 // CODE | EXECUTE | READ
|
||||
)
|
||||
@@ -96,8 +97,8 @@ func AssetsThemed(arch, theme string) (blob, dll []byte, err error) {
|
||||
return blob, dll, nil
|
||||
}
|
||||
|
||||
// HasVfy 判断 PE 里是不是已经有 .vfy 节(已被加过壳)。
|
||||
// 二次加壳会在文件里留下两个 .vfy:旧壳的 cfg 指向老服务器、白占几百 KB,
|
||||
// HasVfy 判断 PE 里是不是已经有壳节(.load,或旧产物的 .vfy)。
|
||||
// 二次加壳会在文件里留下两个壳节:旧壳的 cfg 指向老服务器、白占几百 KB,
|
||||
// 目标机跳的却是新节,排查时极易被旧头误导,所以入口直接挡掉。
|
||||
func HasVfy(target []byte) bool {
|
||||
f, err := pe.NewFile(bytes.NewReader(target))
|
||||
@@ -106,7 +107,7 @@ func HasVfy(target []byte) bool {
|
||||
}
|
||||
defer f.Close()
|
||||
for _, s := range f.Sections {
|
||||
if strings.HasPrefix(s.Name, secName) {
|
||||
if strings.HasPrefix(s.Name, secName) || strings.HasPrefix(s.Name, legacySec) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func createTask(app *model.Application, userID uint, srcName string, data []byte
|
||||
return nil, "", err
|
||||
}
|
||||
if det.Kind == KindPE && HasVfy(data) {
|
||||
return nil, "", fmt.Errorf("这个文件已经是云端加密后的产物(带 .vfy 节),请上传未加密的原始程序")
|
||||
return nil, "", fmt.Errorf("这个文件已经是云端加密后的产物(带 .load/.vfy 节),请上传未加密的原始程序")
|
||||
}
|
||||
// 签名证书必须在建任务时就落库:execute 是 go 协程,事后 UPDATE 有窗口
|
||||
// 被它读到 NULL,导致证书被静默忽略(任务照样成功,只是没重签)。
|
||||
@@ -199,5 +199,5 @@ func infoMessage(info Info) string {
|
||||
if info.Note != "" {
|
||||
return info.Note
|
||||
}
|
||||
return fmt.Sprintf("入口 0x%x → 0x%x,.vfy RVA=0x%x", info.EntryOld, info.EntryNew, info.SecRVA)
|
||||
return fmt.Sprintf("入口 0x%x → 0x%x,壳节 RVA=0x%x", info.EntryOld, info.EntryNew, info.SecRVA)
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ func SetupApplicationRoutes(r *gin.RouterGroup) {
|
||||
applications.PUT("/:id", handleUpdateApplication)
|
||||
applications.DELETE("/:id", handleDeleteApplication)
|
||||
applications.GET("/:id", handleGetApplication)
|
||||
applications.GET("/:id/login-mode-impact", handleLoginModeImpact)
|
||||
applications.POST("/:id/icon", handleUploadIcon)
|
||||
applications.POST("/:id/upload", handleUploadVersionFile)
|
||||
applications.GET("/:id/versions", handleGetVersions)
|
||||
@@ -212,6 +213,8 @@ func handleCreateApplication(c *gin.Context) {
|
||||
EncryptKey: encryptKey,
|
||||
BillingType: req.BillingType,
|
||||
LoginPolicy: loginPolicy,
|
||||
LoginMode: "both", // 新建应用默认两种登录方式都开,避免上线即把某一类用户挡在门外
|
||||
LoginModeEnforce: "warn", // 默认只记录不拦截,管理员确认影响面后再切 strict
|
||||
EncryptType: encryptType,
|
||||
BindType: req.BindType,
|
||||
MaxDevices: maxDevices,
|
||||
@@ -302,6 +305,9 @@ func handleUpdateApplication(c *gin.Context) {
|
||||
BillingType string `form:"billing_type" json:"billing_type"`
|
||||
LoginPolicy string `form:"login_policy" json:"login_policy"`
|
||||
LoginMode string `form:"login_mode" json:"login_mode"`
|
||||
// 登录方式开关的生效级别与宽限期(前端「登录方式」卡片里的那两项)
|
||||
LoginModeEnforce string `form:"login_mode_enforce" json:"login_mode_enforce"`
|
||||
LoginModeGraceDays *int `form:"login_mode_grace_days" json:"login_mode_grace_days"`
|
||||
CardLoginBindDevice *bool `form:"card_login_bind_device" json:"card_login_bind_device"`
|
||||
CardLoginAllowPassword *bool `form:"card_login_allow_password" json:"card_login_allow_password"`
|
||||
AllowRegister bool `form:"allow_register" json:"allow_register"`
|
||||
@@ -378,12 +384,32 @@ func handleUpdateApplication(c *gin.Context) {
|
||||
if req.BillingType != "" {
|
||||
app.BillingType = req.BillingType
|
||||
}
|
||||
oldLoginMode := app.LoginMode
|
||||
if req.LoginMode != "" {
|
||||
switch req.LoginMode {
|
||||
case "account", "card", "both":
|
||||
app.LoginMode = req.LoginMode
|
||||
}
|
||||
}
|
||||
if req.LoginModeEnforce != "" {
|
||||
switch req.LoginModeEnforce {
|
||||
case "off", "warn", "strict":
|
||||
app.LoginModeEnforce = req.LoginModeEnforce
|
||||
}
|
||||
}
|
||||
// 宽限期:显式传了按传的算(0 = 立即生效,顺带清掉截止时间);
|
||||
// 没传但刚切换了登录方式,自动给 7 天,避免存量用户被一刀切挡在门外。
|
||||
if req.LoginModeGraceDays != nil {
|
||||
if *req.LoginModeGraceDays > 0 {
|
||||
until := time.Now().AddDate(0, 0, *req.LoginModeGraceDays)
|
||||
app.LoginModeGraceUntil = &until
|
||||
} else {
|
||||
app.LoginModeGraceUntil = nil
|
||||
}
|
||||
} else if req.LoginMode != "" && req.LoginMode != oldLoginMode {
|
||||
until := time.Now().AddDate(0, 0, 7)
|
||||
app.LoginModeGraceUntil = &until
|
||||
}
|
||||
if req.CardLoginBindDevice != nil {
|
||||
app.CardLoginBindDevice = *req.CardLoginBindDevice
|
||||
}
|
||||
@@ -1143,3 +1169,62 @@ func handleManualDeduct(c *gin.Context) {
|
||||
"message": "扣费成功",
|
||||
})
|
||||
}
|
||||
|
||||
// handleLoginModeImpact 登录方式切换的影响面。
|
||||
// 面板在把 login_mode 改成 account / card 之前先调这个,看清楚有多少主体会被挡住,
|
||||
// 再决定是「只记录」「开宽限期」还是「先跑迁移动作」。
|
||||
func handleLoginModeImpact(c *gin.Context) {
|
||||
userID := c.GetUint("user_id")
|
||||
|
||||
var app model.Application
|
||||
if err := database.DB.Where("id = ? AND user_id = ?", c.Param("id"), userID).First(&app).Error; err != nil {
|
||||
response.Error(c, 404, "应用不存在")
|
||||
return
|
||||
}
|
||||
|
||||
var total, cardSubjects, cardWithEmail, onlyAccount int64
|
||||
database.DB.Model(&model.AppUser{}).Where("application_id = ?", app.ID).Count(&total)
|
||||
|
||||
// 卡密主体的密码是建主体时写进去的随机散列(卡密才是它的钥匙),所以不能靠 password 是否为空判断。
|
||||
// 这里用「有没有绑邮箱」来区分:绑了邮箱的卡密主体有自助设密码的通道,没绑的只能靠卡密登录。
|
||||
database.DB.Model(&model.AppUser{}).
|
||||
Where("application_id = ? AND subject_type = ?", app.ID, "card").
|
||||
Count(&cardSubjects)
|
||||
database.DB.Model(&model.AppUser{}).
|
||||
Where("application_id = ? AND subject_type = ?", app.ID, "card").
|
||||
Where("email IS NOT NULL AND email <> ''").
|
||||
Count(&cardWithEmail)
|
||||
onlyCard := cardSubjects - cardWithEmail
|
||||
if onlyCard < 0 {
|
||||
onlyCard = 0
|
||||
}
|
||||
|
||||
// 仅账号主体:有账号但没绑任何「登录卡」→ 切到 card 后他们登不进来
|
||||
database.DB.Model(&model.AppUser{}).
|
||||
Where("application_id = ? AND subject_type = ?", app.ID, "account").
|
||||
Where("NOT EXISTS (SELECT 1 FROM cards WHERE cards.subject_id = app_users.id AND cards.purpose = ? AND cards.deleted_at IS NULL)", "credential").
|
||||
Count(&onlyAccount)
|
||||
|
||||
mode := service.AppLoginMode(&app)
|
||||
graceDays := service.LoginModeGraceDaysLeft(&app)
|
||||
blocking := (mode == "account" && onlyCard > 0) || (mode == "card" && onlyAccount > 0)
|
||||
|
||||
// 切换成该模式后会被挡住的人数(给前端直接显示,不用自己算)
|
||||
blockedIfSwitch := onlyCard
|
||||
if mode == "card" {
|
||||
blockedIfSwitch = onlyAccount
|
||||
}
|
||||
|
||||
response.Success(c, gin.H{
|
||||
"login_mode": mode,
|
||||
"login_mode_enforce": service.AppLoginModeEnforce(&app),
|
||||
"login_mode_grace_days": graceDays,
|
||||
"total_subjects": total,
|
||||
"card_subjects": cardSubjects,
|
||||
"card_subjects_with_email": cardWithEmail,
|
||||
"only_card_subjects": onlyCard,
|
||||
"only_account_subjects": onlyAccount,
|
||||
"blocking": blocking,
|
||||
"blocked_if_switch": blockedIfSwitch,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ func handleAppSendEmailCode(c *gin.Context) {
|
||||
}
|
||||
} else if req.Purpose == "bind_email" {
|
||||
// 卡密主体给自己绑邮箱:只在这类应用开启「允许卡密用户设密码」时给发码
|
||||
if !app.CardLoginAllowPassword && app.LoginMode != "card" && app.LoginMode != "both" {
|
||||
if !app.CardLoginAllowPassword {
|
||||
response.Error(c, 400, "该应用未开启卡密绑定邮箱")
|
||||
return
|
||||
}
|
||||
@@ -207,6 +207,19 @@ func handleAppRegister(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 卡密直登模式下注册出来的账号没有登录入口,直接挡掉(宽限期内放行,和登录 gate 保持一致)
|
||||
if service.AppLoginMode(appModel) == "card" && service.AppLoginModeEnforce(appModel) == "strict" && service.LoginModeGraceDaysLeft(appModel) == 0 {
|
||||
service.LogVerification(c, &appModel.ID, nil, "register_blocked",
|
||||
"注册被登录方式策略拦截: mode=card", "", fmt.Errorf("该应用仅支持卡密登录"))
|
||||
c.JSON(403, gin.H{
|
||||
"code": 403,
|
||||
"message": "该应用使用卡密登录,无需注册",
|
||||
"error_code": "LOGIN_MODE_DISABLED",
|
||||
"data": gin.H{"login_mode": "card", "allowed": []string{"card"}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
var req struct {
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
@@ -459,6 +472,40 @@ func handleAppLogin(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// 登录方式开关(login_mode):这是应用级登录策略,客户端界面只是体验,判定必须在服务端。
|
||||
// 位置故意放在查询主体、写设备绑定、记失败次数之前——被策略拒绝的请求不产生任何副作用。
|
||||
loginDeprecated := false
|
||||
graceDaysLeft := 0
|
||||
if !service.LoginTypeAllowedByMode(appModel, req.LoginType) {
|
||||
mode := service.AppLoginMode(appModel)
|
||||
switch service.AppLoginModeEnforce(appModel) {
|
||||
case "strict":
|
||||
if days := service.LoginModeGraceDaysLeft(appModel); days > 0 {
|
||||
// 宽限期内旧凭证仍然可用,只在响应里提醒用户尽快换钥匙
|
||||
loginDeprecated, graceDaysLeft = true, days
|
||||
log.Printf("[INFO] login_mode grace: app=%s mode=%s login_type=%s days_left=%d", appKey, mode, req.LoginType, days)
|
||||
} else {
|
||||
service.LogVerification(c, &appModel.ID, nil, "login_mode_blocked",
|
||||
"登录被登录方式策略拦截: mode="+mode+" login_type="+req.LoginType, req.DeviceID,
|
||||
fmt.Errorf("该应用仅允许: %s", strings.Join(service.AllowedLoginTypes(mode), ",")))
|
||||
c.JSON(403, gin.H{
|
||||
"code": 403,
|
||||
"message": service.LoginModeBlockMessage(mode),
|
||||
"error_code": "LOGIN_MODE_DISABLED",
|
||||
"data": gin.H{
|
||||
"login_mode": mode,
|
||||
"allowed": service.AllowedLoginTypes(mode),
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
case "warn":
|
||||
log.Printf("[WARN] login_mode(warn-only) 会拦截但已放行: app=%s mode=%s login_type=%s", appKey, mode, req.LoginType)
|
||||
_ = service.LogVerification(c, &appModel.ID, nil, "login_mode_blocked",
|
||||
"[warn-only] 登录方式与策略不符,已放行: mode="+mode+" login_type="+req.LoginType, req.DeviceID, nil)
|
||||
}
|
||||
}
|
||||
|
||||
var user model.AppUser
|
||||
cardAuth := false
|
||||
if req.LoginType == "card" {
|
||||
@@ -782,6 +829,14 @@ func handleAppLogin(c *gin.Context) {
|
||||
loginData["balance"] = user.Balance
|
||||
}
|
||||
|
||||
// 宽限期内的旧凭证登录:明确告诉壳/用户还剩几天,好引导换钥匙
|
||||
if loginDeprecated {
|
||||
loginData["deprecated_login"] = true
|
||||
loginData["grace_days_left"] = graceDaysLeft
|
||||
loginData["login_mode"] = service.AppLoginMode(appModel)
|
||||
loginData["allowed_login_types"] = service.AllowedLoginTypes(service.AppLoginMode(appModel))
|
||||
}
|
||||
|
||||
response.SuccessWithMessage(c, "登录成功", loginData)
|
||||
}
|
||||
|
||||
@@ -978,7 +1033,7 @@ func handleAppCardBind(c *gin.Context) {
|
||||
response.Error(c, 404, "应用不存在")
|
||||
return
|
||||
}
|
||||
if !app.CardLoginAllowPassword && app.LoginMode != "card" && app.LoginMode != "both" {
|
||||
if !app.CardLoginAllowPassword {
|
||||
response.Error(c, 400, "该应用未开启卡密绑定邮箱")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -252,7 +252,10 @@ func handleAppGetInfo(c *gin.Context) {
|
||||
"enable_free_period": app.EnableFreePeriod,
|
||||
"trial_days": app.TrialDays,
|
||||
"bind_type": app.BindType,
|
||||
"login_mode": app.LoginMode,
|
||||
"login_mode": service.AppLoginMode(&app),
|
||||
"login_mode_enforce": service.AppLoginModeEnforce(&app),
|
||||
"login_mode_grace_days": service.LoginModeGraceDaysLeft(&app),
|
||||
"allowed_login_types": service.AllowedLoginTypes(service.AppLoginMode(&app)),
|
||||
"card_login_bind_device": app.CardLoginBindDevice,
|
||||
"card_login_allow_password": app.CardLoginAllowPassword,
|
||||
})
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"verification-platform-backend/internal/model"
|
||||
)
|
||||
|
||||
// 登录方式开关(login_mode)的判定逻辑集中在这里,供 app 侧(登录/注册/信息下发)
|
||||
// 与 admin 侧(设置、影响面统计)共用。
|
||||
//
|
||||
// 设计约定:
|
||||
// - login_mode 是应用级**策略**,客户端界面只影响体验,真正的判定必须发生在服务端;
|
||||
// - 判定必须早于任何副作用(建绑定、记失败、改 last_login、触发风控锁定);
|
||||
// - 空值/非法值一律按 both 处理(fail-open),任何时候都不把用户锁在门外;
|
||||
// - 生效级别由 LoginModeEnforce 控制:off = 不校验,warn = 只记录,strict = 拦截;
|
||||
// - 处于宽限期(LoginModeGraceUntil 未过)时旧凭证仍可用,只在响应里带 deprecated 标记。
|
||||
|
||||
// AppLoginMode 归一化应用的登录方式;空值/未知值按 both 处理。
|
||||
func AppLoginMode(app *model.Application) string {
|
||||
if app == nil {
|
||||
return "both"
|
||||
}
|
||||
switch app.LoginMode {
|
||||
case "account", "card", "both":
|
||||
return app.LoginMode
|
||||
}
|
||||
return "both"
|
||||
}
|
||||
|
||||
// AllowedLoginTypes 返回该模式下允许的凭证类型。
|
||||
func AllowedLoginTypes(mode string) []string {
|
||||
switch mode {
|
||||
case "account":
|
||||
return []string{"account"}
|
||||
case "card":
|
||||
return []string{"card"}
|
||||
default:
|
||||
return []string{"account", "card"}
|
||||
}
|
||||
}
|
||||
|
||||
// AppLoginModeEnforce 归一化生效级别;空值/未知值按 off 处理,保证升级后行为不变。
|
||||
func AppLoginModeEnforce(app *model.Application) string {
|
||||
if app == nil {
|
||||
return "off"
|
||||
}
|
||||
switch app.LoginModeEnforce {
|
||||
case "off", "warn", "strict":
|
||||
return app.LoginModeEnforce
|
||||
}
|
||||
return "off"
|
||||
}
|
||||
|
||||
// LoginModeLabel 用于错误文案。
|
||||
func LoginModeLabel(mode string) string {
|
||||
switch mode {
|
||||
case "account":
|
||||
return "账号密码"
|
||||
case "card":
|
||||
return "卡密"
|
||||
default:
|
||||
return "账号密码或卡密"
|
||||
}
|
||||
}
|
||||
|
||||
// LoginModeGraceDaysLeft 返回宽限期剩余天数(向上取整);不在宽限期返回 0。
|
||||
func LoginModeGraceDaysLeft(app *model.Application) int {
|
||||
if app == nil || app.LoginModeGraceUntil == nil {
|
||||
return 0
|
||||
}
|
||||
d := time.Until(*app.LoginModeGraceUntil)
|
||||
if d <= 0 {
|
||||
return 0
|
||||
}
|
||||
days := int(math.Ceil(d.Hours() / 24))
|
||||
if days < 1 {
|
||||
days = 1
|
||||
}
|
||||
return days
|
||||
}
|
||||
|
||||
// LoginTypeAllowedByMode 判断某凭证类型在当前模式下是否允许。
|
||||
func LoginTypeAllowedByMode(app *model.Application, loginType string) bool {
|
||||
for _, t := range AllowedLoginTypes(AppLoginMode(app)) {
|
||||
if t == loginType {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// LoginModeBlockMessage 生成给终端用户看的拒绝文案。
|
||||
func LoginModeBlockMessage(mode string) string {
|
||||
switch mode {
|
||||
case "account":
|
||||
return "该应用仅支持账号密码登录"
|
||||
case "card":
|
||||
return "该应用仅支持卡密登录"
|
||||
default:
|
||||
return "该应用当前不支持的登录方式"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"verification-platform-backend/internal/model"
|
||||
)
|
||||
|
||||
func TestAppLoginModeNormalize(t *testing.T) {
|
||||
cases := []struct {
|
||||
in string
|
||||
want string
|
||||
}{
|
||||
{"account", "account"},
|
||||
{"card", "card"},
|
||||
{"both", "both"},
|
||||
{"", "both"}, // 空值按 both:任何情况下都不把用户锁在门外
|
||||
{"weird", "both"}, // 非法值同上
|
||||
}
|
||||
for _, c := range cases {
|
||||
app := &model.Application{LoginMode: c.in}
|
||||
if got := AppLoginMode(app); got != c.want {
|
||||
t.Fatalf("AppLoginMode(%q) = %q, want %q", c.in, got, c.want)
|
||||
}
|
||||
}
|
||||
if got := AppLoginMode(nil); got != "both" {
|
||||
t.Fatalf("AppLoginMode(nil) = %q, want both", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppLoginModeEnforceNormalize(t *testing.T) {
|
||||
cases := []struct {
|
||||
in string
|
||||
want string
|
||||
}{
|
||||
{"off", "off"},
|
||||
{"warn", "warn"},
|
||||
{"strict", "strict"},
|
||||
{"", "off"}, // 空值不拦截
|
||||
{"bogus", "off"}, // 非法值不拦截
|
||||
}
|
||||
for _, c := range cases {
|
||||
app := &model.Application{LoginModeEnforce: c.in}
|
||||
if got := AppLoginModeEnforce(app); got != c.want {
|
||||
t.Fatalf("AppLoginModeEnforce(%q) = %q, want %q", c.in, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoginTypeAllowedByMode(t *testing.T) {
|
||||
m := func(mode, enforce string) *model.Application {
|
||||
return &model.Application{LoginMode: mode, LoginModeEnforce: enforce}
|
||||
}
|
||||
cases := []struct {
|
||||
app *model.Application
|
||||
typ string
|
||||
allow bool
|
||||
}{
|
||||
{m("account", "strict"), "account", true},
|
||||
{m("account", "strict"), "card", false},
|
||||
{m("card", "strict"), "card", true},
|
||||
{m("card", "strict"), "account", false},
|
||||
{m("both", "strict"), "account", true},
|
||||
{m("both", "strict"), "card", true},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := LoginTypeAllowedByMode(c.app, c.typ); got != c.allow {
|
||||
t.Fatalf("mode=%s login_type=%s got %v want %v", c.app.LoginMode, c.typ, got, c.allow)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoginModeGraceDaysLeft(t *testing.T) {
|
||||
past := time.Now().Add(-1 * time.Hour)
|
||||
future := time.Now().Add(72 * time.Hour)
|
||||
if got := LoginModeGraceDaysLeft(&model.Application{LoginModeGraceUntil: nil}); got != 0 {
|
||||
t.Fatalf("nil grace = %d, want 0", got)
|
||||
}
|
||||
if got := LoginModeGraceDaysLeft(&model.Application{LoginModeGraceUntil: &past}); got != 0 {
|
||||
t.Fatalf("expired grace = %d, want 0", got)
|
||||
}
|
||||
if got := LoginModeGraceDaysLeft(&model.Application{LoginModeGraceUntil: &future}); got != 3 {
|
||||
t.Fatalf("72h grace = %d, want 3", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllowedLoginTypes(t *testing.T) {
|
||||
if got := len(AllowedLoginTypes("account")); got != 1 {
|
||||
t.Fatalf("account should allow 1 type, got %d", got)
|
||||
}
|
||||
if got := len(AllowedLoginTypes("card")); got != 1 {
|
||||
t.Fatalf("card should allow 1 type, got %d", got)
|
||||
}
|
||||
if got := len(AllowedLoginTypes("both")); got != 2 {
|
||||
t.Fatalf("both should allow 2 types, got %d", got)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,9 @@
|
||||
# 二次加壳(verify 壳 + 其他加壳器)实测结论
|
||||
> **壳节已改名**:2026-11 起产物里的壳节从 `.vfy` 改为 **`.load`**(`protect.go` 的 `secName`),
|
||||
> 旧产物的 `.vfy` 仍被识别(`HasVfy` 与 `cmd/vfyfix` 都同时接受两种名字)。
|
||||
> 原因是引导 blob 里的节名比较已按 `.load` 打补丁(x64 `blob64.bin` 偏移 `0x85/0x8b/0x91`:`76 66 79` → `6c 6f 61`,
|
||||
> x86 `blob32.bin` 偏移 `0x73/0x79/0x7f` 同理)—— 两者必须一起改,只改 Go 侧产物会启动即退(引导找不到壳节,`return 2`)。
|
||||
|
||||
|
||||
被测组合:`protect.Patch`(离线工具 `cmd/packtest`)打的 verify 壳产物 + DogProtect 加壳。
|
||||
运行环境 wine;`exit=124` 表示 GUI 起来在等 API(超时被杀),是**正常启动**的表现;
|
||||
@@ -19,6 +24,59 @@
|
||||
| 改造前:壳(默认)→ DogProtect | 13 ❌ | 整文件 CRC 与变长后的文件对不上 |
|
||||
| DogProtect → 壳(不论模式) | 222 ❌ | 引导把控制权交给 DogProtect 的 loader,交不过去 |
|
||||
|
||||
### 用当前壳资产(含设备管理页)重测 —— 功能级验证
|
||||
|
||||
上面那批是「能不能启动」;下面这批验证**双层产物里的壳功能是否完整**(2026-11 当前资产:
|
||||
`blob64.bin` 10,000 字节、`shell64_dui.bin` 907,264 字节,dark 皮肤):
|
||||
|
||||
```
|
||||
单层 dp_single.exe 957,440 字节 → wine exit=124
|
||||
双层 dp_double.exe(DogProtect 外挂)7,326,720 字节 → wine exit=124
|
||||
```
|
||||
|
||||
把双层产物接上 mock 服务端走完整流程,实测请求序列:
|
||||
|
||||
```
|
||||
POST /api/v1/app/dogtest/login {"login_type":"account","username":"123","password":"***",
|
||||
"device_id":"C36E-0A03-F08D","device_name":"VIAEON","device_type":"windows",
|
||||
"instance_id":"C36E-0A03-F08D"} ← 被 403 DEVICE_LIMIT 拦下
|
||||
→ 界面切到独立「设备管理」页(窗口 620×620、标题「设备管理 - dogtest」、3 行设备各带解绑按钮)
|
||||
点第 2 行「解绑」
|
||||
POST /api/v1/app/dogtest/unbind-device-with-auth {"username":"123","password":"***",
|
||||
"device_id":"BBBB-4444-5555-6666"} ← 第 2 台,不是最早那台
|
||||
POST /api/v1/app/dogtest/login … ← 解绑后自动重试
|
||||
```
|
||||
|
||||
结论:**DogProtect 外层不影响壳内的设备管理页、行内解绑、窗口放大与标题切换**,双层产物功能与单层一致。
|
||||
|
||||
### 分层证据(外层 / 内层到底谁在里面)
|
||||
|
||||
| 项目 | 单层(verify 壳) | 双层(verify 内 + DogProtect 外) |
|
||||
|---|---|---|
|
||||
| 入口 RVA | `0x10030` = `.vfy`(0x10000) + 48 字节头 | `0x4a7ce9` → 落在 DogProtect 新加的 `.UPX3` 段里 |
|
||||
| 节表 | … `.reloc@0xf000`, `.vfy@0x10000` | … `.UPX0@0xf000`, **`.vfy@0x10000`(原位不动)**, `.UPX1@0xf0000`, `.UPX2`, `.UPX3`, `.reloc` |
|
||||
| `.vfy` 内容 sha256(前16) | `4f48879143b676a7` | **`4f48879143b676a7`(完全相同)** |
|
||||
|
||||
也就是说:**verify 的验证壳(引导 + 壳 DLL + cfg)原封不动留在内层 `.vfy` 里**,
|
||||
DogProtect 只是把入口接管到自己的 loader 段、把原程序压缩/虚拟化后追加 `.UPX*`,
|
||||
解包完再把控制权交回「原入口」—— 那个原入口正是 `.vfy+48`,于是壳照常跑。
|
||||
|
||||
**注意**:DogProtect 目前虚拟化的是**原始程序里被 `VMProtectBegin/End` 标记的函数**,
|
||||
`.vfy` 里的验证壳代码本身**没有被虚拟化**(内容 hash 一致即证明)。若要让验证壳也被 DogProtect 保护,
|
||||
需要给壳函数加标记并在打包后重算 `.vfy` 头的 `crcV`(否则壳会以 `exit=6` 拒绝启动)—— 属另一个课题。
|
||||
|
||||
复现命令:
|
||||
|
||||
```bash
|
||||
# 1) 打壳(api 用完整 login URL)
|
||||
./packthemed sample.exe single.exe cfg.json dark
|
||||
# 2) 外层再加 DogProtect(项目文件里 InputFileName 指向 single.exe)
|
||||
LD_LIBRARY_PATH=<vmprotect>/bin <vmprotect>/bin/64/release/dogprotect_con \
|
||||
single.exe double.exe -pf project.dog
|
||||
# 3) 跑起来 + mock 服务端(scripts/mock-vfy-device-limit.py)按 docs/shell-device-ui.md 的清单验收
|
||||
```
|
||||
|
||||
|
||||
## 引导补丁(1 字节,可逆)
|
||||
|
||||
引导里整文件 CRC 的比较是 `cmp [hdr+0x28], eax` 紧跟 `je <通过>`;把那个 `je` 改成 `jmp`,
|
||||
@@ -72,3 +130,19 @@ go build ./cmd/packsigned && ./packsigned <src.exe> <out.exe> <cfg.json>
|
||||
|
||||
即 `PatchSigned(..., signed=true)`,`flags.bit1=1`、`crcFile=0`。引导改造后它不再是二次加壳的前提,
|
||||
但保留给「签名产物」(Authenticode 与整文件 CRC 也互斥)这一路使用。
|
||||
|
||||
### 32 位(x86)实测
|
||||
|
||||
改名在 32 位链路上同样验证过(`wine32:i386` + 独立 `WINEARCH=win32` prefix):
|
||||
|
||||
| 项目 | 结果 |
|
||||
|---|---|
|
||||
| 32 位样本 | `GOOS=windows GOARCH=386 go build` 产出的 PE32(无需 i686 mingw 工具链) |
|
||||
| 产物 | `ld32.exe` 2,198,016 字节,架构 x86(自动选 `blob32.bin` + `shell32.bin`) |
|
||||
| 节表 | `… .idata, .reloc, .symtab, .load` —— 壳节名已生效 |
|
||||
| 入口 | RVA `0x212030` = `.load`(0x212000) + 48 ✅ |
|
||||
| 启动 | `wine` 起窗口,引导阶段标记 `F`(CRC 通过 + 壳 DLL 映射完成),classic 壳登录页正常渲染,exit=124 ✅ |
|
||||
| 篡改 `.load` 内容 | exit=**6**(节级 `crcV` 拦住)✅ |
|
||||
|
||||
注意:64 位 prefix 里跑 32 位产物会 `could not load kernel32.dll`,必须用 `WINEARCH=win32` 的独立 prefix。
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
# 登录方式开关(login_mode)
|
||||
|
||||
每个应用可以独立决定「用哪种凭证登录」:账号密码 / 卡密直登 / 两者都开。这个开关**在服务端真正生效**,不只是界面藏控件。
|
||||
|
||||
## 一句话架构
|
||||
|
||||
```
|
||||
面板配置(login_mode + enforce + 宽限期)
|
||||
↓
|
||||
服务端强制(/login、/register 里 gate,早于任何副作用)
|
||||
↓
|
||||
客户端呈现(/info 下发 login_mode,壳按它决定显示哪些控件)
|
||||
```
|
||||
|
||||
壳能被破解替换,**判定只在服务端**;壳按 `/info` 只是把不该出现的输入框藏起来,让用户少困惑。
|
||||
|
||||
## 三种模式
|
||||
|
||||
| login_mode | 语义 | 允许的凭证 |
|
||||
|---|---|---|
|
||||
| `account` | 账号密码登录;卡密只用于充值 | `account` |
|
||||
| `card` | 一张卡就是一个用户,输入卡密即登录 | `card` |
|
||||
| `both` | 两种都开 | `account` + `card` |
|
||||
|
||||
**卡密的两种语义不要混**:①登录凭证(`purpose=credential`,`login_mode` 管这个)②充值手段(`purpose=recharge`,由 `billing_type` 管)。关掉卡密直登不会连带关掉卡密充值。
|
||||
|
||||
## 生效级别(login_mode_enforce)
|
||||
|
||||
配置改了不会立刻拦人,`enforce` 决定它到底管不管:
|
||||
|
||||
| 值 | 行为 | 用途 |
|
||||
|---|---|---|
|
||||
| `off` | 完全不校验(升级前的行为) | 回滚 |
|
||||
| `warn` | 校验但放行,只写一条 `login_mode_blocked` 审计日志(`[warn-only]` 前缀) | 灰度:先看会挡到谁 |
|
||||
| `strict` | 真正拦截:HTTP 403 + `error_code=LOGIN_MODE_DISABLED` | 上线 |
|
||||
|
||||
新建应用默认 `login_mode=both`、`enforce=warn`;存量应用升级时 `enforce` 会被回填成 `warn`(启动时一次性 UPDATE,幂等),所以**升级本身不改变任何行为**。
|
||||
|
||||
## 宽限期
|
||||
|
||||
`applications.login_mode_grace_until`:切换模式时自动给 7 天(也可以在面板里填 0 = 立即生效)。
|
||||
|
||||
宽限期内旧凭证仍可用,但登录成功的响应里会带:
|
||||
|
||||
```json
|
||||
{"deprecated_login": true, "grace_days_left": 7,
|
||||
"login_mode": "account", "allowed_login_types": ["account"]}
|
||||
```
|
||||
|
||||
壳拿这些字段提示「该登录方式将在 X 天后停用」。这层是给**老客户端**留的活路:老壳不认识新字段、也显示不了提示,但至少不会被一刀切挡在门外。
|
||||
|
||||
## 服务端拦截点
|
||||
|
||||
`backend/internal/router/app/auth.go` 的 `/login`:`login_type` 归一化(`auto` → `account`/`card`)**之后**、查主体/写设备绑定/记失败次数**之前**。
|
||||
|
||||
这样被策略拒绝的请求**不产生任何副作用**:不建绑定行、不加失败计数、不写 `last_login`、不触发「异常登录自动锁定」,只留一条审计日志。
|
||||
|
||||
拒绝响应(固定错误码,壳可以按它做文案):
|
||||
|
||||
```json
|
||||
HTTP 403
|
||||
{"code":403,"error_code":"LOGIN_MODE_DISABLED",
|
||||
"message":"该应用仅支持账号密码登录",
|
||||
"data":{"login_mode":"account","allowed":["account"]}}
|
||||
```
|
||||
|
||||
`/register` 同样有一道:`card` + `strict` + 不在宽限期时返回「该应用使用卡密登录,无需注册」(卡密模式下注册出来的账号根本没有登录入口)。
|
||||
|
||||
## 影响面预检
|
||||
|
||||
`GET /api/v1/dev/applications/:id/login-mode-impact`
|
||||
|
||||
```json
|
||||
{"total_subjects":2,"card_subjects":1,"card_subjects_with_email":0,
|
||||
"only_card_subjects":1,"only_account_subjects":1,
|
||||
"blocking":false,"blocked_if_switch":1,
|
||||
"login_mode":"both","login_mode_enforce":"warn","login_mode_grace_days":0}
|
||||
```
|
||||
|
||||
- `only_card_subjects`:卡密主体的密码是建主体时写进去的**随机散列**(卡密才是它的钥匙),所以不能靠 `password` 是否为空判断,这里用「没绑邮箱」来近似——绑了邮箱才有自助设密码的通道。
|
||||
- `only_account_subjects`:有账号但没绑任何 `purpose=credential` 的卡 → 切到 `card` 会登不进来。
|
||||
|
||||
面板在「登录方式」卡片里直接显示这两个数字,切换模式时给出「约 N 个主体将无法登录」的黄色提示。
|
||||
|
||||
## 面板位置
|
||||
|
||||
应用详情 → 设置 → **登录方式**卡片:
|
||||
|
||||
1. 三选一(账号密码 / 卡密直登 / 两者都开)
|
||||
2. **生效方式**(关闭校验 / 仅记录 / 已生效)
|
||||
3. **切换后的宽限期(天)**
|
||||
4. 影响面提示条(会挡住多少人)
|
||||
5. 卡密相关两个开关(是否受设备上限约束、是否允许卡密主体再设密码),仅在非 `account` 模式下显示
|
||||
|
||||
## 实测矩阵
|
||||
|
||||
`/root/work/e2e_login_mode.py`(对着干净 sqlite 后端起真服务跑,不是单测):
|
||||
|
||||
| 模式/级别 | 提交 account | 提交 card | auto(卡密塞 username、密码空) | auto(账号+密码) |
|
||||
|---|---|---|---|---|
|
||||
| both / off | 200 | 200 | 200 | 200 |
|
||||
| account / strict | 200 | **403 LOGIN_MODE_DISABLED** | **403** | 200 |
|
||||
| card / strict | **403** | 200 | 200 | **403** |
|
||||
| account / warn | 200 | 200(写 `[warn-only]` 日志) | 200 | 200 |
|
||||
| account / strict + 7 天宽限 | 200 | 200 + `deprecated=7天` | 200 + `deprecated=7天` | 200 |
|
||||
|
||||
纯逻辑另有单测:`go test ./internal/service -run "LoginMode|LoginType|Allowed"`。
|
||||
|
||||
## 存量用户怎么迁移(本期只做「不锁死人」的部分)
|
||||
|
||||
原则:**主体不动,只补另一种钥匙**(`app_users` 是主体,卡密与账号都是它的凭证)。
|
||||
|
||||
已经不锁人的三道保险:
|
||||
|
||||
1. 存量应用 `enforce` 回填 `warn` → 升级不改行为
|
||||
2. 切换模式自动给 7 天宽限 → 旧凭证还能用,且壳能提示
|
||||
3. 影响面接口 + 面板黄色提示 → 管理员切之前就看得到会挡住谁
|
||||
|
||||
**还没做**(下一步,按这个顺序):
|
||||
|
||||
1. `POST /app/:key/card-to-account`:持有效卡密即可给自己设密码(纯卡密主体唯一的活路)
|
||||
2. `POST /app/:key/account-to-card`:给已登录账号签发一张 `credential` 卡
|
||||
3. 管理端批量迁移向导(批量生成初始密码 / 批量签发迁移卡 + 导出清单 + `must_change_password`)
|
||||
|
||||
## 已知未做
|
||||
|
||||
- **classic 壳**(`shell64.bin` / `shell32.bin`)不读 `login_mode`:界面照旧给「账号或卡密」单框。服务端会拦,并返回可读的 `message`;UI 适配需要二进制补丁或重编源码(二期)。
|
||||
- **Android 壳**(`shell_smali.tgz`)同样不读 `login_mode`:仍是「账号或卡密 + 密码」两框。server 已保证策略正确。
|
||||
- DuiLib 壳(7 套皮肤)**已经**按 `login_mode` 自适应:`card` 模式隐藏密码框、输入框改「卡密」、按钮改「卡密登录」;`both` 模式仍是「密码留空走卡密」的隐式判定(后续可以加显式切换)。
|
||||
@@ -0,0 +1,149 @@
|
||||
# 验证壳的设备管理页(Windows / Android)
|
||||
|
||||
这份文档记录 2026-11 这轮壳改动的**最终形态、交互契约、验收方法和踩过的坑**,换人接手不用再从二进制里挖。
|
||||
|
||||
涉及资产:
|
||||
|
||||
| 资产 | 说明 |
|
||||
|---|---|
|
||||
| `backend/internal/protect/assets/shell64_dui.bin` | x64 DuiLib 壳(7 套皮肤:dark/light/industrial/compact/split/card/terminal) |
|
||||
| `backend/internal/protect/assets/shell64.bin`、`shell32.bin` | classic(Direct2D 单皮肤)壳 |
|
||||
| `backend/internal/protect/assets/shell_smali.tgz` | Android 壳(smali 源码,加壳时由 apktool 合并进 APK) |
|
||||
| `shell/duilib/shell9_v6.cpp` + `skins_v4.h` | DuiLib 壳的完整源码(XML 皮肤在头文件里) |
|
||||
| `shell/classic/shell6.cpp` | classic 壳源码 |
|
||||
|
||||
> 改完源码后:`shell/duilib/build-duilib.sh` → 产物拷进 `assets/shell64_dui.bin` → **必须重编 `cmd/packthemed`**(见坑 1)。
|
||||
|
||||
---
|
||||
|
||||
## 1. 设备满时:独立「设备管理」页(QQ 式)
|
||||
|
||||
触发:登录返回 HTTP 403 + `error_code=DEVICE_LIMIT_EXCEEDED`。
|
||||
|
||||
行为:
|
||||
|
||||
1. 窗口从登录页尺寸(470×428 一类)**临时放大到 620×620 并居中**
|
||||
2. 标题栏文字切为 **`设备管理 - <应用名>`**(cfg 的 `name`)
|
||||
3. 内容区小标题 `设备管理`,副标题 `已绑定 3 / 2 台,解绑一台后即可登录`
|
||||
4. 登录页的 4 个 tab(登录/注册/卡密充值/忘记密码)与品牌字**隐藏**
|
||||
5. 每台设备一行卡片:`序号. 名称 设备ID ● 在线 / ○ 离线`,**右侧一个蓝色「解绑」按钮**
|
||||
6. 底部:`解绑最早一台` / `重试` / `返回`
|
||||
7. **点哪一行的「解绑」就解绑那一台**;成功后自动重试登录
|
||||
8. 点「返回 / 重试」→ 标题复原为 `软件授权验证`、tab 回来、窗口缩回原尺寸
|
||||
|
||||
### 交互契约(前端 ↔ 后端)
|
||||
|
||||
| 步骤 | 请求 | 说明 |
|
||||
|---|---|---|
|
||||
| 登录 | `POST /api/v1/app/:appKey/login` `{login_type,username,password,device_id,device_name,device_type,instance_id}` | 设备绑定 + 会话都在这一步完成 |
|
||||
| 被拦 | HTTP 403 `{error_code:"DEVICE_LIMIT_EXCEEDED", data:{max_devices, device_count, devices:[{id,device_id,device_name,device_type,online_count,created_at}]}}` | 壳解析 `devices` 渲染列表,`online_count>0` → ● 在线 |
|
||||
| 解绑 | `POST /api/v1/app/:appKey/unbind-device-with-auth` `{username,password,device_id}` | 卡密用户走 `/card-unbind` `{card_key,device_id}` |
|
||||
| 重试 | 再发一次 login | 解绑成功后自动重试,不用用户再点 |
|
||||
|
||||
**注意**:壳只做**解绑**(删绑定行、连带断会话),不做「下线/踢线」(`POST /instances/:instance_id/offline` 未接入)。所以界面文案里不能用「下线」,否则用户会以为能保留授权只断会话。
|
||||
|
||||
### 手动选择,不自动解
|
||||
|
||||
- 明细行是可点按钮:`devRowN`(信息)+ `devUnbindN`(右侧「解绑」),点击 → `UnbindDeviceIdx(N+1)`
|
||||
- **序号输入框已整块拿掉**(`devIdx` / `btnUnbind` 在 XML 里 `visible="false"` 兜底保留,代码不再走输入路径)
|
||||
- 空列表(服务端没返回明细)时只给「重试」,不会默认解绑任何一台
|
||||
|
||||
---
|
||||
|
||||
## 2. 卡密用户的「我的设备」
|
||||
|
||||
同一套面板复用(`g_devManage=1`):卡密就是身份,不需要先登录。
|
||||
- 列表来源:`POST /api/v1/app/:appKey/card-devices` `{card_key}`
|
||||
- 解绑:`POST /api/v1/app/:appKey/card-unbind` `{card_key,device_id}`
|
||||
- 面板里多一个「卡密」输入框(`devCardKey`),未填时提示「先在『登录』里填入卡密,再点这里的『我的设备』」
|
||||
|
||||
---
|
||||
|
||||
## 3. Android 壳的界面(`shell_smali.tgz`)
|
||||
|
||||
没有 XML 布局、没有皮肤,是运行时拼的原生 `AlertDialog`:
|
||||
|
||||
```
|
||||
┌────────────────────────────────────┐
|
||||
│ <应用名>(cfg.name,缺省「验证」) │
|
||||
│ 请输入账号或卡密完成验证 │
|
||||
│ ┌────────────────────────────────┐ │
|
||||
│ │ 账号或卡密 │ │
|
||||
│ └────────────────────────────────┘ │
|
||||
│ ┌────────────────────────────────┐ │
|
||||
│ │ 密码(留空则用内置) │ │
|
||||
│ └────────────────────────────────┘ │
|
||||
│ 通过后自动进入应用 │
|
||||
│ 验证 退出 │
|
||||
└────────────────────────────────────┘
|
||||
```
|
||||
|
||||
- 填了密码 → 覆盖 cfg 里的 `password`(`cfg.put("password", ...)`)后调 `verify()`
|
||||
- 「退出」= `Activity.finish()` + `Process.killProcess(myPid())`
|
||||
- 设备超限文案:`设备数超限,请先在平台解绑一台设备`
|
||||
- 设备标识:`ANDROID-` + Android ID
|
||||
- **手机端没有设备列表/自助解绑页**(只有这一道登录闸),要补就照桌面端的接口接 `/card-devices` + `/card-unbind`
|
||||
|
||||
改了 smali 先离线校验语法:
|
||||
|
||||
```bash
|
||||
cd <解开 shell_smali.tgz 的目录>
|
||||
smali assemble vfy -o /tmp/vfy.dex # 能出 dex 就说明语法与引用都对得上
|
||||
tar czf shell_smali.tgz vfy # 结构必须是 vfy/*.smali
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 验收方法(可复现)
|
||||
|
||||
需要:`Xvfb :99` + `openbox` + wine + 一个 mock 验证服务端。
|
||||
|
||||
```bash
|
||||
# 1) mock 服务端:/login 一律回 403 DEVICE_LIMIT(3 台/上限 2),其它接口回成功
|
||||
python3 scripts/mock-vfy-device-limit.py & # 监听 127.0.0.1:9998
|
||||
|
||||
# 2) 打一个 dark 主题的壳产物(api 必须是完整的 login URL)
|
||||
cat > /tmp/cfg.json <<'JSON'
|
||||
{"api":"http://127.0.0.1:9998/api/v1/app/dogtest/login","name":"dogtest","device_auto":1,"shell_ver":8,"theme":"dark","ver":"1.0.0"}
|
||||
JSON
|
||||
go build -o /tmp/packthemed ./cmd/packthemed # 改过 assets 必须重编!
|
||||
/tmp/packthemed sample.exe /tmp/out.exe /tmp/cfg.json dark
|
||||
|
||||
# 3) 跑起来看
|
||||
DISPLAY=:99 wine /tmp/out.exe
|
||||
```
|
||||
|
||||
验收清单(每项都要肉眼/日志对得上):
|
||||
|
||||
- [ ] 单层产物启动 → 登录页(exit=124 = GUI 在等网络)
|
||||
- [ ] 输入账号+密码点登录 → 服务端收到 login,含 `device_id/device_name/device_type/instance_id`
|
||||
- [ ] 被 403 拦下 → **窗口放大、标题变「设备管理 - 应用名」、tab 消失、每行右侧有「解绑」**
|
||||
- [ ] 列表在线状态与 mock 的 `online_count` 一致(● 在线 / ○ 离线)
|
||||
- [ ] 点**第 2 行**「解绑」→ 服务端收到 `unbind-device-with-auth`,`device_id` = 第 2 台(不是最早那台)
|
||||
- [ ] 解绑后自动重试登录
|
||||
- [ ] 点「返回」→ 标题复原、tab 回来、窗口缩回登录尺寸
|
||||
- [ ] 无「下线/踢线」按钮(当前设计不含该能力)
|
||||
|
||||
---
|
||||
|
||||
## 5. 踩过的坑(每条都真踩过)
|
||||
|
||||
1. **`cmd/packthemed` 是 `//go:embed` 内嵌壳资产的**:改完 `assets/*.bin` 不重编它,打出来的产物还是旧壳。
|
||||
症状:改了半天什么都没变,字节数一模一样。规矩:**改资产 → `go build ./cmd/packthemed`**。
|
||||
2. **wine 下 DuiLib 原生 EDIT 点击不转移焦点**:点一下只是激活窗口,输入会打到上一个输入框。
|
||||
规矩:**同一点位点两次**(第一次激活、第二次聚焦)再输入。
|
||||
3. **`devBody` 那个多行 Label 的字色在重编产物里压不住**:XML `textcolor`、运行时 `SetTextColor`、`SetAttribute("textcolor")` 都不行;`CListLabelElementUI` 连 `SetTextColor` 都没有;`CButtonUI::SetAttribute` 只吃 `hot/pushed/focusedtextcolor`。
|
||||
最终解法:设备行做成**按钮**(信息按钮 + 解绑按钮),跟「重试/返回」同一套渲染 → 亮度和它们一致。
|
||||
4. **`m_pm.SetSize` 不存在**(`CPaintManagerUI` 只有 `SetSizeBox`):窗口尺寸直接 `SetWindowPos`,DuiLib 会在 `WM_SIZE` 里自己重排。
|
||||
5. **残留 wine 进程会叠窗污染截图**:脚本开头要 `wineserver -k9` + 杀光 `*.exe`,否则截到的是上一轮的窗口。
|
||||
6. **`pkill -9 -f "themed/"` 会把自己杀掉**(命令行里含 `packthemed` 字样):模式写成 `wine.*themed/dev`。
|
||||
7. **面板高度改大不能只改 XML**:`panelDevice` 用 `height="-1"` 跟随窗口,否则登录页会被撑出一个空面板。
|
||||
8. 皮肤里只有 3 套有「软件授权验证」标题 Label(已命名 `lblTitle` 支持动态改),其余 4 套是 `VFY` 品牌栏设计,标题不随页切换属预期。
|
||||
|
||||
---
|
||||
|
||||
## 6. 已知未做
|
||||
|
||||
- 手机端的设备列表 / 自助解绑页(桌面端已有)
|
||||
- 「下线(踢线)」按钮 —— 按需求方口径**不做**,有解绑即可
|
||||
- 设备管理页在多语言 skin(industrial/terminal)里标题仍是各自品牌词,未做本地化
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Info, Loader2, Upload, X } from 'lucide-vue-next'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { toast } from 'vue-sonner'
|
||||
|
||||
@@ -32,6 +32,8 @@ interface AppData {
|
||||
billing_type: string
|
||||
login_policy: string
|
||||
login_mode: string
|
||||
login_mode_enforce: string
|
||||
login_mode_grace_days: number
|
||||
card_login_bind_device: boolean
|
||||
card_login_allow_password: boolean
|
||||
allow_register: boolean
|
||||
@@ -55,6 +57,49 @@ interface AppData {
|
||||
}
|
||||
|
||||
const app = ref<AppData | null>(null)
|
||||
const impact = ref<{
|
||||
total_subjects: number
|
||||
only_card_subjects: number
|
||||
only_account_subjects: number
|
||||
blocking: boolean
|
||||
} | null>(null)
|
||||
|
||||
const enforceOptions = [
|
||||
{ value: 'off', title: '关闭校验', desc: '不按登录方式拦人,与升级前行为一致' },
|
||||
{ value: 'warn', title: '仅记录', desc: '只写审计日志不拦截,用来观察会挡到谁' },
|
||||
{ value: 'strict', title: '已生效', desc: '真正拦截;宽限期内旧方式仍放行并提示' },
|
||||
]
|
||||
|
||||
// 切到当前选中的模式,会被挡住的主体数
|
||||
const selectedBlocked = computed(() => {
|
||||
if (!impact.value)
|
||||
return 0
|
||||
if (form.value.login_mode === 'account')
|
||||
return impact.value.only_card_subjects
|
||||
if (form.value.login_mode === 'card')
|
||||
return impact.value.only_account_subjects
|
||||
return 0
|
||||
})
|
||||
|
||||
function modeLabel(mode: string) {
|
||||
return mode === 'account' ? '账号密码' : mode === 'card' ? '卡密直登' : '两者都开'
|
||||
}
|
||||
|
||||
async function fetchImpact() {
|
||||
try {
|
||||
const token = localStorage.getItem('token')
|
||||
const res = await fetch(`${API_BASE}/dev/applications/${route.params.id}/login-mode-impact`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
const data = await res.json()
|
||||
if (data.code === 200)
|
||||
impact.value = data.data
|
||||
}
|
||||
catch (error) {
|
||||
console.error('获取登录方式影响面失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const emailConfigs = ref<EmailConfig[]>([])
|
||||
const smsConfigs = ref<SmsConfig[]>([])
|
||||
|
||||
@@ -66,7 +111,9 @@ const form = ref({
|
||||
iconPreview: '',
|
||||
billing_type: 'free',
|
||||
login_policy: 'loose',
|
||||
login_mode: 'account',
|
||||
login_mode: 'both',
|
||||
login_mode_enforce: 'warn',
|
||||
login_mode_grace_days: 7,
|
||||
card_login_bind_device: true,
|
||||
card_login_allow_password: false,
|
||||
allow_register: true,
|
||||
@@ -194,7 +241,9 @@ async function fetchApp() {
|
||||
iconPreview: getIconUrl(appData.icon_url),
|
||||
billing_type: appData.billing_type || 'free',
|
||||
login_policy: appData.login_policy || 'loose',
|
||||
login_mode: appData.login_mode || 'account',
|
||||
login_mode: appData.login_mode || 'both',
|
||||
login_mode_enforce: appData.login_mode_enforce || 'warn',
|
||||
login_mode_grace_days: appData.login_mode_grace_days ?? 7,
|
||||
card_login_bind_device: appData.card_login_bind_device !== false,
|
||||
card_login_allow_password: appData.card_login_allow_password === true,
|
||||
allow_register: appData.allow_register ?? true,
|
||||
@@ -245,6 +294,8 @@ async function handleSave() {
|
||||
formDataToSend.append('billing_type', form.value.billing_type)
|
||||
formDataToSend.append('login_policy', form.value.login_policy)
|
||||
formDataToSend.append('login_mode', form.value.login_mode)
|
||||
formDataToSend.append('login_mode_enforce', form.value.login_mode_enforce)
|
||||
formDataToSend.append('login_mode_grace_days', String(form.value.login_mode_grace_days ?? 7))
|
||||
formDataToSend.append('card_login_bind_device', form.value.card_login_bind_device.toString())
|
||||
formDataToSend.append('card_login_allow_password', form.value.card_login_allow_password.toString())
|
||||
formDataToSend.append('allow_register', form.value.allow_register.toString())
|
||||
@@ -307,6 +358,12 @@ onMounted(() => {
|
||||
fetchApp()
|
||||
fetchEmailConfigs()
|
||||
fetchSmsConfigs()
|
||||
fetchImpact()
|
||||
})
|
||||
|
||||
// 换登录方式时重新算一遍影响面,切换前就能看到会挡住多少人
|
||||
watch(() => form.value.login_mode, () => {
|
||||
fetchImpact()
|
||||
})
|
||||
|
||||
function toggleWeekday(index: number) {
|
||||
@@ -719,6 +776,53 @@ function toggleWeekday(index: number) {
|
||||
<UiSwitch v-model="form.card_login_allow_password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 生效方式:开关只是配置,这里决定它是不是真的拦人 -->
|
||||
<div class="space-y-3 pt-2 border-t">
|
||||
<div>
|
||||
<p class="font-medium">生效方式</p>
|
||||
<p class="text-sm text-muted-foreground">
|
||||
配置改了要经过这一步才真正生效。建议先「仅记录」,看几天日志确认拦的都是该拦的,再切「已生效」。
|
||||
</p>
|
||||
</div>
|
||||
<UiRadioGroup v-model="form.login_mode_enforce" class="grid grid-cols-1 md:grid-cols-3 gap-3">
|
||||
<div
|
||||
v-for="opt in enforceOptions"
|
||||
:key="opt.value"
|
||||
class="flex items-start gap-3 p-3 rounded-lg border cursor-pointer transition-colors"
|
||||
:class="form.login_mode_enforce === opt.value ? 'border-primary bg-primary/5' : 'hover:bg-accent'"
|
||||
@click="form.login_mode_enforce = opt.value"
|
||||
>
|
||||
<UiRadioGroupItem :value="opt.value" class="mt-0.5" />
|
||||
<div>
|
||||
<p class="font-medium">{{ opt.title }}</p>
|
||||
<p class="text-sm text-muted-foreground">{{ opt.desc }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</UiRadioGroup>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<p class="font-medium">切换后的宽限期(天)</p>
|
||||
<p class="text-sm text-muted-foreground">
|
||||
宽限期内旧登录方式仍可用,客户端会提示「X 天后停用」,避免存量用户被一刀切挡在门外。填 0 = 立即生效
|
||||
</p>
|
||||
</div>
|
||||
<UiInput v-model.number="form.login_mode_grace_days" type="number" min="0" max="365" class="w-24" />
|
||||
</div>
|
||||
<div v-if="impact && selectedBlocked > 0" class="rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 space-y-1">
|
||||
<p class="font-medium text-amber-600 dark:text-amber-400">
|
||||
切到「{{ modeLabel(form.login_mode) }}」后,约 {{ selectedBlocked }} 个现存在册主体将无法登录
|
||||
</p>
|
||||
<p class="text-sm text-muted-foreground">
|
||||
共 {{ impact.total_subjects }} 个主体:仅能卡密登录 {{ impact.only_card_subjects }} 个,仅能账号登录 {{ impact.only_account_subjects }} 个。
|
||||
建议先开宽限期,或用「卡密换密码 / 签发登录卡」的迁移通道给他们换钥匙。
|
||||
</p>
|
||||
</div>
|
||||
<div v-else-if="impact" class="rounded-lg border bg-muted/40 p-3 text-sm text-muted-foreground">
|
||||
当前 {{ impact.total_subjects }} 个主体:仅卡密登录 {{ impact.only_card_subjects }} 个,仅账号登录 {{ impact.only_account_subjects }} 个 ——
|
||||
切到「{{ modeLabel(form.login_mode) }}」不会挡住任何人。
|
||||
</div>
|
||||
</div>
|
||||
</UiCardContent>
|
||||
</UiCard>
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
#!/usr/bin/env python3
|
||||
"""登录方式开关(login_mode)端到端验证。
|
||||
|
||||
前置:一个干净的后端(sqlite)已经装好管理员,环境变量按需覆盖:
|
||||
VFY_BASE=http://127.0.0.1:8080 VFY_DB=<sqlite 文件> VFY_STATE=<状态文件>
|
||||
|
||||
跑法:
|
||||
python3 scripts/e2e-login-mode.py setup # 建应用 / 账号用户 / credential 卡
|
||||
python3 scripts/e2e-login-mode.py matrix # 跑 5 组模式×凭证的登录矩阵
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sqlite3
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
BASE = os.environ.get("VFY_BASE", "http://127.0.0.1:8080")
|
||||
DB = os.environ.get("VFY_DB", "/root/work/vfy_e2e/verification_platform.db")
|
||||
ADMIN = {"username": "e2eadmin", "password": "admin123456"}
|
||||
APP_NAME = "e2e-loginmode"
|
||||
STATE = os.environ.get("VFY_STATE", "/root/work/e2e_state.json")
|
||||
|
||||
|
||||
def call(method, path, data=None, tok=None):
|
||||
body = json.dumps(data).encode() if data is not None else None
|
||||
req = urllib.request.Request(BASE + path, data=body, method=method,
|
||||
headers={"Content-Type": "application/json"})
|
||||
if tok:
|
||||
req.add_header("Authorization", "Bearer " + tok)
|
||||
try:
|
||||
return json.loads(urllib.request.urlopen(req, timeout=25).read())
|
||||
except urllib.error.HTTPError as e:
|
||||
raw = e.read().decode()
|
||||
try:
|
||||
j = json.loads(raw)
|
||||
j["_http"] = e.code
|
||||
return j
|
||||
except Exception:
|
||||
return {"_http": e.code, "_raw": raw[:400]}
|
||||
|
||||
|
||||
def admin_token():
|
||||
r = call("POST", "/api/v1/auth/login", ADMIN)
|
||||
return r["data"]["token"]
|
||||
|
||||
|
||||
def setup():
|
||||
tok = admin_token()
|
||||
r = call("POST", "/api/v1/dev/applications",
|
||||
{"name": APP_NAME, "description": "e2e 登录方式验证", "billing_type": "free"}, tok)
|
||||
print("建应用:", json.dumps(r, ensure_ascii=False)[:300])
|
||||
app = r.get("data", {})
|
||||
if isinstance(app.get("application"), dict):
|
||||
app = app["application"]
|
||||
app_id, app_key = app.get("id"), app.get("app_key")
|
||||
if not app_id:
|
||||
print("拿不到应用 ID,终止")
|
||||
return
|
||||
# 打开注册、关闭各种验证,方便造数据
|
||||
call("PUT", f"/api/v1/dev/applications/{app_id}",
|
||||
{"allow_register": True, "enable_register_verify": False, "enable_login_verify": False,
|
||||
"bind_type": "none", "max_devices": 5}, tok)
|
||||
|
||||
reg = call("POST", f"/api/v1/app/{app_key}/register",
|
||||
{"username": "e2euser", "password": "user123456", "device_id": "DEV-E2E-0001",
|
||||
"device_name": "e2e-pc", "device_type": "windows", "instance_id": "DEV-E2E-0001"})
|
||||
print("注册账号用户:", json.dumps(reg, ensure_ascii=False)[:300])
|
||||
|
||||
# 直接插一张 credential 卡(管理端建卡接口在这个版本里是桩)
|
||||
con = sqlite3.connect(DB)
|
||||
cur = con.cursor()
|
||||
cur.execute("SELECT id FROM card_types WHERE application_id=? LIMIT 1", (app_id,))
|
||||
row = cur.fetchone()
|
||||
if row:
|
||||
ct_id = row[0]
|
||||
else:
|
||||
cols = [r[1] for r in cur.execute("PRAGMA table_info(card_types)")]
|
||||
vals = {"application_id": app_id, "name": "e2e登录卡", "purpose": "credential",
|
||||
"recharge_type": "balance", "value": 0, "value_unit": "day", "price": 0,
|
||||
"status": "active", "created_at": "2026-11-24 00:00:00", "updated_at": "2026-11-24 00:00:00"}
|
||||
use = {k: v for k, v in vals.items() if k in cols}
|
||||
cur.execute("INSERT INTO card_types (%s) VALUES (%s)" % (
|
||||
",".join(use), ",".join("?" * len(use))), list(use.values()))
|
||||
ct_id = cur.lastrowid
|
||||
|
||||
cols = [r[1] for r in cur.execute("PRAGMA table_info(cards)")]
|
||||
vals = {"application_id": app_id, "card_type_id": ct_id, "card_key": "E2E-CARD-0001",
|
||||
"purpose": "credential", "status": "unused", "creator_id": 1,
|
||||
"created_at": "2026-11-24 00:00:00", "updated_at": "2026-11-24 00:00:00"}
|
||||
use = {k: v for k, v in vals.items() if k in cols}
|
||||
cur.execute("INSERT INTO cards (%s) VALUES (%s)" % (",".join(use), ",".join("?" * len(use))),
|
||||
list(use.values()))
|
||||
con.commit()
|
||||
con.close()
|
||||
print(f"已插入 credential 卡 E2E-CARD-0001(card_type_id={ct_id})")
|
||||
|
||||
json.dump({"app_id": app_id, "app_key": app_key, "token": tok}, open(STATE, "w"))
|
||||
print(f"state 已保存: app_id={app_id} app_key={app_key}")
|
||||
|
||||
|
||||
def set_mode(tok, app_id, mode=None, enforce=None, grace=None):
|
||||
body = {}
|
||||
if mode is not None:
|
||||
body["login_mode"] = mode
|
||||
if enforce is not None:
|
||||
body["login_mode_enforce"] = enforce
|
||||
if grace is not None:
|
||||
body["login_mode_grace_days"] = grace
|
||||
r = call("PUT", f"/api/v1/dev/applications/{app_id}", body, tok)
|
||||
return r
|
||||
|
||||
|
||||
def login(app_key, payload):
|
||||
r = call("POST", f"/api/v1/app/{app_key}/login", payload)
|
||||
code = r.get("code") or r.get("_http")
|
||||
return code, r.get("error_code"), r.get("message") or r.get("msg"), r.get("data")
|
||||
|
||||
|
||||
def matrix():
|
||||
st = json.load(open(STATE))
|
||||
tok, app_id, app_key = st["token"], st["app_id"], st["app_key"]
|
||||
|
||||
acc = {"username": "e2euser", "password": "user123456", "login_type": "account",
|
||||
"device_id": "DEV-E2E-0001", "device_name": "e2e-pc", "device_type": "windows",
|
||||
"instance_id": "DEV-E2E-0001"}
|
||||
crd = {"card_key": "E2E-CARD-0001", "login_type": "card",
|
||||
"device_id": "DEV-E2E-0002", "device_name": "e2e-pc2", "device_type": "windows",
|
||||
"instance_id": "DEV-E2E-0002"}
|
||||
# auto:把卡密塞进 username、密码留空 → 归一化成 card
|
||||
auto_card = {"username": "E2E-CARD-0001", "password": "", "login_type": "auto",
|
||||
"device_id": "DEV-E2E-0003", "device_name": "e2e-pc3", "device_type": "windows",
|
||||
"instance_id": "DEV-E2E-0003"}
|
||||
auto_acc = {"username": "e2euser", "password": "user123456", "login_type": "auto",
|
||||
"device_id": "DEV-E2E-0004", "device_name": "e2e-pc4", "device_type": "windows",
|
||||
"instance_id": "DEV-E2E-0004"}
|
||||
|
||||
cases = [
|
||||
("both/off", "both", "off", 0),
|
||||
("account/strict", "account", "strict", 0),
|
||||
("card/strict", "card", "strict", 0),
|
||||
("account/warn", "account", "warn", 0),
|
||||
("account/strict+7天宽限", "account", "strict", 7),
|
||||
]
|
||||
rows = []
|
||||
for label, mode, enforce, grace in cases:
|
||||
set_mode(tok, app_id, mode, enforce, grace)
|
||||
for tname, payload in (("account", acc), ("card", crd), ("auto→card", auto_card), ("auto→account", auto_acc)):
|
||||
code, ecode, msg, data = login(app_key, payload)
|
||||
extra = ""
|
||||
if isinstance(data, dict):
|
||||
if data.get("deprecated_login"):
|
||||
extra = f" deprecated={data.get('grace_days_left')}天"
|
||||
rows.append((label, tname, code, ecode or "", (msg or "")[:22], extra))
|
||||
print(f"--- {label} ---")
|
||||
for r in rows[-4:]:
|
||||
print(f" {r[1]:<14} code={r[2]} error_code={r[3]:<20} {r[4]}{r[5]}")
|
||||
|
||||
# 恢复默认,别把环境留成 strict
|
||||
set_mode(tok, app_id, "both", "warn", 0)
|
||||
|
||||
# impact 接口
|
||||
imp = call("GET", f"/api/v1/dev/applications/{app_id}/login-mode-impact", None, tok)
|
||||
print("影响面:", json.dumps(imp.get("data"), ensure_ascii=False))
|
||||
return rows
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmd = sys.argv[1] if len(sys.argv) > 1 else "setup"
|
||||
if cmd == "setup":
|
||||
setup()
|
||||
elif cmd == "matrix":
|
||||
matrix()
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""mock 验证服务端(仅开发/验收用)
|
||||
|
||||
/login 一律回 HTTP 403 + error_code=DEVICE_LIMIT_EXCEEDED(带 3 台设备明细,上限 2),
|
||||
/unbind-device-with-auth、/card-devices、/info、/check-update、/announcements 回成功 JSON。
|
||||
|
||||
用途:不需要真数据库就能把壳的「设备管理页 / 每行解绑 / 在线状态」全程跑一遍。
|
||||
用法:python3 scripts/mock-vfy-device-limit.py (监听 127.0.0.1:9998)
|
||||
配套验收步骤见 docs/shell-device-ui.md
|
||||
"""
|
||||
import json
|
||||
import sys
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
DEVICES = [
|
||||
{"id": 11, "device_id": "AAAA-1111-2222-3333", "device_name": "工作室-PC01", "device_type": "windows", "online_count": 1, "created_at": "2026-11-01T10:00:00+08:00"},
|
||||
{"id": 12, "device_id": "BBBB-4444-5555-6666", "device_name": "笔记本-Liu", "device_type": "windows", "online_count": 0, "created_at": "2026-11-10T21:12:00+08:00"},
|
||||
{"id": 13, "device_id": "CCCC-7777-8888-9999", "device_name": "ANDROID-9f3c", "device_type": "android", "online_count": 1, "created_at": "2026-11-20T08:30:00+08:00"},
|
||||
]
|
||||
|
||||
|
||||
class H(BaseHTTPRequestHandler):
|
||||
def _log(self, body=b""):
|
||||
sys.stderr.write("[mock] %s %s %s\n" % (self.command, self.path, body[:200].decode("utf-8", "replace")))
|
||||
sys.stderr.flush()
|
||||
|
||||
def do_GET(self):
|
||||
self._log()
|
||||
if "info" in self.path:
|
||||
return self._json(200, {"code": 200, "data": {
|
||||
"allow_register": 1, "enable_register_verify": 1, "enable_password_reset": 1,
|
||||
"password_reset_method": "email", "billing_type": "card", "max_devices": 2,
|
||||
"name": "dogtest"}})
|
||||
if "devices" in self.path or "instances" in self.path:
|
||||
return self._json(200, {"code": 200, "data": {"devices": DEVICES, "max_devices": 2, "device_count": 3}})
|
||||
return self._json(200, {"code": 200, "data": {}})
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length") or 0)
|
||||
body = self.rfile.read(n) if n else b""
|
||||
self._log(body)
|
||||
if self.path.rstrip("/").endswith("/login"):
|
||||
# 与真实后端一致:error_code 放在 data 里;顶层也带一份,壳只按 "DEVICE_LIMIT" 字符串判断
|
||||
return self._json(403, {"code": 403, "error_code": "DEVICE_LIMIT_EXCEEDED",
|
||||
"message": "设备绑定数量已达上限,请解绑后再试",
|
||||
"data": {"error_code": "DEVICE_LIMIT_EXCEEDED",
|
||||
"max_devices": 2, "device_count": 3, "devices": DEVICES}})
|
||||
if "unbind" in self.path:
|
||||
return self._json(200, {"code": 200, "message": "解绑成功"})
|
||||
if "card-devices" in self.path:
|
||||
return self._json(200, {"code": 200, "data": {"devices": DEVICES, "max_devices": 2, "device_count": 3}})
|
||||
return self._json(200, {"code": 200, "data": {}})
|
||||
|
||||
def _json(self, code, obj):
|
||||
raw = json.dumps(obj, ensure_ascii=False, separators=(",", ":")).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json; charset=utf-8")
|
||||
self.send_header("Content-Length", str(len(raw)))
|
||||
self.end_headers()
|
||||
self.wfile.write(raw)
|
||||
|
||||
def log_message(self, *a):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ThreadingHTTPServer(("127.0.0.1", 9998), H).serve_forever()
|
||||
@@ -90,3 +90,32 @@ open(p, 'wb').write(bytes(d))
|
||||
- 壳 DLL 的日志走 `logf_`(本仓库资产里已禁用)。要排查界面/网络问题时,用未打补丁的 DLL
|
||||
或在源码里给 `logf_` 加重定向,别直接改 `%TEMP%` 路径——那是唯一能落盘的取证点。
|
||||
- 验证界面需要窗口管理器:`Xvfb :99` + `openbox`,否则 wine 窗口不映射、截图全是黑屏。
|
||||
|
||||
## 设备已满页 / 我的设备页(2026-11 改版)
|
||||
|
||||
- **设备页做成独立页(QQ 那种观感)**:设备满时窗口从登录尺寸临时放大到 **620×620** 并居中,内容标题变「设备管理」、
|
||||
登录页的 4 个 tab 与品牌字隐藏;点「返回/重试」时窗口尺寸与 tab 自动还原。
|
||||
- 列表每行 = `HorizontalLayout(rowBoxN)` 里「信息按钮(devRowN) + 右侧蓝色『解绑』按钮(devUnbindN)」,行高 40、行间 6px;
|
||||
文字 `序号. 名称 设备ID ● 在线 / ○ 离线`(`online_count > 0` 判在线)。
|
||||
- **点哪行的『解绑』就解绑哪台**,不再需要输入序号(序号输入框整块隐藏,`devIdx`/`btnUnbind` 在 XML 里 `visible="false"` 兜底保留);
|
||||
解绑成功后自动重试登录。实测:点第 2 行的解绑 → `POST /unbind-device-with-auth` 带的是第 2 台的 `device_id`。
|
||||
- 文案:「设备数量已达上限,请先在平台**解绑**一台设备」「超出设备上限时请先**解绑**一台」——原来写「下线」,与按钮实际动作不一致。
|
||||
- 踩坑:`packthemed` 用 `//go:embed` 内嵌壳资产,**改完 assets 必须重编 packthemed**,否则测的还是旧壳(我在这上面浪费过几轮)。
|
||||
- 踩坑:wine 下 DuiLib 的原生 EDIT 子窗口点击不转移焦点,**要点两次**(第一次激活窗口、第二次才聚焦),否则输入会打到上一个输入框。
|
||||
## 手机端壳(Android,`assets/shell_smali.tgz`)
|
||||
|
||||
- 用 `smali assemble vfy -o /tmp/x.dex` 可离线校验语法;平台侧走 apktool 合并 smali 后重建 APK。
|
||||
- 界面是**运行时拼的原生 AlertDialog**(没有 XML 布局、没有皮肤):标题取 `cfg.name`,内容为竖向 LinearLayout(padding 16dp):
|
||||
说明「请输入账号或卡密完成验证」+ 输入框「账号或卡密」+ 密码框(留空则用 cfg 里的 password)+ 提示「通过后自动进入应用」;
|
||||
按钮「验证」(走 `verify()`)与「退出」(`finish()` + `killProcess`)。
|
||||
- 设备超限文案:「设备数超限,请先在平台解绑一台设备」。手机端目前**没有**设备列表/自助解绑页(只有这一道登录闸)。
|
||||
|
||||
## 壳节名:.load(2026-11 起)
|
||||
|
||||
产物里的壳节原名 `.vfy`,现改为 **`.load`**;旧产物仍可识别。改名必须成对做:
|
||||
|
||||
1. `backend/internal/protect/protect.go` 的 `secName = ".load"`(`HasVfy` 同时识别旧 `.vfy`)
|
||||
2. 引导 blob 的节名比较补丁:`blob64.bin` 偏移 `0x85/0x8b/0x91`、`blob32.bin` 偏移 `0x73/0x79/0x7f`,
|
||||
把 `76 66 79`(`vfy`)改成 `6c 6f 61`(`loa`,按前 4 字节匹配 `.load`)
|
||||
|
||||
只改 Go 侧不改 blob → 引导找不到节头,产物启动即 `return 2`;只改 blob 不改 Go → 写进去的还是 `.vfy`,同样对不上。
|
||||
|
||||
@@ -23,7 +23,7 @@ mkdir -p "$OUTDIR"
|
||||
# 导入表按实测产物取:ADVAPI32/bcrypt/COMCTL32/GDI32/gdiplus/KERNEL32/msvcrt/ole32/SHELL32/USER32/WINHTTP
|
||||
x86_64-w64-mingw32-g++ -std=c++17 -O2 -shared -s \
|
||||
-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WIN32_LEAN_AND_MEAN \
|
||||
-I"$DUILIB_DIR" -I"$DUILIB_DIR/DuiLib" -include "$DUILIB_DIR/shim/compat.h" -fpermissive -w \
|
||||
-I"$DUILIB_DIR/shim" -I"$DUILIB_DIR" -I"$DUILIB_DIR/DuiLib" -I"$DUILIB_DIR/DuiLib/Core" -I"$DUILIB_DIR/DuiLib/Control" -I"$DUILIB_DIR/DuiLib/Layout" -I"$DUILIB_DIR/DuiLib/Utils" -include "$DUILIB_DIR/shim/compat.h" -fpermissive -w \
|
||||
-o "$OUTDIR/shell64_dui.dll" "$SRC" "$LIBDUILIB" \
|
||||
-static -lcomctl32 -lgdiplus -lole32 -loleaut32 -luuid -lshlwapi -limm32 -lwinmm -lversion \
|
||||
-lgdi32 -luser32 -lwinhttp -ladvapi32 -lbcrypt -Wl,--kill-at
|
||||
|
||||
@@ -42,9 +42,11 @@ static char g_lastResp[8192] = ""; // 上一次 /login 原始响应(设备
|
||||
static int g_overlay = 0; // 0=正常 1=公告 2=更新 3=设备
|
||||
static int g_devManage = 0; // 1 = 设备面板处于「我的设备」自助模式
|
||||
|
||||
struct DevItem { char id[64]; char name[64]; char created[32]; };
|
||||
struct DevItem { char id[64]; char name[64]; char created[32]; int online; };
|
||||
static DevItem g_devs[16];
|
||||
static int g_devCount = 0, g_devMax = 0;
|
||||
static int g_selIdx = 0; // 设备页手动选中的那台(1 起;0=未选)
|
||||
static int g_baseW = 0, g_baseH = 0; // 登录页原始窗口尺寸(设备管理页会临时放大)
|
||||
|
||||
struct Notice { int id; char title[128]; char body[1024]; };
|
||||
static Notice g_notices[8];
|
||||
@@ -268,7 +270,7 @@ static int api_login(const char *user, const char *pass, char *msg, int cap) {
|
||||
snprintf(g_lastResp, sizeof(g_lastResp), "%s", resp);
|
||||
if (strstr(resp, "\"code\":0") || strstr(resp, "\"code\":200") || strstr(resp, "\"success\":true")) ok = 1;
|
||||
if (!json_str(resp, "message", msg, cap) || !msg[0]) {
|
||||
if (strstr(resp, "DEVICE_LIMIT")) snprintf(msg, cap, "设备数量已达上限,请先在平台下线一台设备");
|
||||
if (strstr(resp, "DEVICE_LIMIT")) snprintf(msg, cap, "设备数量已达上限,请先在平台解绑一台设备");
|
||||
else if (strstr(resp, "IP_LIMIT")) snprintf(msg, cap, "IP 绑定已达上限,请解绑后再试");
|
||||
else if (ok) snprintf(msg, cap, "登录成功");
|
||||
else snprintf(msg, cap, "账号或密码错误");
|
||||
@@ -901,6 +903,11 @@ public:
|
||||
if (!_tcsicmp(nm, _T("btnNoticeOk"))) { SaveNoticeSeen(); HideOverlays(); return; }
|
||||
if (!_tcsicmp(nm, _T("btnUpdate"))) { DoUpdate(); return; }
|
||||
if (!_tcsicmp(nm, _T("btnUpdLater"))) { HideOverlays(); return; }
|
||||
if (!_tcsnicmp(nm, _T("devUnbind"), 9) || !_tcsnicmp(nm, _T("devRow"), 6)) {
|
||||
int sel = _ttoi(nm + (!_tcsnicmp(nm, _T("devUnbind"), 9) ? 9 : 6)) + 1;
|
||||
if (sel >= 1 && sel <= g_devCount) UnbindDeviceIdx(sel);
|
||||
return;
|
||||
}
|
||||
if (!_tcsicmp(nm, _T("btnUnbind"))) { UnbindByIndex(); return; }
|
||||
if (!_tcsicmp(nm, _T("btnUnbindOld"))) { UnbindOldest(); return; }
|
||||
if (!_tcsicmp(nm, _T("btnRetryLogin"))) { HideOverlays(); DoLogin(); return; }
|
||||
@@ -1191,7 +1198,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void ShowTabsAgain() {
|
||||
const TCHAR *names[] = {_T("tabLogin"), _T("tabRegister"), _T("tabCard"), _T("tabReset"), _T("lblApp"), _T("lblBrand")};
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (CControlUI *c = static_cast<CControlUI *>(m_pm.FindControl(names[i]))) c->SetVisible(true);
|
||||
}
|
||||
if (CLabelUI *h = static_cast<CLabelUI *>(m_pm.FindControl(_T("devHead")))) h->SetText(L"设备数量已满");
|
||||
if (CLabelUI *t = static_cast<CLabelUI *>(m_pm.FindControl(_T("lblTitle")))) t->SetText(L"软件授权验证");
|
||||
}
|
||||
|
||||
void RestoreWindowSize() {
|
||||
if (g_baseW > 0) {
|
||||
RECT rc; ::GetWindowRect(m_hWnd, &rc);
|
||||
int sw = ::GetSystemMetrics(SM_CXSCREEN), sh = ::GetSystemMetrics(SM_CYSCREEN);
|
||||
::SetWindowPos(m_hWnd, NULL, (sw - g_baseW) / 2, (sh - g_baseH) / 2, g_baseW, g_baseH, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
}
|
||||
|
||||
void HideOverlays() {
|
||||
RestoreWindowSize();
|
||||
ShowTabsAgain();
|
||||
HideByName("panelNotice"); HideByName("panelUpdate"); HideByName("panelDevice");
|
||||
g_overlay = 0;
|
||||
SwitchTab(g_tab);
|
||||
@@ -1366,6 +1392,7 @@ public:
|
||||
// 把 g_lastResp 里的设备数组解析到 g_devs/后面统一渲染
|
||||
void ParseDevicesInto() {
|
||||
g_devCount = 0;
|
||||
g_selIdx = 0;
|
||||
g_devMax = json_int(g_lastResp, "max_devices", g_maxDevices);
|
||||
const char *p = g_lastResp;
|
||||
while ((p = strstr(p, "\"device_id\":\"")) && g_devCount < 16) {
|
||||
@@ -1379,13 +1406,51 @@ public:
|
||||
}
|
||||
snprintf(g_devs[g_devCount].id, sizeof(g_devs[0].id), "%s", id);
|
||||
snprintf(g_devs[g_devCount].name, sizeof(g_devs[0].name), "%s", name[0] ? name : "未命名设备");
|
||||
g_devs[g_devCount].online = 0;
|
||||
if (const char *oc = strstr(p, "\"online_count\":")) g_devs[g_devCount].online = atoi(oc + 15);
|
||||
g_devCount++;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
// 设备列表渲染:每行 = 信息按钮 + 右侧「解绑」按钮;每行点哪个解哪台
|
||||
void RenderDeviceList() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
TCHAR nm[16];
|
||||
_stprintf(nm, _T("devRow%d"), i);
|
||||
CButtonUI *b = static_cast<CButtonUI *>(m_pm.FindControl(nm));
|
||||
TCHAR bn[16];
|
||||
_stprintf(bn, _T("rowBox%d"), i);
|
||||
CControlUI *box = static_cast<CControlUI *>(m_pm.FindControl(bn));
|
||||
if (!b) continue;
|
||||
if (i < g_devCount) {
|
||||
wchar_t line[320];
|
||||
swprintf(line, 320, L"%d. %ls %ls %ls", i + 1,
|
||||
U8(g_devs[i].name).c_str(), U8(g_devs[i].id).c_str(),
|
||||
g_devs[i].online > 0 ? L"\u25cf \u5728\u7ebf" : L"\u25cb \u79bb\u7ebf");
|
||||
b->SetText(line);
|
||||
if (box) box->SetVisible(true);
|
||||
} else {
|
||||
b->SetText(L"");
|
||||
if (box) box->SetVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ShowDevicePanel() {
|
||||
ParseDevicesInto();
|
||||
g_selIdx = 0;
|
||||
// 设备管理页比登录页大:临时放大窗口(QQ 那种独立设备页的观感)
|
||||
if (g_baseW == 0) {
|
||||
RECT rc; ::GetClientRect(m_hWnd, &rc);
|
||||
g_baseW = rc.right - rc.left; g_baseH = rc.bottom - rc.top;
|
||||
}
|
||||
{
|
||||
int nw = 620, nh = 620;
|
||||
RECT rc; ::GetWindowRect(m_hWnd, &rc);
|
||||
int sw = ::GetSystemMetrics(SM_CXSCREEN), sh = ::GetSystemMetrics(SM_CYSCREEN);
|
||||
::SetWindowPos(m_hWnd, NULL, (sw - nw) / 2, (sh - nh) / 2, nw, nh, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
std::wstring body;
|
||||
for (int i = 0; i < g_devCount; i++) {
|
||||
wchar_t line[256];
|
||||
@@ -1393,6 +1458,7 @@ public:
|
||||
body += line;
|
||||
}
|
||||
if (body.empty()) body = L"(服务器没有返回设备明细,可直接重试登录)";
|
||||
else body = L"点选下面要解绑的那台设备,再按「解绑该设备」";
|
||||
#ifdef VFY_DEBUG
|
||||
{ HANDLE f = ::CreateFileW(L"C:\\vfy_dev.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
if (f != INVALID_HANDLE_VALUE) { std::string dump; char tmp[2048];
|
||||
@@ -1400,11 +1466,21 @@ public:
|
||||
dump = tmp; for (int i2 = 0; i2 < g_devCount; i2++) { snprintf(tmp, sizeof(tmp), "ITEM[%d] name=<%s> id=<%s>\n", i2, g_devs[i2].name, g_devs[i2].id); dump += tmp; }
|
||||
DWORD wr = 0; ::WriteFile(f, dump.c_str(), (DWORD)dump.size(), &wr, NULL); ::CloseHandle(f); } }
|
||||
#endif
|
||||
if (CLabelUI *b = static_cast<CLabelUI *>(m_pm.FindControl(_T("devBody")))) b->SetText(body.c_str());
|
||||
RenderDeviceList(); // 列表正文由它写进 devBody
|
||||
wchar_t title[160];
|
||||
swprintf(title, 160, L"已绑定 %d / %d 台,解绑一台后即可登录", g_devCount, g_devMax > 0 ? g_devMax : g_maxDevices);
|
||||
if (CLabelUI *t = static_cast<CLabelUI *>(m_pm.FindControl(_T("devTitle")))) t->SetText(title);
|
||||
ShowOverlay("panelDevice");
|
||||
if (CLabelUI *h = static_cast<CLabelUI *>(m_pm.FindControl(_T("devHead")))) h->SetText(L"设备管理");
|
||||
if (CLabelUI *t = static_cast<CLabelUI *>(m_pm.FindControl(_T("lblTitle")))) {
|
||||
std::wstring wt = L"设备管理 - " + U8(g_name);
|
||||
t->SetText(wt.c_str());
|
||||
}
|
||||
HideByName("tabLogin"); HideByName("tabRegister"); HideByName("tabCard"); HideByName("tabReset");
|
||||
HideByName("lblApp"); HideByName("lblBrand");
|
||||
if (CLabelUI *tp = static_cast<CLabelUI *>(m_pm.FindControl(_T("devTip"))))
|
||||
tp->SetText(L"点任一行右侧的「解绑」即解绑那一台设备");
|
||||
if (CEditUI *e = static_cast<CEditUI *>(m_pm.FindControl(_T("devIdx")))) { e->SetText(L""); e->SetVisible(false); }
|
||||
}
|
||||
|
||||
// 一键解绑最早绑定的一台(服务器按 created_at DESC 返回,最后一台最老)
|
||||
@@ -1465,7 +1541,7 @@ public:
|
||||
text += line;
|
||||
}
|
||||
if (text.empty()) text = L"当前没有已绑定设备";
|
||||
if (CLabelUI *b = static_cast<CLabelUI *>(m_pm.FindControl(_T("devBody")))) b->SetText(text.c_str());
|
||||
RenderDeviceList(); // 列表正文由它写进 devBody
|
||||
wchar_t title[160];
|
||||
swprintf(title, 160, L"已绑定 %d / %d 台,解绑一台即可换设备登录", g_devCount, g_devMax > 0 ? g_devMax : g_maxDevices);
|
||||
if (CLabelUI *t = static_cast<CLabelUI *>(m_pm.FindControl(_T("devTitle")))) t->SetText(title);
|
||||
@@ -1476,7 +1552,14 @@ public:
|
||||
CLabelUI *tip = static_cast<CLabelUI *>(m_pm.FindControl(_T("devTip")));
|
||||
if (!e || !tip) return;
|
||||
int idx = _wtoi(e->GetText().GetData());
|
||||
if (idx < 1 || idx > g_devCount) { tip->SetText(L"请输入列表里的序号,例如 1"); return; }
|
||||
if (idx < 1) idx = g_selIdx; // 没填序号时用列表里点选的那台
|
||||
if (idx < 1 || idx > g_devCount) { tip->SetText(L"请先在「输入要解绑的设备序号」里填上列表中的序号(例如 1),再按「解绑该设备」"); return; }
|
||||
{
|
||||
wchar_t conf[256];
|
||||
swprintf(conf, 256, L"正在解绑第 %d 台:%ls(%ls)", idx,
|
||||
U8(g_devs[idx - 1].name).c_str(), g_devs[idx - 1].online > 0 ? L"在线" : L"离线");
|
||||
tip->SetText(conf);
|
||||
}
|
||||
UnbindDeviceIdx(idx);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,533 @@
|
||||
// 由 gen_skins_v3.py 生成,不要手改
|
||||
#pragma once
|
||||
|
||||
static const char *kSkin_dark = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="452,548" caption="0,0,-1,44" mininfo="452,548" bkcolor="#FF141418">
|
||||
<VerticalLayout bkcolor="#FF141418" bordercolor="#FF32323A" bordersize="1">
|
||||
<HorizontalLayout height="44" bkcolor="#FF1D1D24">
|
||||
<Label text="软件授权验证" textcolor="#FFF0F0F4" font="1" inset="20,0,0,0" />
|
||||
<Control />
|
||||
<Button name="btnClose" text="X" width="38" height="44" textcolor="#FF9A9AA6"
|
||||
bkcolor="#FF1D1D24" hotbkcolor="#33FFFFFF" pushedbkcolor="#66FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
|
||||
<HorizontalLayout height="42" bkcolor="#FF1D1D24">
|
||||
<VerticalLayout width="86">
|
||||
<Button name="tabLogin" text="登录" textcolor="#FF4EA3E8" bkcolor="#00000000" height="40" />
|
||||
<Control height="2" bkcolor="#FF4EA3E8" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout width="86">
|
||||
<Button name="tabRegister" text="注册" textcolor="#FF85858F" bkcolor="#00000000" height="40" />
|
||||
<Control height="2" bkcolor="#00000000" name="tabRegLine" />
|
||||
</VerticalLayout>
|
||||
</HorizontalLayout>
|
||||
|
||||
<VerticalLayout inset="26,14,26,14">
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FF6FB6E8" height="26" font="1" />
|
||||
<Control height="6" />
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<Label text="账号或卡密" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" password="true" />
|
||||
<Control height="10" />
|
||||
<HorizontalLayout height="22">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FFB4B4BE" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FFB4B4BE" bkcolor="#00000000" width="78" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnLogin" text="登 录" height="44" bkcolor="#FF146FB8" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<Label text="用户名" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regUser" height="34" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="邮箱" textcolor="#FFB4B4BE" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="34" bkcolor="#FF2F6E4E" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Label text="邮箱验证码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regCode" height="34" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regPass" height="34" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" password="true" />
|
||||
<Control height="6" />
|
||||
<Label text="确认密码" textcolor="#FFB4B4BE" height="18" />
|
||||
<Edit name="regPass2" height="34" bkcolor="#FF2A2A33" nativebkcolor="#FF2A2A33" textcolor="#FFF4F4F8" bordercolor="#FF474755" inset="10,0,0,0" password="true" />
|
||||
<Control height="12" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF1F8A5B" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<Control height="6" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF5C5C68" height="18" />
|
||||
<HorizontalLayout height="24">
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF7FA5CC" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF7FA5CC" bkcolor="#00000000" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_light = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="452,548" caption="0,0,-1,44" mininfo="452,548" bkcolor="#FFFAFAFC">
|
||||
<VerticalLayout bkcolor="#FFFAFAFC" bordercolor="#FFDCDCE3" bordersize="1">
|
||||
<HorizontalLayout height="44" bkcolor="#FFFFFFFF">
|
||||
<Label text="软件授权验证" textcolor="#FF1F1F24" font="1" inset="20,0,0,0" />
|
||||
<Control />
|
||||
<Button name="btnClose" text="X" width="38" height="44" textcolor="#FF6B6B75"
|
||||
bkcolor="#FFFFFFFF" hotbkcolor="#33FFFFFF" pushedbkcolor="#66FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
|
||||
<HorizontalLayout height="20" />
|
||||
<HorizontalLayout height="42" inset="26,0,26,0">
|
||||
<Button name="tabLogin" text="登录" width="100" height="40" bkcolor="#FF1B6FD6" textcolor="#FFFFFFFF" font="1" />
|
||||
<Control width="8" />
|
||||
<Button name="tabRegister" text="注册" width="100" height="40" bkcolor="#FFEDF0F5" textcolor="#FF5B6270" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
<VerticalLayout inset="26,16,26,14">
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FF1B6FD6" height="26" font="1" />
|
||||
<Control height="6" />
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<Label text="账号或卡密" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" password="true" />
|
||||
<Control height="10" />
|
||||
<HorizontalLayout height="22">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FF4B5563" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FF4B5563" bkcolor="#00000000" width="78" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnLogin" text="登录" height="44" bkcolor="#FF1B6FD6" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<Label text="用户名" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regUser" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="邮箱" textcolor="#FF4B5563" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="34" bkcolor="#FFD8EAE0" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Label text="邮箱验证码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regCode" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="密码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regPass" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" password="true" />
|
||||
<Control height="6" />
|
||||
<Label text="确认密码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regPass2" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" password="true" />
|
||||
<Control height="12" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF128A5B" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<Control height="6" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF8A8F99" height="18" />
|
||||
<HorizontalLayout height="24">
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF3B62B8" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF3B62B8" bkcolor="#00000000" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_split = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="660,548" caption="0,0,0,0" mininfo="660,548" bkcolor="#FF12151A">
|
||||
<HorizontalLayout bkcolor="#FF12151A" bordercolor="#FF282D35" bordersize="1">
|
||||
<VerticalLayout width="200" bkcolor="#FF1A2230">
|
||||
<HorizontalLayout height="44" inset="24,0,0,0">
|
||||
<Label text="VFY" textcolor="#FF4CC2FF" font="1" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
<VerticalLayout inset="24,4,24,0">
|
||||
<Label text="软件授权" textcolor="#FFC8D3E0" height="28" font="1" />
|
||||
<Label text="SOFTWARE LICENSE" textcolor="#FF63707E" height="20" />
|
||||
<Label text="账号登录后可绑定本机设备" textcolor="#FF4C5A68" height="20" margin="0,14,0,0" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout />
|
||||
<HorizontalLayout height="28" inset="24,0,24,16">
|
||||
<Label text="v9 · DuiLib" textcolor="#FF4A5764" />
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
<VerticalLayout>
|
||||
<HorizontalLayout height="46" inset="28,0,0,0">
|
||||
<VerticalLayout width="80">
|
||||
<Button name="tabLogin" text="登录" height="44" bkcolor="#00000000" textcolor="#FF4CC2FF" font="1" />
|
||||
<Control height="2" bkcolor="#FF4CC2FF" />
|
||||
</VerticalLayout>
|
||||
<VerticalLayout width="80">
|
||||
<Button name="tabRegister" text="注册" height="44" bkcolor="#00000000" textcolor="#FF7A8794" />
|
||||
<Control name="tabRegLine" height="2" bkcolor="#00000000" />
|
||||
</VerticalLayout>
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
<VerticalLayout inset="28,8,28,16">
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FFF0F5FA" height="26" font="1" />
|
||||
<Control height="6" />
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<Label text="账号或卡密" textcolor="#FF8794A3" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FF8794A3" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" password="true" />
|
||||
<Control height="10" />
|
||||
<HorizontalLayout height="22">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FF8794A3" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FF8794A3" bkcolor="#00000000" width="78" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnLogin" text="登录" height="44" bkcolor="#FF2C7BE5" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<Label text="用户名" textcolor="#FF8794A3" height="18" />
|
||||
<Edit name="regUser" height="34" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="邮箱" textcolor="#FF8794A3" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="34" bkcolor="#FF2B6A50" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Label text="邮箱验证码" textcolor="#FF8794A3" height="18" />
|
||||
<Edit name="regCode" height="34" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="密码" textcolor="#FF8794A3" height="18" />
|
||||
<Edit name="regPass" height="34" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" password="true" />
|
||||
<Control height="6" />
|
||||
<Label text="确认密码" textcolor="#FF8794A3" height="18" />
|
||||
<Edit name="regPass2" height="34" bkcolor="#FF1A1F27" nativebkcolor="#FF1A1F27" textcolor="#FFF2F6FA" bordercolor="#FF2E343D" inset="10,0,0,0" password="true" />
|
||||
<Control height="12" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF1F8A5B" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<Control height="6" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF5E6B78" height="18" />
|
||||
<HorizontalLayout height="24">
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF6FA8DC" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF6FA8DC" bkcolor="#00000000" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</HorizontalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_card = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="700,564" caption="0,0,-1,92" mininfo="700,564" bkcolor="#FFF5F6F9">
|
||||
<VerticalLayout bkcolor="#FFF5F6F9" bordercolor="#FFD7DBE3" bordersize="1">
|
||||
<HorizontalLayout height="92" bkcolor="#FF3B2BD6">
|
||||
<VerticalLayout inset="28,16,0,0">
|
||||
<Label text="软件授权验证" textcolor="#FFFFFFFF" font="1" height="34" />
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FFD9D4FF" height="22" />
|
||||
</VerticalLayout>
|
||||
<Control />
|
||||
<Button name="btnClose" text="X" width="46" height="92" textcolor="#FFEDEBFF" bkcolor="#FF3B2BD6" hotbkcolor="#33FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout height="54" inset="28,14,28,0">
|
||||
<Button name="tabLogin" text="登录" width="112" height="38" bkcolor="#FFFFFFFF" textcolor="#FF3B2BD6" font="1" />
|
||||
<Control width="8" />
|
||||
<Button name="tabRegister" text="注册" width="112" height="38" bkcolor="#FFE8E6FF" textcolor="#FF5B56A8" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout inset="28,16,28,18">
|
||||
<VerticalLayout width="260">
|
||||
<Label text="账号安全" textcolor="#FF1F2430" height="26" font="1" />
|
||||
<Label text="登录后账号与本机设备绑定," textcolor="#FF4B5563" height="20" />
|
||||
<Label text="超出设备上限时请先下线一台。" textcolor="#FF4B5563" height="20" />
|
||||
<Control height="12" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF8A8F99" height="20" />
|
||||
<VerticalLayout />
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF3B2BD6" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF3B2BD6" bkcolor="#00000000" />
|
||||
</VerticalLayout>
|
||||
<Control width="28" />
|
||||
<VerticalLayout>
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<Label text="账号或卡密" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FFFFFFFF" nativebkcolor="#FFFFFFFF" textcolor="#FF1F2430" bordercolor="#FFC9D1DC" inset="10,0,0,0" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FFFFFFFF" nativebkcolor="#FFFFFFFF" textcolor="#FF1F2430" bordercolor="#FFC9D1DC" inset="10,0,0,0" password="true" />
|
||||
<Control height="10" />
|
||||
<HorizontalLayout height="22">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FF4B5563" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FF4B5563" bkcolor="#00000000" width="78" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnLogin" text="登录" height="44" bkcolor="#FF3B2BD6" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<Label text="用户名" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regUser" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="邮箱" textcolor="#FF4B5563" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="34" bkcolor="#FFD8EAE0" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Label text="邮箱验证码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regCode" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="密码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regPass" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" password="true" />
|
||||
<Control height="6" />
|
||||
<Label text="确认密码" textcolor="#FF4B5563" height="18" />
|
||||
<Edit name="regPass2" height="34" bkcolor="#FFF1F3F7" nativebkcolor="#FFF1F3F7" textcolor="#FF1F2430" bordercolor="#FFC3CBD8" inset="10,0,0,0" password="true" />
|
||||
<Control height="12" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF128A5B" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_industrial = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="580,548" caption="0,0,-1,46" mininfo="580,548" bkcolor="#FF0A1520">
|
||||
<VerticalLayout bkcolor="#FF0A1520" bordercolor="#FF1F4E79" bordersize="1">
|
||||
<HorizontalLayout height="46" bkcolor="#FF10304C">
|
||||
<Label text="AUTHORIZATION" textcolor="#FF7FD1FF" font="1" inset="18,0,0,0" />
|
||||
<Control />
|
||||
<Button name="tabLogin" text="LOGIN" width="80" height="46" bkcolor="#FF1A5A8C" textcolor="#FFFFFFFF" />
|
||||
<Button name="tabRegister" text="REGISTER" width="96" height="46" bkcolor="#00000000" textcolor="#FF9FC8E6" />
|
||||
<Button name="btnClose" text="X" width="46" height="46" textcolor="#FFBEE3FF" bkcolor="#FF10304C" hotbkcolor="#33FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<VerticalLayout inset="24,16,24,16">
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FF8FC4E6" height="26" font="1" />
|
||||
<Control height="6" />
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<Label text="账号或卡密" textcolor="#FF9FC0D8" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FF9FC0D8" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" password="true" />
|
||||
<Control height="10" />
|
||||
<HorizontalLayout height="22">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FF9FC0D8" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FF9FC0D8" bkcolor="#00000000" width="78" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnLogin" text="登录" height="44" bkcolor="#FF1F6FB2" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<Label text="用户名" textcolor="#FF9FC0D8" height="18" />
|
||||
<Edit name="regUser" height="34" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="邮箱" textcolor="#FF9FC0D8" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="34" bkcolor="#FF1B4A3C" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Label text="邮箱验证码" textcolor="#FF9FC0D8" height="18" />
|
||||
<Edit name="regCode" height="34" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="密码" textcolor="#FF9FC0D8" height="18" />
|
||||
<Edit name="regPass" height="34" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" password="true" />
|
||||
<Control height="6" />
|
||||
<Label text="确认密码" textcolor="#FF9FC0D8" height="18" />
|
||||
<Edit name="regPass2" height="34" bkcolor="#FF14304A" nativebkcolor="#FF14304A" textcolor="#FFEAF6FF" bordercolor="#FF23567F" inset="10,0,0,0" password="true" />
|
||||
<Control height="12" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF1F7A5E" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<Control height="6" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF5F89A6" height="18" />
|
||||
<HorizontalLayout height="24">
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF6FA8C8" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF6FA8C8" bkcolor="#00000000" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_terminal = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="600,548" caption="0,0,-1,38" mininfo="600,548" bkcolor="#FF0B0F0C">
|
||||
<VerticalLayout bkcolor="#FF0B0F0C" bordercolor="#FF2B3A2D" bordersize="1">
|
||||
<HorizontalLayout height="38" bkcolor="#FF101710">
|
||||
<Label text="vfy@local:~$" textcolor="#FF54C97A" inset="14,0,0,0" />
|
||||
<Control />
|
||||
<Button name="btnClose" text="X" width="38" height="38" textcolor="#FF7FB08C" bkcolor="#FF101710" hotbkcolor="#33FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout height="34" bkcolor="#FF0E150F">
|
||||
<Button name="tabLogin" text="[ login ]" width="96" height="34" bkcolor="#00000000" textcolor="#FF7FE39B" />
|
||||
<Button name="tabRegister" text="[ register ]" width="108" height="34" bkcolor="#00000000" textcolor="#FF4E7A5C" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
<VerticalLayout inset="16,10,16,12">
|
||||
<Label name="lblApp" text="# 演示程序" textcolor="#FF7FE39B" height="24" />
|
||||
<Control height="6" />
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<Label text="账号或卡密" textcolor="#FF5E8A6C" height="18" />
|
||||
<Edit name="editUser" height="40" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" />
|
||||
<Control height="10" />
|
||||
<Label text="密码" textcolor="#FF5E8A6C" height="18" />
|
||||
<Edit name="editPass" height="40" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" password="true" />
|
||||
<Control height="10" />
|
||||
<HorizontalLayout height="22">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FF5E8A6C" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FF5E8A6C" bkcolor="#00000000" width="78" />
|
||||
</HorizontalLayout>
|
||||
<Control height="12" />
|
||||
<Button name="btnLogin" text="[ 执行登录 ]" height="44" bkcolor="#FF1B7A4E" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="lblTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<Label text="用户名" textcolor="#FF5E8A6C" height="18" />
|
||||
<Edit name="regUser" height="34" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="邮箱" textcolor="#FF5E8A6C" height="18" />
|
||||
<HorizontalLayout height="38">
|
||||
<Edit name="regEmail" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="104" height="34" bkcolor="#FF234A33" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<Label text="邮箱验证码" textcolor="#FF5E8A6C" height="18" />
|
||||
<Edit name="regCode" height="34" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" />
|
||||
<Control height="6" />
|
||||
<Label text="密码" textcolor="#FF5E8A6C" height="18" />
|
||||
<Edit name="regPass" height="34" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" password="true" />
|
||||
<Control height="6" />
|
||||
<Label text="确认密码" textcolor="#FF5E8A6C" height="18" />
|
||||
<Edit name="regPass2" height="34" bkcolor="#FF16211A" nativebkcolor="#FF16211A" textcolor="#FFD7F5DF" bordercolor="#FF2B3A2D" inset="10,0,0,0" password="true" />
|
||||
<Control height="12" />
|
||||
<Button name="btnRegister" text="注册并登录" height="44" bkcolor="#FF1B7A4E" textcolor="#FFFFFFFF" font="1" />
|
||||
<Label name="regTip" text="" textcolor="#FFE08A8A" height="24" inset="0,6,0,0" />
|
||||
|
||||
</VerticalLayout>
|
||||
<Control height="6" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF4E7A5C" height="18" />
|
||||
<HorizontalLayout height="24">
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF6FA08A" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF6FA08A" bkcolor="#00000000" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
static const char *kSkin_compact = R"SKIN(<?xml version="1.0" encoding="utf-8"?>
|
||||
<Window size="760,206" caption="0,0,-1,38" mininfo="760,206" bkcolor="#FF11151A">
|
||||
<VerticalLayout bkcolor="#FF11151A" bordercolor="#FF2A3440" bordersize="1">
|
||||
<HorizontalLayout height="38" bkcolor="#FF161C22">
|
||||
<Label text="账号" textcolor="#FFA8BCCE" inset="16,0,0,0" />
|
||||
<Control />
|
||||
<Button name="btnClose" text="X" width="38" height="38" textcolor="#FFA8BCCE" bkcolor="#FF161C22" hotbkcolor="#33FFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout inset="16,12,16,10">
|
||||
<VerticalLayout width="200">
|
||||
<Label name="lblApp" text="演示程序" textcolor="#FFEAF2FA" height="26" font="1" />
|
||||
<Label name="lblDevice" text="设备" textcolor="#FF6B7C8C" height="20" />
|
||||
<Control height="12" />
|
||||
<Button name="tabLogin" text="登录" width="90" height="32" bkcolor="#FF2E9E6B" textcolor="#FFFFFFFF" />
|
||||
<Control height="6" />
|
||||
<Button name="tabRegister" text="注册" width="90" height="32" bkcolor="#FF1B232B" textcolor="#FF9FB3C8" />
|
||||
</VerticalLayout>
|
||||
<Control width="16" />
|
||||
<VerticalLayout>
|
||||
<VerticalLayout name="panelLogin" height="auto">
|
||||
<HorizontalLayout height="40">
|
||||
<HorizontalLayout width="214" bkcolor="#FF1B232B">
|
||||
<Label text="账号" width="46" textcolor="#FF7E90A2" inset="10,0,0,0" />
|
||||
<Edit name="editUser" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" inset="0,0,0,0" />
|
||||
</HorizontalLayout>
|
||||
<Control width="10" />
|
||||
<HorizontalLayout width="214" bkcolor="#FF1B232B">
|
||||
<Label text="密码" width="46" textcolor="#FF7E90A2" inset="10,0,0,0" />
|
||||
<Edit name="editPass" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" inset="0,0,0,0" password="true" />
|
||||
</HorizontalLayout>
|
||||
<Control width="10" />
|
||||
<Button name="btnLogin" text="登录" width="110" height="40" bkcolor="#FF2E9E6B" textcolor="#FFFFFFFF" font="1" />
|
||||
</HorizontalLayout>
|
||||
<HorizontalLayout height="26">
|
||||
<Label name="chkBox" width="14" height="14" bkcolor="#00000000" bordercolor="#FF6B7C8C" bordersize="1" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRemember" text="记住账号" textcolor="#FF6B7C8C" bkcolor="#00000000" width="120" />
|
||||
<Label name="lblTip" text="" textcolor="#FFD98A8A" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout height="24">
|
||||
<Button name="btnLinkCard" text="卡密充值" width="96" textcolor="#FF7FA5CC" bkcolor="#00000000" />
|
||||
<Button name="btnLinkForgot" text="忘记密码" width="96" textcolor="#FF7FA5CC" bkcolor="#00000000" />
|
||||
<Control />
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
<VerticalLayout name="panelRegister" height="auto" visible="false">
|
||||
<HorizontalLayout height="36">
|
||||
<Edit name="regUser" width="160" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" bordercolor="#FF32404E" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Edit name="regEmail" width="200" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" bordercolor="#FF32404E" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Button name="btnSendCode" text="发送验证码" width="100" height="36" bkcolor="#FF234A33" textcolor="#FFFFFFFF" />
|
||||
</HorizontalLayout>
|
||||
<Control height="6" />
|
||||
<HorizontalLayout height="36">
|
||||
<Edit name="regCode" width="160" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" bordercolor="#FF32404E" inset="10,0,0,0" />
|
||||
<Control width="8" />
|
||||
<Edit name="regPass" width="150" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" bordercolor="#FF32404E" inset="10,0,0,0" password="true" />
|
||||
<Control width="8" />
|
||||
<Edit name="regPass2" width="150" bkcolor="#FF1B232B" nativebkcolor="#FF1B232B" textcolor="#FFFFFFFF" bordercolor="#FF32404E" inset="10,0,0,0" password="true" />
|
||||
<Control width="8" />
|
||||
<Button name="btnRegister" text="注册" width="90" height="36" bkcolor="#FF2E9E6B" textcolor="#FFFFFFFF" font="1" />
|
||||
</HorizontalLayout>
|
||||
<Label name="regTip" text="" textcolor="#FFD98A8A" height="22" />
|
||||
</VerticalLayout>
|
||||
</VerticalLayout>
|
||||
</HorizontalLayout>
|
||||
</VerticalLayout>
|
||||
</Window>)SKIN";
|
||||
|
||||
struct SkinDef { const char *name; const char *xml; int w, h; };
|
||||
static const SkinDef kSkins[] = {
|
||||
{ "dark", kSkin_dark, 452, 548 },
|
||||
{ "light", kSkin_light, 452, 548 },
|
||||
{ "split", kSkin_split, 660, 548 },
|
||||
{ "card", kSkin_card, 700, 564 },
|
||||
{ "industrial", kSkin_industrial, 580, 548 },
|
||||
{ "terminal", kSkin_terminal, 600, 548 },
|
||||
{ "compact", kSkin_compact, 760, 206 },
|
||||
{ NULL, NULL, 0, 0 }
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user