From 6b6d707cf49b1befbf60b8bd6256bd6f0b6d5658 Mon Sep 17 00:00:00 2001 From: Brian Peiris <brianpeiris@gmail.com> Date: Thu, 10 May 2018 19:39:41 -0700 Subject: [PATCH] allow specifying full url in bot script --- scripts/bot/run-bot.js | 20 ++++++++++++++------ scripts/bot/run-bot.sh | 1 - 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/bot/run-bot.js b/scripts/bot/run-bot.js index 2e37ccc3d..4f1568dd6 100644 --- a/scripts/bot/run-bot.js +++ b/scripts/bot/run-bot.js @@ -4,8 +4,9 @@ Usage: ./run-bot.js [options] Options: - -h --host=<host> Hubs host [default: localhost:8080] - -r --room=<room> Room id [default: 234234]. + -u --url=<url> Url [default: null]. + -h --host=<host> Hubs host if url is not specified [default: localhost:8080] + -r --room=<room> Room id [default: null]. -h --help Show this screen. `; @@ -22,12 +23,19 @@ const querystring = require("query-string"); page.on("error", err => console.error("ERROR: ", err)); page.on("pageerror", err => console.error("PAGE ERROR: ", err)); + const baseUrl = options["--url"] || `https://${options["--host"]}/hub.html`; + const params = { - room: options["--room"], - bot: true + bot: true, + allow_multi: true }; - console.log(params); - const url = `https://${options["--host"]}/hub.html?${querystring.stringify(params)}`; + const roomOption = options["--room"]; + if (roomOption) { + params.room = roomOption; + } + + const url = `${baseUrl}?${querystring.stringify(params)}`; + console.log(url); const navigate = async () => { try { diff --git a/scripts/bot/run-bot.sh b/scripts/bot/run-bot.sh index 7bd9b986a..aa693b25a 100755 --- a/scripts/bot/run-bot.sh +++ b/scripts/bot/run-bot.sh @@ -9,7 +9,6 @@ yarn echo 'Building Hubs' yarn build > /dev/null -# install run-bot.js dependencies cd $script_directory echo 'Installing bot dependencies' yarn -- GitLab