diff --git a/application/src/services/ssl/notification/sslNotificationSender.ts b/application/src/services/ssl/notification/sslNotificationSender.ts index 32c2f16..c104366 100644 --- a/application/src/services/ssl/notification/sslNotificationSender.ts +++ b/application/src/services/ssl/notification/sslNotificationSender.ts @@ -14,7 +14,7 @@ export async function sendSSLNotification( try { // Check if notification channel is set if (!certificate.notification_channel) { - console.log(`No notification channel set for certificate: ${certificate.domain}`); + // console.log(`No notification channel set for certificate: ${certificate.domain}`); return false; } @@ -22,12 +22,12 @@ export async function sendSSLNotification( const alertConfigRecord = await pb.collection('alert_configurations').getOne(certificate.notification_channel); if (!alertConfigRecord) { - console.error(`Alert configuration not found for ID: ${certificate.notification_channel}`); + // console.error(`Alert configuration not found for ID: ${certificate.notification_channel}`); return false; } if (!alertConfigRecord.enabled) { - console.log(`Alert configuration is disabled for certificate: ${certificate.domain}`); + // console.log(`Alert configuration is disabled for certificate: ${certificate.domain}`); return false; } @@ -63,7 +63,7 @@ export async function sendSSLNotification( return await sendNotificationByType(alertConfig, certificate, message, isCritical, sslNotification); } catch (error) { - console.error("Error sending SSL notification:", error); + // console.error("Error sending SSL notification:", error); return false; } } @@ -87,7 +87,7 @@ async function sendNotificationByType( // case 'slack': // return await sendSlackNotification(alertConfig, certificate, message, isCritical); default: - console.log(`Notification type ${alertConfig.notification_type} not implemented yet for SSL certificates`); + // console.log(`Notification type ${alertConfig.notification_type} not implemented yet for SSL certificates`); return false; } } @@ -102,7 +102,7 @@ async function sendTelegramNotification( isCritical: boolean ): Promise { if (!alertConfig.bot_token || !alertConfig.telegram_chat_id) { - console.error("Missing Telegram bot token or chat ID"); + // console.error("Missing Telegram bot token or chat ID"); return false; } diff --git a/application/src/services/ssl/sslCertificateOperations.ts b/application/src/services/ssl/sslCertificateOperations.ts index dc37b67..88dc49f 100644 --- a/application/src/services/ssl/sslCertificateOperations.ts +++ b/application/src/services/ssl/sslCertificateOperations.ts @@ -112,10 +112,10 @@ export const deleteSSLCertificate = async (id: string): Promise => { */ export const refreshAllCertificates = async (): Promise<{ success: number; failed: number }> => { try { - const response = await pb.collection("ssl_certificates").getList(1, 100); + const response = await pb.collection("ssl_certificates").getList(1, 200); const certificates = response.items as unknown as SSLCertificate[]; - console.log(`Refreshing ${certificates.length} certificates...`); + // console.log(`Refreshing ${certificates.length} certificates...`); let success = 0; let failed = 0; @@ -125,14 +125,14 @@ export const refreshAllCertificates = async (): Promise<{ success: number; faile await checkCertificateAndNotify(cert); success++; } catch (error) { - console.error(`Failed to refresh certificate ${cert.domain}:`, error); + // console.error(`Failed to refresh certificate ${cert.domain}:`, error); failed++; } } return { success, failed }; } catch (error) { - console.error("Error refreshing certificates:", error); + // console.error("Error refreshing certificates:", error); throw error; } }; \ No newline at end of file diff --git a/application/src/services/ssl/sslCheckerService.ts b/application/src/services/ssl/sslCheckerService.ts index d970e90..3e76871 100644 --- a/application/src/services/ssl/sslCheckerService.ts +++ b/application/src/services/ssl/sslCheckerService.ts @@ -1,7 +1,6 @@ import type { SSLCheckerResponse } from "./types"; import { toast } from "sonner"; -import { checkWithFetch } from "./sslPrimaryChecker"; import { normalizeDomain, createErrorResponse } from "./sslCheckerUtils"; /** @@ -10,7 +9,7 @@ import { normalizeDomain, createErrorResponse } from "./sslCheckerUtils"; */ export const checkSSLCertificate = async (domain: string): Promise => { try { - console.log(`Checking SSL certificate for domain: ${domain}`); + // console.log(`Checking SSL certificate for domain: ${domain}`); // Normalize domain (remove protocol if present) const normalizedDomain = normalizeDomain(domain); @@ -20,11 +19,11 @@ export const checkSSLCertificate = async (domain: string): Promise => { const endpoint = "/api/collections/ssl_certificates/records"; const params = { page: 1, - perPage: 50, + perPage: 200, sort: "-created", cache: Date.now() // Prevent caching by adding a timestamp }; diff --git a/application/src/services/ssl/sslPrimaryChecker.ts b/application/src/services/ssl/sslPrimaryChecker.ts deleted file mode 100644 index 59fbddc..0000000 --- a/application/src/services/ssl/sslPrimaryChecker.ts +++ /dev/null @@ -1,29 +0,0 @@ - -import { createErrorResponse } from "./sslCheckerUtils"; -import type { SSLCheckerResponse } from "./types"; - -/** - * Check SSL certificate using fetch with CORS proxy - * This is our primary method that's proven to work - */ -export const checkWithFetch = async (domain: string): Promise => { - console.log(`Checking SSL via CORS proxy for: ${domain}`); - - try { - // Use the working CORS proxy - const corsProxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(`https://ssl-checker.io/api/v1/check/${domain}`)}`; - console.log("Using CORS proxy for SSL check:", corsProxyUrl); - - const proxyResponse = await fetch(corsProxyUrl); - if (!proxyResponse.ok) { - throw new Error(`CORS proxy request failed with status: ${proxyResponse.status}`); - } - - const proxyData = await proxyResponse.json(); - console.log("CORS proxy returned SSL data:", proxyData); - return proxyData; - } catch (error) { - console.error("SSL check failed:", error); - return createErrorResponse(domain, error); - } -}; \ No newline at end of file