mirror of
				https://gitlab.crans.org/nounous/ghostream.git
				synced 2025-11-04 15:42:26 +01:00 
			
		
		
		
	Sum all user counts for each substream to have the total number of clients that are connected to a stream
This commit is contained in:
		@@ -150,14 +150,17 @@ func staticHandler() http.Handler {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func statisticsHandler(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	name := strings.Replace(r.URL.Path[7:], "/", "", -1)
 | 
			
		||||
	name := strings.SplitN(strings.Replace(r.URL.Path[7:], "/", "", -1), "@", 2)[0]
 | 
			
		||||
	userCount := 0
 | 
			
		||||
 | 
			
		||||
	// Get all substreams
 | 
			
		||||
	for _, outputType := range []string{"", "@720p", "@480p", "@360p", "@240p", "@text"} {
 | 
			
		||||
		// Get requested stream
 | 
			
		||||
	stream, ok := streams[name]
 | 
			
		||||
		stream, ok := streams[name+outputType]
 | 
			
		||||
		if ok {
 | 
			
		||||
			// Get number of output channels
 | 
			
		||||
		userCount = stream.ClientCount()
 | 
			
		||||
			userCount += stream.ClientCount()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Display connected users statistics
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user