refactor: Update PeerInfo to extract and store comprehensive device information

This commit is contained in:
Prad Nukala (aider)
2024-12-08 19:45:14 -05:00
parent fb9f41248f
commit d9f2b21812
2 changed files with 49 additions and 24 deletions
+8 -4
View File
@@ -48,11 +48,15 @@ func (s *HTTPContext) InitSession() error {
result := s.db.Where("id = ?", sessionID).First(&sess)
if result.Error != nil {
// Create new session if not found
bn, bv := extractBrowserInfo(s.Context)
bn, bv, arch, plat, platVer, model := extractBrowserInfo(s.Context)
sess = database.Session{
ID: sessionID,
BrowserName: bn,
BrowserVersion: bv,
ID: sessionID,
BrowserName: bn,
BrowserVersion: bv,
UserArchitecture: arch,
Platform: plat,
PlatformVersion: platVer,
DeviceModel: model,
}
if err := s.db.Create(&sess).Error; err != nil {
return err