diff --git a/services/user_service_impl.go b/services/user_service_impl.go index 253add1..ea38bb8 100644 --- a/services/user_service_impl.go +++ b/services/user_service_impl.go @@ -41,7 +41,7 @@ func (service UserServiceImpl) UserInfo(_ *fiber.Ctx, request structs.UserInfoRe device = append(device, structs.UserInfoResponseDataDevice{ User: j.User, Agent: j.Agent, - Device: j.Device, + Device: utils.GetPlatformName(int(j.Device)), Server: j.Server, AD: j.AD, }) diff --git a/structs/send_struct.go b/structs/send_struct.go index 23298c8..50df8be 100644 --- a/structs/send_struct.go +++ b/structs/send_struct.go @@ -14,7 +14,7 @@ type UserInfoRequest struct { type UserInfoResponseDataDevice struct { User string Agent uint8 - Device uint8 + Device string Server string AD bool } diff --git a/utils/whatsapp.go b/utils/whatsapp.go index 5d4b924..ce1824f 100644 --- a/utils/whatsapp.go +++ b/utils/whatsapp.go @@ -29,6 +29,35 @@ var ( const logLevel = "DEBUG" +func GetPlatformName(deviceID int) string { + switch deviceID { + case 2: + return "UNKNOWN" + case 3: + return "CHROME" + case 4: + return "FIREFOX" + case 5: + return "IE" + case 6: + return "OPERA" + case 7: + return "SAFARI" + case 8: + return "EDGE" + case 9: + return "DESKTOP" + case 10: + return "IPAD" + case 11: + return "ANDROID_TABLET" + case 12: + return "OHANA" + default: + return "UNKNOWN" + } +} + func ParseJID(arg string) (types.JID, bool) { if arg[0] == '+' { arg = arg[1:]