Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -55,17 +55,11 @@ app.post('/login', async (_req, res) => {
|
|
| 55 |
return res.status(500).json(out);
|
| 56 |
}
|
| 57 |
|
| 58 |
-
const
|
| 59 |
-
res.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 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);
|