This repository has been archived on 2025-06-10. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
server/admin/api/timestamp.go

26 lines
510 B
Go

package api
import (
"os"
"time"
"github.com/julienschmidt/httprouter"
)
var TimestampCheck = "submissions"
func init() {
router.GET("/api/timestamps.json", apiHandler(
func(httprouter.Params, []byte) (interface{}, error) {
if stat, err := os.Stat(TimestampCheck); err != nil {
return nil, err
} else {
now := time.Now().UTC()
return map[string]interface{}{
"frontend": stat.ModTime().UTC(),
"backend": now,
"diffFB": now.Sub(stat.ModTime()),
}, nil
}
}))
}