Fix: Resolve broken references in RootCaApiController & OpenSslService

This commit is contained in:
dyzulk
2026-01-08 09:19:06 +07:00
parent 164375c490
commit 4fd5d60802
2 changed files with 12 additions and 7 deletions

View File

@@ -10,10 +10,12 @@ use Illuminate\Http\Request;
class RootCaApiController extends Controller class RootCaApiController extends Controller
{ {
protected $sslService; protected $sslService;
protected $installerService;
public function __construct(OpenSslService $sslService) public function __construct(OpenSslService $sslService, \App\Services\CaInstallerService $installerService)
{ {
$this->sslService = $sslService; $this->sslService = $sslService;
$this->installerService = $installerService;
} }
public function index() public function index()
@@ -96,7 +98,7 @@ class RootCaApiController extends Controller
$certificates = CaCertificate::all(); $certificates = CaCertificate::all();
$count = 0; $count = 0;
foreach ($certificates as $cert) { foreach ($certificates as $cert) {
if ($this->sslService->uploadIndividualInstallersOnly($cert, $mode)) { if ($this->installerService->uploadIndividualInstallersOnly($cert, $mode)) {
$count++; $count++;
} }
} }
@@ -110,7 +112,7 @@ class RootCaApiController extends Controller
{ {
$this->authorizeAdminOrOwner(); $this->authorizeAdminOrOwner();
try { try {
if ($this->sslService->syncAllBundles()) { if ($this->installerService->syncAllBundles()) {
return response()->json(['status' => 'success', 'message' => "Successfully synced All-in-One bundles."]); return response()->json(['status' => 'success', 'message' => "Successfully synced All-in-One bundles."]);
} }
return response()->json(['status' => 'error', 'message' => 'No certificates found to bundle.'], 404); return response()->json(['status' => 'error', 'message' => 'No certificates found to bundle.'], 404);
@@ -130,13 +132,13 @@ class RootCaApiController extends Controller
foreach ($certificates as $cert) { foreach ($certificates as $cert) {
if ($this->sslService->uploadPublicCertsOnly($cert, $mode)) { if ($this->sslService->uploadPublicCertsOnly($cert, $mode)) {
$this->sslService->uploadIndividualInstallersOnly($cert, $mode); $this->installerService->uploadIndividualInstallersOnly($cert, $mode);
$count++; $count++;
} }
} }
// Also sync bundles (Always 'latest' as bundles are aggregate) // Also sync bundles (Always 'latest' as bundles are aggregate)
$this->sslService->syncAllBundles(); $this->installerService->syncAllBundles();
return response()->json([ return response()->json([
'status' => 'success', 'status' => 'success',

View File

@@ -468,7 +468,9 @@ class OpenSslService
} }
// 4. Final Mass Sync // 4. Final Mass Sync
$this->syncAllBundles(); // 4. Final Mass Sync
$installerService = app(\App\Services\CaInstallerService::class);
$installerService->syncAllBundles();
return true; return true;
} }
@@ -503,7 +505,8 @@ class OpenSslService
// Sync to CDN // Sync to CDN
$this->uploadPublicCertsOnly($newCert, 'both'); $this->uploadPublicCertsOnly($newCert, 'both');
$this->uploadIndividualInstallersOnly($newCert, 'both'); $installerService = app(\App\Services\CaInstallerService::class);
$installerService->uploadIndividualInstallersOnly($newCert, 'both');
return $newCert; return $newCert;
} }