| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -20,14 +20,14 @@ import (
					 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					type Config struct { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						NethackLauncher struct { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							Loglevel        string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							ServerDisplay   string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							NethackVersion  string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							InProgressDir   string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							UserDir         string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							RecordLocation  string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							ReclistLocation string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							BootstrapDelay  time.Duration | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							Loglevel           string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							ServerDisplay      string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							NethackVersion     string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							InProgressDir      string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							UserDir            string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							RecordFileLocation string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							ReclistLocation    string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							BootstrapDelay     time.Duration | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						Redis struct { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -98,8 +98,8 @@ func initRedisConnection() (*redis.Client, error) {
					 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
					func checkFiles() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						// make sure record file exists
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						if _, err := os.Stat(config.NethackLauncher.RecordLocation); os.IsNotExist(err) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							glogger.Info.Printf("record file not found in %s\n", config.NethackLauncher.RecordLocation) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						if _, err := os.Stat(config.NethackLauncher.RecordFileLocation); os.IsNotExist(err) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							glogger.Info.Printf("record file not found in %s\n", config.NethackLauncher.RecordFileLocation) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							fmt.Printf("%s\n", err) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							os.Exit(1) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -195,11 +195,12 @@ func printUserScreen(redisClient *redis.Client, username string) string {
					 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								// restart display
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								clearScreen() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								nh := exec.Command("nethack", "-u", username) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								nh := exec.Command("ttyrec", "yeto.ttyrec", "-e", "nethack", "-u", username) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								nh.Stdout = os.Stdout | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								nh.Stdin = os.Stdin | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								nh.Stderr = os.Stderr | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								nh.Run() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								exec.Command("exit").Run() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								printUserScreen(redisClient, username) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							case "q": | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
								clearScreen() | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				 | 
				
					@ -433,7 +434,7 @@ func gethighscore(w http.ResponseWriter, r *http.Request) {
					 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						// run script
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						output, err := exec.Command(config.NethackLauncher.ReclistLocation, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							"-f", | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							config.NethackLauncher.RecordLocation).CombinedOutput() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							config.NethackLauncher.RecordFileLocation).CombinedOutput() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						if err != nil { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
							fmt.Printf("%s\n", err) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				 | 
				
						} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				 | 
				
					
 
					 |