|
@ -73,6 +73,12 @@ app.post('/api', (req, res) => { |
|
|
const hmac = crypto.createHmac('sha256', GITEA_SECRET); |
|
|
const hmac = crypto.createHmac('sha256', GITEA_SECRET); |
|
|
const digest = `sha256=${hmac.update(payload).digest('hex')}`; |
|
|
const digest = `sha256=${hmac.update(payload).digest('hex')}`; |
|
|
|
|
|
|
|
|
|
|
|
// Buffer lengths
|
|
|
|
|
|
const bufferSignature = Buffer.from(signature); |
|
|
|
|
|
const bufferDigest = Buffer.from(digest); |
|
|
|
|
|
|
|
|
|
|
|
console.log(bufferDigest, bufferSignature) |
|
|
|
|
|
|
|
|
if (crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(digest))) { |
|
|
if (crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(digest))) { |
|
|
// Secret is valid, update the repository
|
|
|
// Secret is valid, update the repository
|
|
|
exec('/home/gnome.sh', (err, stdout, stderr) => { |
|
|
exec('/home/gnome.sh', (err, stdout, stderr) => { |
|
|