Auto-deploy: 2026-05-17 01:59:57

This commit is contained in:
Hamza-Ayed
2026-05-17 01:59:57 +03:00
parent 87605f871c
commit 84fd809e62
3 changed files with 11 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// ─── Core API call ─────────────────────────────────────────────────────────── // ─── Core API call ───────────────────────────────────────────────────────────
async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText', jobDescription = '' }) { async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText', jobDescription = '', jobTitle = '' }) {
// Rate limit check // Rate limit check
const canProceed = await checkRateLimit(); const canProceed = await checkRateLimit();
if (!canProceed) { if (!canProceed) {
@@ -45,7 +45,8 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText
action: action, action: action,
apiKey: apiKey, apiKey: apiKey,
prompt: trimmedPrompt, prompt: trimmedPrompt,
jobDescription: jobDescription jobDescription: jobDescription,
jobTitle: jobTitle
}) })
}); });

View File

@@ -501,6 +501,7 @@
payload: { payload: {
apiKey: settings.apiKey, apiKey: settings.apiKey,
jobDescription: jobData.description, jobDescription: jobData.description,
jobTitle: jobData.jobTitle || 'Job',
action: 'generatePdf' action: 'generatePdf'
} }
}, resolve); }, resolve);

View File

@@ -112,10 +112,15 @@ Job Description:
$dompdf->render(); $dompdf->render();
$pdfOutput = $dompdf->output(); $pdfOutput = $dompdf->output();
$rawJobTitle = $data['jobTitle'] ?? 'Job';
$safeJobTitle = preg_replace('/[^a-zA-Z0-9\-_]/', '_', $rawJobTitle);
$safeJobTitle = trim($safeJobTitle, '_');
$fileName = "Hamza_Ayed - {$safeJobTitle}.pdf";
echo json_encode([ echo json_encode([
"success" => true, "success" => true,
"pdf" => base64_encode($pdfOutput), "pdf" => base64_encode($pdfOutput),
"filename" => "Tailored_CV.pdf" "filename" => $fileName
]); ]);
} catch (Exception $e) { } catch (Exception $e) {
http_response_code(500); http_response_code(500);
@@ -132,7 +137,7 @@ if ($action === 'generateText') {
$payload = json_encode([ $payload = json_encode([
"contents" => [["parts" => [["text" => $prompt]]]], "contents" => [["parts" => [["text" => $prompt]]]],
"generationConfig" => ["temperature" => 0.7, "maxOutputTokens" => 2048] "generationConfig" => ["temperature" => 0.7, "maxOutputTokens" => 8192]
]); ]);
$ch = curl_init($geminiUrl); $ch = curl_init($geminiUrl);