Skip to content

Commit

Permalink
Update /api/stats
Browse files Browse the repository at this point in the history
  • Loading branch information
MineGame159 committed Jan 8, 2025
1 parent a465335 commit c6ed103
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
12 changes: 3 additions & 9 deletions pkg/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ import (
)

type Config struct {
Port int `json:"port"`
Debug bool `json:"debug"`
Version string `json:"version"`
DevBuildVersion string `json:"dev_build_version"`
McVersion string `json:"mc_version"`
DevBuildMcVersion string `json:"dev_build_mc_version"`
BaritoneMcVersion string `json:"baritone_mc_version"`
MaxDevBuilds int `json:"max_dev_builds"`
Changelog []string `json:"changelog"`
Port int `json:"port"`
Debug bool `json:"debug"`
BaritoneMcVersion string `json:"baritone_mc_version"`
}

type PrivateConfig struct {
Expand Down
12 changes: 3 additions & 9 deletions pkg/db/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
)

type Global struct {
Downloads int `bson:"downloads"`
TotalAccounts int `bson:"totalAccounts"`
SupportMessage int64 `bson:"supportMessage"`
DevBuild string `bson:"devBuild"`
DevBuildVersion string `bson:"devBuildVersion"`
Downloads int `bson:"downloads"`
TotalAccounts int `bson:"totalAccounts"`
SupportMessage int64 `bson:"supportMessage"`
}

var cache Global
Expand All @@ -31,7 +29,3 @@ func GetGlobal() Global {

return cache
}

func SetDevBuild(devBuild string) {
_, _ = global.UpdateOne(nil, bson.M{"id": "Stats"}, bson.M{"$set": bson.M{"devBuild": devBuild}})
}
3 changes: 0 additions & 3 deletions pkg/web/api/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ type Stats struct {
core.Config

Date string `json:"date"`
DevBuild string `json:"devBuild"`
Downloads int `json:"downloads"`
OnlinePlayers int `json:"onlinePlayers"`
OnlineUUIDs int `json:"onlineUUIDs"`

Builds map[string]int `json:"builds"`
}
Expand Down Expand Up @@ -52,7 +50,6 @@ func StatsHandler(w http.ResponseWriter, r *http.Request) {
core.Json(w, Stats{
Config: core.GetConfig(),
Date: core.GetDate(),
DevBuild: g.DevBuild,
Downloads: g.Downloads,
OnlinePlayers: GetPlayingCount(),
Builds: builds,
Expand Down

0 comments on commit c6ed103

Please sign in to comment.