From a6adaacdf392b76c5060de28490aaa28a4ec2b6a Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Wed, 11 Mar 2015 17:19:39 +0000 Subject: [PATCH 01/10] Update headless_client.coffee --- headless_client.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/headless_client.coffee b/headless_client.coffee index 7db937737..d963b4127 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -1,5 +1,9 @@ ### -This file will simulate games on node.js by emulating the browser environment. +This file will simulate games on node.js by emulating the browser environment. In order to use, followed these steps: +1. Setup dev environment as usual +2. Create a `login.coffee` file in coco which contains: +module.exports = username: 'email', password: 'password' +3. Run `coffee ./headless_client.coffee` ### simulateOneGame = false if process.argv[2] is 'one-game' From a114112964d69f7ee010ef6b2eabd71fe76b16c6 Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Wed, 11 Mar 2015 17:21:03 +0000 Subject: [PATCH 02/10] Limited line length --- headless_client.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/headless_client.coffee b/headless_client.coffee index d963b4127..0b23d5150 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -1,5 +1,6 @@ ### -This file will simulate games on node.js by emulating the browser environment. In order to use, followed these steps: +This file will simulate games on node.js by emulating the browser environment. +In order to use, followed these steps: 1. Setup dev environment as usual 2. Create a `login.coffee` file in coco which contains: module.exports = username: 'email', password: 'password' From 8389a64644858975c625818e43f9643b3c972f14 Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Wed, 11 Mar 2015 17:23:02 +0000 Subject: [PATCH 03/10] Update headless_client.coffee --- headless_client.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/headless_client.coffee b/headless_client.coffee index 0b23d5150..9e68284b3 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -5,6 +5,7 @@ In order to use, followed these steps: 2. Create a `login.coffee` file in coco which contains: module.exports = username: 'email', password: 'password' 3. Run `coffee ./headless_client.coffee` +Alternatively, if you wish only to simulate a single game run `coffee ./headless_client.coffee one-game` ### simulateOneGame = false if process.argv[2] is 'one-game' From aa5d3de06dcbc96ae52842dded11ab8a777c0a5e Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Wed, 11 Mar 2015 17:23:23 +0000 Subject: [PATCH 04/10] Update headless_client.coffee --- headless_client.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headless_client.coffee b/headless_client.coffee index 9e68284b3..5067c6f7c 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -3,7 +3,7 @@ This file will simulate games on node.js by emulating the browser environment. In order to use, followed these steps: 1. Setup dev environment as usual 2. Create a `login.coffee` file in coco which contains: -module.exports = username: 'email', password: 'password' +module.exports = username: 'email@example.com', password: 'password' 3. Run `coffee ./headless_client.coffee` Alternatively, if you wish only to simulate a single game run `coffee ./headless_client.coffee one-game` ### From bc1b5cae5047cd7c546ff3b015eb1b3fe24a3709 Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Wed, 11 Mar 2015 17:24:39 +0000 Subject: [PATCH 05/10] Update headless_client.coffee --- headless_client.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/headless_client.coffee b/headless_client.coffee index 5067c6f7c..495da84ef 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -6,6 +6,7 @@ In order to use, followed these steps: module.exports = username: 'email@example.com', password: 'password' 3. Run `coffee ./headless_client.coffee` Alternatively, if you wish only to simulate a single game run `coffee ./headless_client.coffee one-game` +Or, if you want to always simulate only one game, change the line below this to "true" ### simulateOneGame = false if process.argv[2] is 'one-game' From 87fc5abdf726aaf0ec541199ae09319dec66e305 Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Wed, 11 Mar 2015 18:48:44 +0000 Subject: [PATCH 06/10] Update headless_client.coffee --- headless_client.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headless_client.coffee b/headless_client.coffee index 495da84ef..857669c8f 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -4,7 +4,7 @@ In order to use, followed these steps: 1. Setup dev environment as usual 2. Create a `login.coffee` file in coco which contains: module.exports = username: 'email@example.com', password: 'password' -3. Run `coffee ./headless_client.coffee` +3. Run `./node_modules/coffee-script/bin/coffee ./headless_client.coffee` Alternatively, if you wish only to simulate a single game run `coffee ./headless_client.coffee one-game` Or, if you want to always simulate only one game, change the line below this to "true" ### From aa321bb3af8cde3e0ba3c267433baa7e53f18314 Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Thu, 12 Mar 2015 17:54:01 +0000 Subject: [PATCH 07/10] Connect to code combat over HTTPS --- headless_client.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headless_client.coffee b/headless_client.coffee index 857669c8f..c0d2f3adc 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -29,7 +29,7 @@ options = simulateOnlyOneGame: simulateOneGame options.heapdump = require('heapdump') if options.heapdump -server = if options.testing then 'http://127.0.0.1:3000' else 'http://direct.codecombat.com' +server = if options.testing then 'http://127.0.0.1:3000' else 'https://direct.codecombat.com' # Use direct instead of live site because jQlone's requests proxy doesn't do caching properly and CloudFlare gets too aggressive. # Disabled modules From 099cb69c64ce388e598093ca64bfe2668bf16d35 Mon Sep 17 00:00:00 2001 From: Popey Gilbert Date: Thu, 12 Mar 2015 17:55:02 +0000 Subject: [PATCH 08/10] Update jQlone to use HTTPS --- headless_client/jQlone.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/headless_client/jQlone.coffee b/headless_client/jQlone.coffee index 422ac9ed7..37403eda5 100644 --- a/headless_client/jQlone.coffee +++ b/headless_client/jQlone.coffee @@ -9,14 +9,14 @@ module.exports = $ = (input) -> # Non-standard jQuery stuff. Don't use outside of server. $._debug = false -$._server = 'http://direct.codecombat.com' +$._server = 'https://direct.codecombat.com' $._cookies = request.jar() $.when = Deferred.when $.ajax = (options) -> responded = false url = options.url - if url.indexOf('http') + if url.indexOf('https') url = '/' + url unless url[0] is '/' url = $._server + url @@ -31,7 +31,7 @@ $.ajax = (options) -> method: options.type body: data , (error, response, body) -> - console.log 'HTTP Request:' + JSON.stringify options if $._debug and not error + console.log 'HTTPS Request:' + JSON.stringify options if $._debug and not error if responded console.log '\t↳Already returned before.' if $._debug return From db27066a3f5549046be48edf25c9e55a72176d19 Mon Sep 17 00:00:00 2001 From: Popey456963 Date: Thu, 12 Mar 2015 18:16:16 +0000 Subject: [PATCH 09/10] Revert "Connect to code combat over HTTPS" This reverts commit aa321bb3af8cde3e0ba3c267433baa7e53f18314. --- headless_client.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headless_client.coffee b/headless_client.coffee index c0d2f3adc..857669c8f 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -29,7 +29,7 @@ options = simulateOnlyOneGame: simulateOneGame options.heapdump = require('heapdump') if options.heapdump -server = if options.testing then 'http://127.0.0.1:3000' else 'https://direct.codecombat.com' +server = if options.testing then 'http://127.0.0.1:3000' else 'http://direct.codecombat.com' # Use direct instead of live site because jQlone's requests proxy doesn't do caching properly and CloudFlare gets too aggressive. # Disabled modules From 53102383666e6d0c8ea8f6a4a158d5810b8416b3 Mon Sep 17 00:00:00 2001 From: Popey456963 Date: Thu, 12 Mar 2015 18:16:32 +0000 Subject: [PATCH 10/10] Revert "Update jQlone to use HTTPS" This reverts commit 099cb69c64ce388e598093ca64bfe2668bf16d35. --- headless_client/jQlone.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/headless_client/jQlone.coffee b/headless_client/jQlone.coffee index 37403eda5..422ac9ed7 100644 --- a/headless_client/jQlone.coffee +++ b/headless_client/jQlone.coffee @@ -9,14 +9,14 @@ module.exports = $ = (input) -> # Non-standard jQuery stuff. Don't use outside of server. $._debug = false -$._server = 'https://direct.codecombat.com' +$._server = 'http://direct.codecombat.com' $._cookies = request.jar() $.when = Deferred.when $.ajax = (options) -> responded = false url = options.url - if url.indexOf('https') + if url.indexOf('http') url = '/' + url unless url[0] is '/' url = $._server + url @@ -31,7 +31,7 @@ $.ajax = (options) -> method: options.type body: data , (error, response, body) -> - console.log 'HTTPS Request:' + JSON.stringify options if $._debug and not error + console.log 'HTTP Request:' + JSON.stringify options if $._debug and not error if responded console.log '\t↳Already returned before.' if $._debug return