feat: BTCPay webhook for auto-publish after confirmation, processing badge
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
header('Access-Control-Allow-Origin: https://dgray.io');
|
||||
|
||||
$allowedOrigins = ['https://dgray.io', 'http://localhost:5500', 'http://localhost:8080'];
|
||||
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
|
||||
if (in_array($origin, $allowedOrigins)) {
|
||||
header('Access-Control-Allow-Origin: ' . $origin);
|
||||
} else {
|
||||
header('Access-Control-Allow-Origin: https://dgray.io');
|
||||
}
|
||||
|
||||
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Content-Type');
|
||||
|
||||
@@ -25,6 +33,9 @@ switch ($uri) {
|
||||
case '/btcpay/status':
|
||||
require __DIR__ . '/btcpay-status.php';
|
||||
break;
|
||||
case '/btcpay/webhook':
|
||||
require __DIR__ . '/btcpay-webhook.php';
|
||||
break;
|
||||
default:
|
||||
http_response_code(404);
|
||||
echo json_encode(['error' => 'Not found']);
|
||||
|
||||
Reference in New Issue
Block a user