simoncck commited on
Commit
2245c2f
·
verified ·
1 Parent(s): 6223444

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +5 -11
server.js CHANGED
@@ -55,17 +55,11 @@ app.post('/login', async (_req, res) => {
55
  return res.status(500).json(out);
56
  }
57
 
58
- const boundary = '---PNG_BOUNDARY';
59
- res.set('Content-Type', `multipart/mixed; boundary=${boundary}`);
60
-
61
- res.write(`--${boundary}\r\n`);
62
- res.write('Content-Type: application/json\r\n\r\n');
63
- res.write(JSON.stringify({ ok: true }) + '\r\n');
64
-
65
- res.write(`--${boundary}\r\n`);
66
- res.write('Content-Type: image/png\r\n\r\n');
67
- res.write(out.png);
68
- res.end(`\r\n--${boundary}--`);
69
  });
70
 
71
  console.log('🛰️ Public URL will be:', HOSTNAME);
 
55
  return res.status(500).json(out);
56
  }
57
 
58
+ const b64 = out.png.toString('base64'); // <-- encode once
59
+ res.json({
60
+ ok: true,
61
+ screenshot_b64: `data:image/png;base64,${b64}`, // or just b64
62
+ });
 
 
 
 
 
 
63
  });
64
 
65
  console.log('🛰️ Public URL will be:', HOSTNAME);