|
@ -7,7 +7,7 @@ require('dotenv').config(); |
|
|
|
|
|
|
|
|
const app = express(); |
|
|
const app = express(); |
|
|
const PORT = process.env.PORT || 3000; |
|
|
const PORT = process.env.PORT || 3000; |
|
|
const GITEA_SECRET = "123"; |
|
|
const GITEA_SECRET = process.env.GITEA_SECRET; |
|
|
|
|
|
|
|
|
// Serve static files from the 'public' directory
|
|
|
// Serve static files from the 'public' directory
|
|
|
app.use(express.static(path.join(__dirname, 'public'))); |
|
|
app.use(express.static(path.join(__dirname, 'public'))); |
|
@ -66,13 +66,7 @@ app.post('/api', (req, res) => { |
|
|
|
|
|
|
|
|
// Verify the secret
|
|
|
// Verify the secret
|
|
|
const hmac = crypto.createHmac('sha256', GITEA_SECRET); |
|
|
const hmac = crypto.createHmac('sha256', GITEA_SECRET); |
|
|
const digest = hmac.update(payload).digest('hex'); |
|
|
const digest = hmac.update(payload).digest('hex'); |
|
|
|
|
|
|
|
|
console.log('Signature from Gitea:', signature); |
|
|
|
|
|
console.log('Computed digest:', digest); |
|
|
|
|
|
console.log('Payload:', payload); |
|
|
|
|
|
console.log('Secret:', GITEA_SECRET); |
|
|
|
|
|
|
|
|
|
|
|
const bufferSignature = Buffer.from(signature, 'hex'); |
|
|
const bufferSignature = Buffer.from(signature, 'hex'); |
|
|
const bufferDigest = Buffer.from(digest, 'hex'); |
|
|
const bufferDigest = Buffer.from(digest, 'hex'); |
|
|
|
|
|
|
|
|