From 2271bd86ba6bfc93a40a7dc5d6a235ab0f3202e0 Mon Sep 17 00:00:00 2001 From: monty Date: Mon, 9 Dec 2019 00:07:36 +0100 Subject: [PATCH] working remote update uwu --- server.js | 36 +++++++++++++++++++----------------- views/index.hbs | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/server.js b/server.js index aaf597e..dbc4021 100644 --- a/server.js +++ b/server.js @@ -79,28 +79,30 @@ module.exports = (client) => { }); }); app.get('/update', async (req, res) => { - if (req.headers.authorization !== 'Update') { + console.log(req.headers['user-agent']); + if (req.headers.authorization === 'Update') { + await exec('git pull') + .then((r) => { + console.log('Pulled latest changes'); + res.status(200).jsonp({ + success: true, + message: 'Successfully pulled latest changes' + }); + //trying.edit('```fix\n' + r.stdout + '```'); + }) + .catch((error) => { + res.status(400).jsonp({ + success: false, + message: error.message + }); + console.error(error); + }); + } else { res.status(400).jsonp({ success: false, message: 'You are not authorized to access this Endpoint' }); } - await exec('git pull') - .then((r) => { - console.log('Pulled latest changes'); - res.status(200).jsonp({ - success: true, - message: 'Successfully pulled latest changes' - }); - trying.edit('```fix\n' + r.stdout + '```'); - }) - .catch((error) => { - res.status(400).jsonp({ - success: false, - message: error.message - }); - console.error(error); - }); }); app.listen(port /* , hostname */, () => { diff --git a/views/index.hbs b/views/index.hbs index 45cc5cb..7deb0ba 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -9,7 +9,7 @@
{{#each social}} - x + {{name}} Icon