Update server.js
Browse files
server.js
CHANGED
|
@@ -6,16 +6,12 @@ const app = express();
|
|
| 6 |
app.get("/", async (req, res) => {
|
| 7 |
let browser;
|
| 8 |
try {
|
| 9 |
-
let { url,
|
| 10 |
if (!url || !url.trim().startsWith("http")) return res.sendStatus(400);
|
| 11 |
|
| 12 |
-
const
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
tablet: { width: 1600, height: 900, isMobile: true },
|
| 16 |
-
};
|
| 17 |
-
|
| 18 |
-
let viewport = width && height ? { width: parseInt(width), height: parseInt(height) } : viewports[type] || viewports.desktop;
|
| 19 |
|
| 20 |
browser = await chromium.launch({
|
| 21 |
args: ["--incognito", "--single-process", "--no-sandbox", "--no-zygote", "--no-cache"],
|
|
|
|
| 6 |
app.get("/", async (req, res) => {
|
| 7 |
let browser;
|
| 8 |
try {
|
| 9 |
+
let { url, width, height } = req.query;
|
| 10 |
if (!url || !url.trim().startsWith("http")) return res.sendStatus(400);
|
| 11 |
|
| 12 |
+
const viewport = width && height
|
| 13 |
+
? { width: parseInt(width), height: parseInt(height) }
|
| 14 |
+
: { width: 3840, height: 2160 };
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
browser = await chromium.launch({
|
| 17 |
args: ["--incognito", "--single-process", "--no-sandbox", "--no-zygote", "--no-cache"],
|