2022-07-30 13:47:47 +00:00
|
|
|
// townstats returns information about tilde.town in the tilde data protcol format
|
|
|
|
// It was originally a Python script written by Michael F. Lamb <https://datagrok.org>
|
|
|
|
// License: GPLv3+
|
|
|
|
|
|
|
|
// TDP is defined at http://protocol.club/~datagrok/beta-wiki/tdp.html
|
|
|
|
// Usage: stats > /var/www/html/tilde.json
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
2023-02-28 23:17:59 +00:00
|
|
|
"git.tilde.town/tildetown/town/stats"
|
|
|
|
)
|
2022-07-30 13:47:47 +00:00
|
|
|
|
|
|
|
func main() {
|
2023-02-28 23:17:59 +00:00
|
|
|
systemData, err := stats.Stats()
|
2022-07-30 13:47:47 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
data, err := json.Marshal(systemData)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Failed to marshal JSON: %s", err)
|
|
|
|
}
|
|
|
|
fmt.Printf("%s\n", data)
|
|
|
|
}
|