public HFTWebServer(HFTRuntimeOptions options, string[] addresses) { m_log = new HFTLog("HFTWebServer"); m_options = options; m_gamePath = "/"; m_webServerUtils = new HFTWebServerUtils(m_gamePath); // Touch the HFTWebFileDB // We do this be because we want it to get the list // of files BEFORE run the server. The server will // run in a different thread and HFTWebFileDB will // not be able to populate its database from that thread. HFTWebFileDB.GetInstance(); // FIX: sysname and gamename string sysName = Environment.MachineName; if (sysName.EndsWith(".local")) { sysName = sysName.Substring(0, sysName.Length - 6); } string gameName = m_options.name; string ping = Serializer.Serialize(new HFTPing(sysName + ": " + gameName, "HappyFunTimes")); m_ping = System.Text.Encoding.UTF8.GetBytes(ping); m_log.Info("Ping: " + ping); m_liveSettingsStr = "define([], function() { return " + Serializer.Serialize(new LiveSettings()) + "; })\n"; m_liveSettings = System.Text.Encoding.UTF8.GetBytes(m_liveSettingsStr); if (options.captivePortal || options.installationMode) { m_captivePortalHandler = new HFTCaptivePortalHandler(m_webServerUtils); m_getRouter.Add(m_captivePortalHandler.HandleRequest); } m_getRouter.Add(HandleRoot); m_getRouter.Add(HandleLiveSettings); m_getRouter.Add(HandleFile); m_getRouter.Add(HandleMissingRoute); m_getRouter.Add(HandleNotFound); m_postCmdHandlers["happyFunTimesPingForGame"] = HandleCmdPingForGame; m_postCmdHandlers["happyFunTimesPing"] = HandleCmdPing; m_postCmdHandlers["happyFunTimesRedir"] = HandleCmdRedir; m_postCmdHandlers["time"] = HandleCmdTime; m_postCmdHandlers["quit"] = HandleCmdQuit; m_addresses = addresses; }
public HFTWebServer(HFTRuntimeOptions options, string[] addresses) { m_log = new HFTLog("HFTWebServer"); m_options = options; m_gamePath = "/"; m_webServerUtils = new HFTWebServerUtils(m_gamePath); // Touch the HFTWebFileDB // We do this be because we want it to get the list // of files BEFORE run the server. The server will // run in a different thread and HFTWebFileDB will // not be able to populate its database from that thread. HFTWebFileDB.GetInstance(); // FIX: sysname and gamename string sysName = Environment.MachineName; if (sysName.EndsWith(".local")) { sysName = sysName.Substring(0, sysName.Length - 6); } string gameName = m_options.name; string ping = Serializer.Serialize(new HFTPing(sysName + ": " + gameName, "HappyFunTimes")); m_ping = System.Text.Encoding.UTF8.GetBytes(ping); m_log.Info("Ping: " + ping); m_liveSettingsStr = "define([], function() { return " + Serializer.Serialize(new LiveSettings()) + "; })\n"; m_liveSettings = System.Text.Encoding.UTF8.GetBytes(m_liveSettingsStr); if (options.captivePortal || options.installationMode) { m_captivePortalHandler = new HFTCaptivePortalHandler(m_webServerUtils); m_getRouter.Add(m_captivePortalHandler.HandleRequest); } m_getRouter.Add(HandleRoot); m_getRouter.Add(HandleLiveSettings); m_getRouter.Add(HandleFile); m_getRouter.Add(HandleMissingRoute); m_getRouter.Add(HandleNotFound); m_addresses = addresses; }
public HFTCaptivePortalHandler(HFTWebServerUtils utils) { m_webServerUtils = utils; m_appleResponseContent = System.Text.Encoding.UTF8.GetBytes("<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>"); }
public HFTCaptivePortalHandler(HFTWebServerUtils utils) { m_log.Tell("Fix hard coded url"); m_webServerUtils = utils; m_appleResponseContent = System.Text.Encoding.UTF8.GetBytes("<HTML><HEAD><TITLE>Success</TITLE></HEAD><BODY>Success</BODY></HTML>"); }