mirror of
				https://bitbucket.org/s_l_teichmann/mtsatellite
				synced 2025-11-04 09:55:34 +01:00 
			
		
		
		
	Add stub for players controller.
This commit is contained in:
		@@ -29,6 +29,7 @@ func main() {
 | 
			
		||||
		transparent bool
 | 
			
		||||
		updateHosts string
 | 
			
		||||
		websockets  bool
 | 
			
		||||
		playersFIFO string
 | 
			
		||||
	)
 | 
			
		||||
	flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
 | 
			
		||||
	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(&websockets, "websockets", false, "Forward tile changes to clients via websockets.")
 | 
			
		||||
	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()
 | 
			
		||||
 | 
			
		||||
@@ -63,6 +66,12 @@ func main() {
 | 
			
		||||
 | 
			
		||||
	var btu baseTilesUpdates
 | 
			
		||||
 | 
			
		||||
	if playersFIFO != "" {
 | 
			
		||||
		plys := newPlayers(playersFIFO)
 | 
			
		||||
		go plys.run()
 | 
			
		||||
		router.Path("/players").Methods("GET").Handler(plys)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if websockets {
 | 
			
		||||
		wsf := newWebsocketForwarder()
 | 
			
		||||
		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!
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user