feat: BTCPay webhook for auto-publish after confirmation, processing badge

This commit is contained in:
2026-02-06 15:03:56 +01:00
parent fcf22617d0
commit d9202f9ca2
8 changed files with 191 additions and 16 deletions

View File

@@ -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']);