@@ -12,7 +12,9 @@ electronApp.commandLine.appendSwitch('disable-gpu');
1212
1313const WindowPool = require ( './window_pool' ) ;
1414const auth = require ( './auth' ) ;
15- const { printUsage, printBootMessage, handleErrors, setContentDisposition } = require ( './util' ) ;
15+ const {
16+ printUsage, printBootMessage, handleErrors, setContentDisposition,
17+ } = require ( './util' ) ;
1618
1719const HOSTNAME = process . env . HOSTNAME || '0.0.0.0' ;
1820const 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 ( / ^ h t t p s ? : \/ \/ .+ $ / 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 ( / ^ h t t p s ? : \/ \/ .+ $ / 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