This commit is contained in:
waltem01 2022-05-30 07:30:15 +02:00
commit 82847a9695
2 changed files with 14 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
DuckRevamp/*
server/node_modules/*
server/node_modules/*
gitUpdate.sh

View File

@ -21,6 +21,7 @@ const cSave = __dirname+'/count.save';
const http = require('http');
const express = require('express');
const socketio = require('socket.io');
const { exec } = require('child_process');
const app = express();
const clientPath = __dirname+'/../client';
@ -30,6 +31,17 @@ app.use(express.static(clientPath));
const server = http.createServer(app);
const io = socketio(server);
app.post('/receiveUpdate', (req, res) => {
res.status(200).json({success:true});
let updater = exec(`sh ${__dirname}/../gitUpdate.sh`, (error, stdout, stderr) => {
console.log(stdout);
console.error(stderr);
if (error !== null) {
console.error(`exec error: ${error}`);
}
});
});
function sleep(ms) {
return new Promise(r => {
setTimeout(r, ms);