Verified Commit 8c4f2295 authored by Aral Balkan's avatar Aral Balkan
Browse files

Remove --interactive option. Clean up timeout code. Update docs.

parent 52685fb1
......@@ -50,7 +50,7 @@ class HTTPArchive
return instance
# Promises to generate an instance of an HTTPArchive from the passed URL.
@fromURL: (url, debug = false, timeout = 60) => (@._fromURL url, debug, timeout).then (archive) => @.fromArchive archive
@fromURL: (url, timeout = 60000) => (@._fromURL url, timeout).then (archive) => @.fromArchive archive
# Promises to generate an instance of an HTTPArchive from the file at the passed path.
@fromFileAtPath: (filePath) => (@._fromFileAtPath filePath).then (archive) => @.fromArchive archive
......@@ -60,7 +60,7 @@ class HTTPArchive
#
# Promises to generate an HTTP Archive for the passed URL.
@_fromURL: (url, debug = false, timeout = 60) ->
@_fromURL: (url, timeout = 60000) ->
# If the URL does not have a protocol, default to HTTP.
if url.indexOf('http') != 0 then url = "http://#{url}"
......@@ -77,7 +77,7 @@ class HTTPArchive
return new Promise (resolve, reject) ->
(chromeHarCapturer.run [url], {
'agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1',
'timeout': 60000, # Timeout attempts after a minute
'timeout': timeout, # Timeout attempts after a minute
'width': 375, # iPhone 6/6s/7/8 resolution
'height': 667, # …
'postHook': allowGraceTime # Allow grace period after document load event
......@@ -85,14 +85,6 @@ class HTTPArchive
.on 'fail', reject
.on 'har', (har) -> resolve har
# return (generateArchiveFromURL url, {'user-agent': 'IPHONE_6', 'debug': debug}, timeout).catch (error) ->
# if error == 3
# throw new Error "Protocol missing/incorrect in URL (#{url})"
# else if error.toString() is 'SyntaxError: Unexpected end of input'
# throw new Error "Timed out"
# else
# throw new Error "Could not generate HAR file for #{url}. Error: #{error}."
# Promises to load an HTTP Archive file from the passed file path.
@_fromFileAtPath: (filePath) ->
......
......@@ -31,13 +31,15 @@ goGoGadgetASCII()
_ "\nCopyright © 2016 Ind.ie. Released under GNU AGPLv3."
# Removing interactive option for now as it doesn’t work with puppeteer launch of Chrome.
# ./inspect <URL> [-i or --interactive] : Inspect URL and open the interactive inspector*
help = ->
_ """
Usage:
./inspect <URL> : Inspect URL
./inspect <URL> [-i or --interactive] : Inspect URL and open the interactive inspector*
./inspect <URL> [-l or --local] : Inspect URL from existing local HAR file in the archive
* (Quit the graphical inspector window to complete an interactive inspection.)
......@@ -82,9 +84,16 @@ endInspection = (browser) ->
inspectionEndTime = new Date()
_ "\nInspection took: #{((inspectionEndTime - inspectionStartTime)/1000).toFixed(2)}s\n"
chromeOptions = {args: ['--remote-debugging-port=9222']}
# Launching an interactive session via puppeteer doesn’t seem to work. TODO: Find out why not.
# # If an interactive inspection was requested, launch Chrome with its graphical interface.
# if args.i? or args.interactive
# chromeOptions['devtools'] = true
(puppeteer.launch args: ['--remote-debugging-port=9222']).then (browser) ->
(itemToLoad.generator itemToLoad.path, (args.i? or args.interactive)).then (archive) ->
(puppeteer.launch chromeOptions).then (browser) ->
(itemToLoad.generator itemToLoad.path).then (archive) ->
# Stop status indicator.
spinner.stop true
......
......@@ -28,11 +28,13 @@ Inquiry is a tool that runs inspections on [the domains currently being tracked
./install
```
<!-- Removing the interactive inspection option for now as it doesn’t work with puppeteer launch of Chrome -->
<!-- ./inspect <URL> -i : interactive -->
## Usage
```bash
./inspect <URL> : non-interactive
./inspect <URL> -i : interactive
./inspect -f <path> : analyse HTTP Archive file (.har/.har.gz) at path
./inquiry : start an inquiry
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment