From e6ba069f842e942fd2e23b572ab7ff69479f8179 Mon Sep 17 00:00:00 2001 From: kev Date: Thu, 15 Jan 2015 13:01:04 +0800 Subject: [PATCH] webkit render quality --- dashboard/Dockerfile | 4 ++++ webkit/client.js | 2 +- webkit/parser.js | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dashboard/Dockerfile b/dashboard/Dockerfile index 5424329..05ebc26 100644 --- a/dashboard/Dockerfile +++ b/dashboard/Dockerfile @@ -1,8 +1,12 @@ FROM ubuntu:14.04 RUN apt-get update && apt-get install -y wget collectd nodejs supervisor + RUN wget https://raw.githubusercontent.com/bpaquet/collectd-influxdb-proxy/master/proxy.js -P /usr/local/bin RUN wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb -P /tmp +RUN wget http://grafanarel.s3.amazonaws.com/grafana-1.9.1.tar.gz -P /var/www + RUN dpkg -i /tmp/influxdb_latest_amd64.deb +RUN tar xzf /var/www/grafana-1.9.1.tar.gz -C /var/www CMD supervisord -n diff --git a/webkit/client.js b/webkit/client.js index 064abc2..d4a831f 100644 --- a/webkit/client.js +++ b/webkit/client.js @@ -212,7 +212,7 @@ function urlopen(req, callback) { case 'png': case 'gif': var name = req.requestId + '.' + req.requestType; - page.render('/data/' + name, {format: req.requestType, quality: 50}); + page.render('/data/' + name, {format: req.requestType, quality: req.renderQuality}); result.pageCapture = name; pdata = page.content; break diff --git a/webkit/parser.js b/webkit/parser.js index c54f0e8..f66dabe 100644 --- a/webkit/parser.js +++ b/webkit/parser.js @@ -24,6 +24,7 @@ var setDefaults = function(req) { req.timeout = checkNumber('timeout', req.timeout, 1000, 300000, 60000); req.userAgent = checkString('userAgent', req.userAgent, 'Mozilla/5.0 PhantomJS/1.9.8'); req.viewportSize = checkObject('viewportSize', req.viewportSize, {width: 800, height: 600, zoomFactor: 1}); + req.renderQuality = checkNumber('renderQuality', req.renderQuality, 0, 100, 50); return req; } @@ -38,7 +39,7 @@ function checkNumber(name, value, min, max, defaultValue) { } else if(!_.isNumber(value)) { throw _s.sprintf('TypeError: `%s` is not a number', name); } else if(value < min || value > max) { - throw _s.sprintf('ValueError: `%s` is out of range []', name); + throw _s.sprintf('ValueError: `%s` is out of range [%d, %d]', name, min, max); } else { return value; }