mirror of
https://github.com/standardebooks/web.git
synced 2025-07-05 14:20:29 -04:00
Add system to retrieve and manage donations in a local database
This commit is contained in:
parent
79c531aacb
commit
70a80d0e02
46 changed files with 782 additions and 910 deletions
|
@ -21,14 +21,14 @@ try{
|
|||
throw new Exceptions\WebhookException('Expected HTTP POST.');
|
||||
}
|
||||
|
||||
$post = file_get_contents('php://input') ?: '';
|
||||
$post = file_get_contents('php://input');
|
||||
|
||||
// Validate the GitHub secret.
|
||||
$splitHash = explode('=', $_SERVER['HTTP_X_HUB_SIGNATURE']);
|
||||
$hashAlgorithm = $splitHash[0];
|
||||
$hash = $splitHash[1];
|
||||
|
||||
if(!hash_equals($hash, hash_hmac($hashAlgorithm, $post, preg_replace("/[\r\n]/ius", '', file_get_contents(GITHUB_SECRET_FILE_PATH) ?: '') ?? ''))){
|
||||
if(!hash_equals($hash, hash_hmac($hashAlgorithm, $post, preg_replace("/[\r\n]/ius", '', file_get_contents(GITHUB_SECRET_FILE_PATH))))){
|
||||
throw new Exceptions\InvalidCredentialsException();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue