feat: implement manual CDN sync for CA certificates and establish master AI rules

This commit is contained in:
dyzulk
2026-01-06 12:01:00 +07:00
parent 3ccbf334fc
commit 875b037a63
5 changed files with 96 additions and 24 deletions

View File

@@ -60,6 +60,32 @@ class RootCaApiController extends Controller
}
}
public function syncToCdn()
{
$this->authorizeAdminOrOwner();
try {
$certificates = CaCertificate::all();
$count = 0;
foreach ($certificates as $cert) {
if ($this->sslService->uploadToCdn($cert)) {
$count++;
}
}
return response()->json([
'status' => 'success',
'message' => "Successfully synced {$count} certificates to CDN."
]);
} catch (\Exception $e) {
return response()->json([
'status' => 'error',
'message' => 'Sync failed: ' . $e->getMessage()
], 500);
}
}
protected function authorizeAdminOrOwner()
{
if (!auth()->user()->isAdminOrOwner()) {