turnero: integración QZ Tray para impresión silenciosa en kiosko
- Genera par de llaves RSA (cert en config/qz/) - api/qz_sign.php firma los print jobs con SHA512 - assets/js/qz-print.js conecta QZ Tray y envía trabajo HTML - ver_formulario_enviado.php carga QZ cuando ?autoprint=1 - Fallback a window.print() si QZ no está instalado Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2cfb77b1a6
commit
5dd6ee5040
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* POST /api/qz_sign.php
|
||||
* Firma el request de QZ Tray con la llave privada RSA del servidor.
|
||||
* QZ Tray verifica la firma usando el digital-certificate.txt instalado en el cliente.
|
||||
*/
|
||||
header('Content-Type: text/plain');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
|
||||
$request = file_get_contents('php://input');
|
||||
if (!$request) { http_response_code(400); exit('missing request'); }
|
||||
|
||||
$keyPath = __DIR__ . '/../config/qz/private-key.pem';
|
||||
$key = openssl_pkey_get_private('file://' . $keyPath);
|
||||
if (!$key) { http_response_code(500); exit('key error'); }
|
||||
|
||||
openssl_sign($request, $signature, $key, 'SHA512');
|
||||
echo base64_encode($signature);
|
||||
Reference in New Issue
Block a user