Kyouka commited on
Commit
6debb1e
·
verified ·
1 Parent(s): 2898adb

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +16 -9
index.js CHANGED
@@ -229,14 +229,17 @@ app.all('/stablediff/illusion', async (req, res) => {
229
  })
230
 
231
  app.get('/dongo', async (req, res) => {
232
- const { url } = req.query
233
- if (!url) return res.json({ success: false, message: 'Required parameter url' })
 
234
  const browser = await playwright.chromium.launch({
235
- headless: true,
236
- executablePath: '/usr/bin/chromium',
237
- args: ['--no-sandbox']
238
- })
 
239
  const context = await browser.newContext({
 
240
  extraHTTPHeaders: {
241
  'accept': '*/*',
242
  'accept-language': 'en-US,en;q=0.9,id;q=0.8',
@@ -255,13 +258,17 @@ app.get('/dongo', async (req, res) => {
255
  });
256
 
257
  const page = await context.newPage();
258
- await page.goto(url);
259
 
260
- const content = await page.content(); // Get the page content as HTML
 
 
 
 
 
261
 
262
  await browser.close();
263
 
264
- res.send(content); // Send the page content as response
265
  });
266
 
267
  app.get('/fetch-page', async (req, res) => {
 
229
  })
230
 
231
  app.get('/dongo', async (req, res) => {
232
+ const { url } = req.query;
233
+ if (!url) return res.json({ success: false, message: 'Required parameter url' });
234
+
235
  const browser = await playwright.chromium.launch({
236
+ headless: true,
237
+ executablePath: '/usr/bin/chromium',
238
+ args: ['--no-sandbox']
239
+ });
240
+
241
  const context = await browser.newContext({
242
+ viewport: null, // Use null to maximize viewport
243
  extraHTTPHeaders: {
244
  'accept': '*/*',
245
  'accept-language': 'en-US,en;q=0.9,id;q=0.8',
 
258
  });
259
 
260
  const page = await context.newPage();
 
261
 
262
+ // Set to fullscreen by getting viewport dimensions
263
+ const dimensions = await page.evaluate(() => ({ width: window.screen.width, height: window.screen.height }));
264
+ await page.setViewportSize(dimensions);
265
+
266
+ await page.goto(url);
267
+ const content = await page.content();
268
 
269
  await browser.close();
270
 
271
+ res.send(content);
272
  });
273
 
274
  app.get('/fetch-page', async (req, res) => {