mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-08 11:10:27 +01:00
Add stub for players controller.
This commit is contained in:
parent
89413f753c
commit
ece8924355
|
@ -29,6 +29,7 @@ func main() {
|
||||||
transparent bool
|
transparent bool
|
||||||
updateHosts string
|
updateHosts string
|
||||||
websockets bool
|
websockets bool
|
||||||
|
playersFIFO string
|
||||||
)
|
)
|
||||||
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
||||||
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
||||||
|
@ -53,6 +54,8 @@ func main() {
|
||||||
flag.BoolVar(&transparent, "t", false, "Render transparent blocks (shorthand).")
|
flag.BoolVar(&transparent, "t", false, "Render transparent blocks (shorthand).")
|
||||||
flag.BoolVar(&websockets, "websockets", false, "Forward tile changes to clients via websockets.")
|
flag.BoolVar(&websockets, "websockets", false, "Forward tile changes to clients via websockets.")
|
||||||
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
|
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
|
||||||
|
flag.StringVar(&playersFIFO, "players", "", "Path to FIFO file to read active players from.")
|
||||||
|
flag.StringVar(&playersFIFO, "ps", "", "Path to FIFO file to read active players from (shorthand).")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
@ -63,6 +66,12 @@ func main() {
|
||||||
|
|
||||||
var btu baseTilesUpdates
|
var btu baseTilesUpdates
|
||||||
|
|
||||||
|
if playersFIFO != "" {
|
||||||
|
plys := newPlayers(playersFIFO)
|
||||||
|
go plys.run()
|
||||||
|
router.Path("/players").Methods("GET").Handler(plys)
|
||||||
|
}
|
||||||
|
|
||||||
if websockets {
|
if websockets {
|
||||||
wsf := newWebsocketForwarder()
|
wsf := newWebsocketForwarder()
|
||||||
go wsf.run()
|
go wsf.run()
|
||||||
|
|
21
cmd/mtwebmapper/players.go
Normal file
21
cmd/mtwebmapper/players.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
type players struct {
|
||||||
|
fifo string
|
||||||
|
}
|
||||||
|
|
||||||
|
func newPlayers(fifo string) *players {
|
||||||
|
return &players{fifo: fifo}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ps *players) run() {
|
||||||
|
for {
|
||||||
|
// TODO: Implement me!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ps *players) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
// TODO: Implement me!
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user