Feat: Add post-install telemetry ping (CORS enabled)

This commit is contained in:
dyzulk
2026-01-08 09:07:08 +07:00
parent de80b91b49
commit 4859398ccb
3 changed files with 21 additions and 0 deletions

View File

@@ -162,4 +162,18 @@ class PublicCaController extends Controller
'Content-Disposition' => 'attachment; filename="' . $filename . '"',
]);
}
/**
* Track download/installation count (Telemetry).
* Used by installer scripts to perform a "Ping" after successful installation.
*/
public function trackDownload($serial)
{
$cert = CaCertificate::where('serial_number', $serial)->firstOrFail();
$cert->increment('download_count');
$cert->update(['last_downloaded_at' => now()]);
return response()->json(['success' => true])
->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Methods', 'POST');
}
}