change around pings, fix main.js so the actual real fucking number shows instead of it freaking out.

This commit is contained in:
KingKDot
2026-07-09 13:55:36 -05:00
parent f96b3d0721
commit 43ee5a7d4b
12 changed files with 293 additions and 32 deletions
+22 -14
View File
@@ -3,36 +3,44 @@ package handlers
import "encoding/json"
func extractTimestamp(v interface{}) int64 {
ts, ok := extractTimestampIfPresent(v)
if !ok {
return 0
}
return ts
}
func extractTimestampIfPresent(v interface{}) (int64, bool) {
switch t := v.(type) {
case uint64:
if t <= uint64(^uint64(0)>>1) {
return int64(t)
return int64(t), true
}
return 0
return 0, false
case uint32:
return int64(t)
return int64(t), true
case uint16:
return int64(t)
return int64(t), true
case uint8:
return int64(t)
return int64(t), true
case int64:
return t
return t, true
case int32:
return int64(t)
return int64(t), true
case int16:
return int64(t)
return int64(t), true
case int8:
return int64(t)
return int64(t), true
case int:
return int64(t)
return int64(t), true
case float64:
return int64(t)
return int64(t), true
case float32:
return int64(t)
return int64(t), true
case json.Number:
if n, err := t.Int64(); err == nil {
return n
return n, true
}
}
return 0
return 0, false
}