forked from tildetown/town
29 lines
622 B
Go
29 lines
622 B
Go
// 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"
|
|
|
|
"git.tilde.town/tildetown/town/stats"
|
|
)
|
|
|
|
func main() {
|
|
systemData, err := stats.Stats()
|
|
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)
|
|
}
|