Skip to content
This repository was archived by the owner on Apr 7, 2020. It is now read-only.

Commit f5ec370

Browse files
committed
Bump deps
1 parent f631640 commit f5ec370

File tree

6 files changed

+272
-256
lines changed

6 files changed

+272
-256
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
"retry": "^0.10.1"
3737
},
3838
"devDependencies": {
39-
"eslint": "^4.5.0",
40-
"eslint-config-airbnb-base": "^11.3.2",
41-
"eslint-plugin-import": "^2.7.0",
42-
"mocha": "^3.5.0",
39+
"eslint": "^4.11.0",
40+
"eslint-config-airbnb-base": "^12.1.0",
41+
"eslint-plugin-import": "^2.8.0",
42+
"mocha": "^4.0.1",
4343
"supertest": "^3.0.0"
4444
}
4545
}

src/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = function authMiddleware(req, res, next) {
2727
});
2828
}
2929

30-
/* eslint-disable no-param-reassign */
30+
/* eslint-disable no-param-reassign, prefer-destructuring */
3131
req.keyLabel = key[0];
3232
return next();
3333
};

src/error_handler.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,17 @@ exports.RendererError = RendererError;
1818
function handleLoadingError(currentUrl, event, code, desc, url) {
1919
switch (code) {
2020
case -102:
21-
return Promise.reject(new RendererError(
22-
'CONNECTION_REFUSED', 'Connection attempt was refused.'));
21+
return Promise.reject(new RendererError('CONNECTION_REFUSED', 'Connection attempt was refused.'));
2322
case -105:
24-
return Promise.reject(new RendererError(
25-
'NAME_NOT_RESOLVED', 'The host name could not be resolved.'));
23+
return Promise.reject(new RendererError('NAME_NOT_RESOLVED', 'The host name could not be resolved.'));
2624
case -137:
27-
return Promise.reject(new RendererError(
28-
'NAME_RESOLUTION_FAILED', 'Hostname resolution failed (DNS).'));
25+
return Promise.reject(new RendererError('NAME_RESOLUTION_FAILED', 'Hostname resolution failed (DNS).'));
2926
case -300:
3027
return Promise.reject(new RendererError('INVALID_URL', 'The URL is invalid.'));
3128
case -501:
32-
return Promise.reject(new RendererError(
33-
'INSECURE_RESPONSE', 'The server\'s response was insecure (e.g. there was a cert error).'));
29+
return Promise.reject(new RendererError('INSECURE_RESPONSE', 'The server\'s response was insecure (e.g. there was a cert error).'));
3430
case -6:
35-
return Promise.reject(new RendererError(
36-
'FILE_NOT_FOUND', 'The file or directory cannot be found.'));
31+
return Promise.reject(new RendererError('FILE_NOT_FOUND', 'The file or directory cannot be found.'));
3732
case -3:
3833
// Subresource fails to load, render page anyway
3934
if (currentUrl !== url) {

src/renderer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ function renderPDF(options, done) {
5858
/**
5959
* Render image png/jpeg
6060
*/
61-
function renderImage({ type, quality, browserWidth, browserHeight, clippingRect }, done) {
61+
function renderImage({
62+
type, quality, browserWidth, browserHeight, clippingRect,
63+
}, done) {
6264
const handleCapture = image => done(null, type === 'png' ? image.toPng() : image.toJpeg(quality));
6365

6466
if (clippingRect) {

src/server.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ electronApp.commandLine.appendSwitch('disable-gpu');
1212

1313
const WindowPool = require('./window_pool');
1414
const auth = require('./auth');
15-
const { printUsage, printBootMessage, handleErrors, setContentDisposition } = require('./util');
15+
const {
16+
printUsage, printBootMessage, handleErrors, setContentDisposition,
17+
} = require('./util');
1618

1719
const HOSTNAME = process.env.HOSTNAME || '0.0.0.0';
1820
const PORT = process.env.PORT || 3000;
@@ -101,10 +103,12 @@ app.get('/pdf', auth, (req, res) => {
101103
}
102104

103105
if (!res.locals.tmpFile && !(req.query.url && req.query.url.match(/^https?:\/\/.+$/i))) {
104-
res.status(400).send({ input_errors: [{
105-
param: 'url',
106-
msg: 'Please provide url or send HTML via POST',
107-
}] });
106+
res.status(400).send({
107+
input_errors: [{
108+
param: 'url',
109+
msg: 'Please provide url or send HTML via POST',
110+
}],
111+
});
108112
return;
109113
}
110114

@@ -114,8 +118,10 @@ app.get('/pdf', auth, (req, res) => {
114118
req.sanitize('removePrintMedia').toBoolean(true);
115119
req.sanitize('delay').toInt(10);
116120

117-
const { pageSize = 'A4', marginsType = 0, printBackground = true, landscape = false,
118-
removePrintMedia = false, delay = 0, waitForText = false } = req.query;
121+
const {
122+
pageSize = 'A4', marginsType = 0, printBackground = true, landscape = false,
123+
removePrintMedia = false, delay = 0, waitForText = false,
124+
} = req.query;
119125
const url = (res.locals.tmpFile ? `file://${res.locals.tmpFile}` : req.query.url);
120126

121127
req.app.pool.enqueue({
@@ -164,10 +170,11 @@ app.get(/^\/(png|jpeg)/, auth, (req, res) => {
164170
});
165171

166172
if (!res.locals.tmpFile && !(req.query.url && req.query.url.match(/^https?:\/\/.+$/i))) {
167-
res.status(400).send({ input_errors: [{
168-
param: 'url',
169-
msg: 'Please provide url or send HTML via POST',
170-
}],
173+
res.status(400).send({
174+
input_errors: [{
175+
param: 'url',
176+
msg: 'Please provide url or send HTML via POST',
177+
}],
171178
});
172179
return;
173180
}
@@ -198,8 +205,10 @@ app.get(/^\/(png|jpeg)/, auth, (req, res) => {
198205
req.sanitize('clippingRect.height').toInt(10);
199206
}
200207

201-
const { quality = 80, delay, waitForText, clippingRect,
202-
browserWidth = WINDOW_WIDTH, browserHeight = WINDOW_HEIGHT } = req.query;
208+
const {
209+
quality = 80, delay, waitForText, clippingRect,
210+
browserWidth = WINDOW_WIDTH, browserHeight = WINDOW_HEIGHT,
211+
} = req.query;
203212
const url = (res.locals.tmpFile ? `file://${res.locals.tmpFile}` : req.query.url);
204213

205214
req.app.pool.enqueue({

0 commit comments

Comments
 (0)