simoncck commited on
Commit
6223444
·
verified ·
1 Parent(s): 8c9b5c3

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +11 -6
server.js CHANGED
@@ -55,12 +55,17 @@ app.post('/login', async (_req, res) => {
55
  return res.status(500).json(out);
56
  }
57
 
58
- const b64 = out.png.toString('base64');
59
- res.json({
60
- ok: true,
61
- screenshot_b64: out.png, // ready for <img src=...>
62
- });
63
- /* res.type('png').send(out.png); */
 
 
 
 
 
64
  });
65
 
66
  console.log('🛰️ Public URL will be:', HOSTNAME);
 
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);