Comparing version 1.2.12 to 1.2.13
@@ -6,17 +6,2 @@ #!/usr/bin/env node | ||
import { normalize } from "path"; | ||
// src/utils.ts | ||
import * as os from "os"; | ||
var isCurrentUserRoot = function() { | ||
console.log("UserInfo", os.userInfo()); | ||
if (process && process.getuid) { | ||
return process.getuid() === 0; | ||
} | ||
if (os.userInfo().username == "root") { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
// src/printeer.ts | ||
var printeer_default = async (url, outputFile, outputType = null) => { | ||
@@ -26,3 +11,2 @@ getPackageJson(); | ||
outputFile = normalize(outputFile); | ||
console.log("Printeer to:", outputFile); | ||
if (!url.startsWith("http")) { | ||
@@ -33,3 +17,3 @@ reject("URL must start with http or https"); | ||
headless: true, | ||
args: isCurrentUserRoot() ? ["--no-sandbox", "--disable-setuid-sandbox"] : [] | ||
args: ["--no-sandbox", "--disable-setuid-sandbox"] | ||
}; | ||
@@ -36,0 +20,0 @@ const exePath = process.env.PUPPETEER_EXECUTABLE_PATH; |
18
index.js
// src/printeer.ts | ||
import puppeteer from "puppeteer"; | ||
import { normalize } from "path"; | ||
// src/utils.ts | ||
import * as os from "os"; | ||
var isCurrentUserRoot = function() { | ||
console.log("UserInfo", os.userInfo()); | ||
if (process && process.getuid) { | ||
return process.getuid() === 0; | ||
} | ||
if (os.userInfo().username == "root") { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
// src/printeer.ts | ||
var printeer_default = async (url, outputFile, outputType = null) => { | ||
@@ -23,3 +8,2 @@ getPackageJson(); | ||
outputFile = normalize(outputFile); | ||
console.log("Printeer to:", outputFile); | ||
if (!url.startsWith("http")) { | ||
@@ -30,3 +14,3 @@ reject("URL must start with http or https"); | ||
headless: true, | ||
args: isCurrentUserRoot() ? ["--no-sandbox", "--disable-setuid-sandbox"] : [] | ||
args: ["--no-sandbox", "--disable-setuid-sandbox"] | ||
}; | ||
@@ -33,0 +17,0 @@ const exePath = process.env.PUPPETEER_EXECUTABLE_PATH; |
{ | ||
"name": "printeer", | ||
"version": "1.2.12", | ||
"version": "1.2.13", | ||
"description": "Prints specified web url to PDF (or Image - Coming Soon)!", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,5 +21,2 @@ import puppeteer from 'puppeteer'; | ||
outputFile = normalize(outputFile); | ||
console.log("Printeer to:", outputFile) | ||
if (!url.startsWith('http')) { | ||
@@ -29,6 +26,5 @@ reject('URL must start with http or https'); | ||
const launchOptions:any = { | ||
headless: true, | ||
args: isCurrentUserRoot() ? ['--no-sandbox', '--disable-setuid-sandbox'] : [] | ||
args: ['--no-sandbox', '--disable-setuid-sandbox'] // <- Handle this better | ||
} | ||
@@ -35,0 +31,0 @@ |
@@ -5,3 +5,2 @@ import * as os from 'os'; | ||
export const isCurrentUserRoot = function():Boolean { | ||
console.log("UserInfo", os.userInfo()) | ||
if (process && process.getuid) { | ||
@@ -8,0 +7,0 @@ return process.getuid() === 0; // UID 0 is always root |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30121
352