Sync PHP backend feature parity: IP detection, database backends, API endpoints, and frontend

- IP detection: Cloudflare IPv6, ULA IPv6, proxy header chain, offline GeoIP DB
- Database: add SQLite (pure Go, no CGo) and MSSQL backends
- API: add JSON result sharing endpoint and ID obfuscation
- Frontend: add modern CSS design, design switcher, favicon
- Compatibility: ?cors parameter support, human-friendly distance rounding
- Update Go to 1.21, add modernc.org/sqlite and maxminddb deps
This commit is contained in:
Maddie Zhan
2026-04-30 13:53:52 +08:00
parent 603cbdeec5
commit cd20f44d20
39 changed files with 3005 additions and 851 deletions
+8 -2
View File
@@ -201,7 +201,12 @@ func Record(w http.ResponseWriter, r *http.Request) {
return
}
if _, err := w.Write([]byte("id " + uuid.String())); err != nil {
responseID := uuid.String()
if config.LoadedConfig().EnableIDObfuscation {
responseID = ObfuscateULID(uuid.String())
}
if _, err := w.Write([]byte("id " + responseID)); err != nil {
log.Errorf("Error writing ID to telemetry request: %s", err)
w.WriteHeader(http.StatusInternalServerError)
}
@@ -214,7 +219,8 @@ func DrawPNG(w http.ResponseWriter, r *http.Request) {
return
}
uuid := r.FormValue("id")
rawID := r.FormValue("id")
uuid := ResolveID(rawID)
record, err := database.DB.FetchByUUID(uuid)
if err != nil {
log.Errorf("Error querying database: %s", err)