add wake on lan

This commit is contained in:
Nikola Petrov
2023-10-12 22:21:55 +02:00
parent 51723f029c
commit 6d3dcc773d
6 changed files with 42 additions and 20 deletions

View File

@@ -22,6 +22,22 @@ router.get('/cash', function (req, res, next) {
res.render('cash', { title: 'Cash' });
});
router.get('/wake', function (req, res, next) {
res.render('wake', { title: 'Cash' });
});
const checkAuthenticated = require('../middleware/checkAuthenticated.js');
const wakeOnLan = require('@mi-sec/wol');
router.post('/wake', checkAuthenticated, function (req, res) {
wakeOnLan(req.user.mac_address, {
address: '255.255.255.255',
packets: 1,
interval: 100,
port: 9
});
res.render('wake', { message: 'Waking up' });
});
const userRouter = require('./user');
//router.use('/user', userRouter);