diff --git a/public/game-login.html b/public/game-login.html index abbf44e8..0eca69d1 100644 --- a/public/game-login.html +++ b/public/game-login.html @@ -64,7 +64,7 @@

HappyFunTimes

- +
diff --git a/server/apple-captive-portal-handler.js b/server/apple-captive-portal-handler.js index 80149e89..38497ea0 100644 --- a/server/apple-captive-portal-handler.js +++ b/server/apple-captive-portal-handler.js @@ -81,6 +81,7 @@ var AppleCaptivePortalHandler = function(options) { // return my redirection page the first time and apple's success page the second time this.sessions = {}; this.options = options; + this.firstPath = "/enter-name.html"; }; /** @@ -92,6 +93,15 @@ var AppleCaptivePortalHandler = function(options) { * @property {string} baseDir path to portal files */ +/** + * Sets the path we go to after the user picks `[Start]` + * @param {string} path path to go to . Default is + * "/enter-name.html" + */ +AppleCaptivePortalHandler.prototype.setFirstPath = function(path) { + this.firstPath = path +}; + /** * Check if this request has something to do with captive portal * handling and if so handle it. @@ -106,7 +116,7 @@ AppleCaptivePortalHandler.prototype.check = function(req, res) { var sessionId = filePath; var isCheckingForApple = req.headers["user-agent"] && strings.startsWith(req.headers["user-agent"], "CaptiveNetworkSupport"); var isLoginURL = (filePath == "/game-login.html"); - var isIndexURL = (filePath == "/index.html" || filePath == "/" || filePath == "/enter-name.html"); + var isIndexURL = (filePath == "/index.html" || filePath == "/" || filePath == this.firstPath); if (isIndexURL) { sessionId = parsedUrl.query.sessionId; @@ -166,6 +176,7 @@ AppleCaptivePortalHandler.prototype.sendCaptivePortalHTML = function(req, res, s var params = { sessionId: sessionId, localhost: this.options.address + ":" + this.options.port, + firstPath: this.firstPath, }; str = strings.replaceParams(str, params); return str; diff --git a/server/common-cli-options.js b/server/common-cli-options.js index 19beefe1..445c77a5 100644 --- a/server/common-cli-options.js +++ b/server/common-cli-options.js @@ -32,14 +32,15 @@ "use strict"; exports.options = [ - { option: 'port', alias: 'p', type: 'Int', description: 'port. Default 18679'}, - { option: 'dns', type: 'Boolean', description: 'enable dns server'}, - { option: 'address', type: 'String', description: 'ip address for dns and controller url conversion'}, - { option: 'app-mode', type: 'Boolean', description: 'run as an app'}, - { option: 'show', type: 'String', description: 'html file to launch, default "games"'}, - { option: 'system-name', type: 'String', description: 'name used if multiple happyFunTimes servers are running on the same network. Default = computer name'}, - { option: 'ask-name', type: 'Boolean', description: 'ask for name on start, use --no-ask-name to set to false', default: "true"}, - { option: 'menu', type: 'Boolean', description: 'show menu icon on controller, use --no-menu to turn off', default: "true"}, - { option: 'minify', type: 'Boolean', description: 'minify -minify.js files', default: false}, + { option: 'port', alias: 'p', type: 'Int', description: 'port. Default 18679'}, + { option: 'dns', type: 'Boolean', description: 'enable dns server'}, + { option: 'address', type: 'String', description: 'ip address for dns and controller url conversion'}, + { option: 'app-mode', type: 'Boolean', description: 'run as an app'}, + { option: 'show', type: 'String', description: 'html file to launch, default "games"'}, + { option: 'system-name', type: 'String', description: 'name used if multiple happyFunTimes servers are running on the same network. Default = computer name'}, + { option: 'ask-name', type: 'Boolean', description: 'ask for name on start, use --no-ask-name to set to false', default: "true"}, + { option: 'menu', type: 'Boolean', description: 'show menu icon on controller, use --no-menu to turn off', default: "true"}, + { option: 'minify', type: 'Boolean', description: 'minify -minify.js files', default: false}, + { option: 'kiosk', type: 'Boolean', description: 'skip the index', default: false}, ]; diff --git a/server/hft-server.js b/server/hft-server.js index 4e237a46..2ab1fccd 100644 --- a/server/hft-server.js +++ b/server/hft-server.js @@ -310,6 +310,10 @@ var HFTServer = function(options, startedCallback) { sendFileFn: sendFileResponse, }); + if (!options.askName) { + appleCaptivePortalHandler.setFirstPath("/index.html"); + } + // Send a file from a game. var sendGameRequestedFile = function(req, res) { var gamePrefixLength = 8; // "/games/" + the slash after the id @@ -527,6 +531,14 @@ var HFTServer = function(options, startedCallback) { relayServer: relayServer, }); relayServer.assignAsClientForGame({gameId: "__hft__", showInList: false}, hftGame.getClientForGame()); + relayServer.on('gameStarted', function(e) { + if (options.kiosk && !options.askName) { + var runtimeInfo = g.gameDB.getGameById(e.gameId); + if (runtimeInfo) { + appleCaptivePortalHandler.setFirstPath("/games/" + e.gameId + "/index.html"); + } + } + }); startedCallback(); } }; diff --git a/todo.md b/todo.md index 703f3f51..a7ff11a0 100644 --- a/todo.md +++ b/todo.md @@ -1,7 +1,9 @@ To Do ===== -* make --go-direct +* fix samsung +* fix android non-chrome? +* fix windows phone * add fullscreen to android * add a session id to controller so you can continue where you left off @@ -777,6 +779,7 @@ Runs Repo noid Done ==== +* make --kiosk * make games 'reload' if the server disconnects then reconnects can we some how indicate to the game it's a reconnect? For example, set a local cookie.