|
@@ -41,7 +41,10 @@ type HwidSlotStatus struct {
|
|
|
Full bool `json:"full" example:"false"`
|
|
Full bool `json:"full" example:"false"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const minHwidLength = 6
|
|
|
|
|
|
|
+const (
|
|
|
|
|
+ minHwidLength = 6
|
|
|
|
|
+ hwidFingerprintLength = 12
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
type ClientHwidInfo struct {
|
|
type ClientHwidInfo struct {
|
|
|
Id int `json:"id"`
|
|
Id int `json:"id"`
|
|
@@ -51,6 +54,7 @@ type ClientHwidInfo struct {
|
|
|
DeviceOS string `json:"deviceOs"`
|
|
DeviceOS string `json:"deviceOs"`
|
|
|
OsVersion string `json:"osVersion"`
|
|
OsVersion string `json:"osVersion"`
|
|
|
DeviceModel string `json:"deviceModel"`
|
|
DeviceModel string `json:"deviceModel"`
|
|
|
|
|
+ Fingerprint string `json:"fingerprint"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func hashHwid(raw string) string {
|
|
func hashHwid(raw string) string {
|
|
@@ -58,6 +62,13 @@ func hashHwid(raw string) string {
|
|
|
return hex.EncodeToString(sum[:])
|
|
return hex.EncodeToString(sum[:])
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func shortHwidFingerprint(hash string) string {
|
|
|
|
|
+ if len(hash) <= hwidFingerprintLength {
|
|
|
|
|
+ return hash
|
|
|
|
|
+ }
|
|
|
|
|
+ return hash[:hwidFingerprintLength]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func trimHwidMeta(s string) string {
|
|
func trimHwidMeta(s string) string {
|
|
|
s = strings.TrimSpace(s)
|
|
s = strings.TrimSpace(s)
|
|
|
r := []rune(s)
|
|
r := []rune(s)
|
|
@@ -232,6 +243,7 @@ func (s *ClientService) ListClientHwids(email string) ([]ClientHwidInfo, error)
|
|
|
DeviceOS: r.DeviceOS,
|
|
DeviceOS: r.DeviceOS,
|
|
|
OsVersion: r.OsVersion,
|
|
OsVersion: r.OsVersion,
|
|
|
DeviceModel: r.DeviceModel,
|
|
DeviceModel: r.DeviceModel,
|
|
|
|
|
+ Fingerprint: shortHwidFingerprint(r.HwidHash),
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
return out, nil
|
|
return out, nil
|