Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: merge dev branch and fix URL security issue

LearningCircuit79068e44b1ae
diff --cc src/local_deep_research/defaults/default_settings.json
index 80e6955c67,be28c20ae0..c1bebb7e08
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@@ -1012,10 -1012,10 +1012,14 @@@
"label": "SerpAPI (Google)",
"value": "serpapi"
},
+ {
+ "label": "ScaleSerp (Google + Caching)",
+ "value": "scaleserp"
+ },
+ {
+ "label": "Serper (Google)",
+ "value": "serper"
+ },
{
"label": "SearXNG (Self-hosted)",
"value": "searxng"
diff --cc src/local_deep_research/web/static/js/components/results.js
index 3cee00b412,03ba89a114..621430f1a7
--- a/src/local_deep_research/web/static/js/components/results.js
+++ b/src/local_deep_research/web/static/js/components/results.js
@@@ -797,55 -797,49 +797,49 @@@
pdfBtn.disabled = true;
pdfBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Generating PDF...';
- // Get metadata from DOM (which should be populated correctly by now)
- const title = document.getElementById('result-query')?.textContent || `Research ${researchId}`;
- console.log('Using title for PDF:', title);
-
- // Check if PDF service is available
- if (window.pdfService && window.pdfService.downloadPdf) {
- console.log('PDF service available, calling downloadPdf');
- console.log('researchData structure:', {
- hasContent: !!researchData.content,
- contentLength: researchData.content ? researchData.content.length : 0,
- hasMarkdown: !!researchData.markdown,
- keys: Object.keys(researchData)
- });
-
- // Add the metadata to the researchData for PDF generation
- const pdfData = {
- ...researchData,
- title: title,
- query: title,
- // Ensure content is available in multiple places for the PDF service
- markdown: researchData.content || researchData.markdown || '',
- content: researchData.content || researchData.markdown || '',
- metadata: {
- title: title,
- date: document.getElementById('result-date')?.textContent || 'Unknown date',
- mode: document.getElementById('result-mode')?.textContent || 'Standard'
- }
- };
-
- // Use the PDF service to generate and download the PDF
- window.pdfService.downloadPdf(pdfData, researchId)
- .then(() => {
- console.log('PDF generated successfully');
- // Reset button
- pdfBtn.disabled = false;
- pdfBtn.innerHTML = '<i class="fas fa-file-pdf"></i> Download PDF';
- })
- .catch(error => {
- console.error('Error generating PDF:', error);
- alert(`Error generating PDF: ${error.message || 'Unknown error'}`);
-
- // Reset button
- pdfBtn.disabled = false;
- pdfBtn.innerHTML = '<i class="fas fa-file-pdf"></i> Download PDF';
- });
- } else {
- console.error('PDF service not available');
- throw new Error('PDF service not available');
- }
+ // Get CSRF token from meta tag or cookie
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content ||
+ document.cookie.split('; ').find(row => row.startsWith('csrf_token='))?.split('=')[1];
+
+ // Call the backend API to generate PDF using WeasyPrint
+ fetch(`/api/v1/research/${researchId}/export/pdf`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken
+ },
+ credentials: 'same-origin'
+ })
+ .then(response => {
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`);
+ }
+ return response.blob();
+ })
+ .then(blob => {
+ // Create download link
+ const url = URL.createObjectURL(blob);
+ const a = document.createElement('a');
- a.href = url;
++ URLValidator.safeAssign(a, 'href', url);
+ a.download = `research_${researchId}.pdf`;
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+
+ console.log('PDF downloaded successfully');
+ // Reset button
+ pdfBtn.disabled = false;
+ pdfBtn.innerHTML = '<i class="fas fa-file-pdf"></i> Download PDF';
+ })
+ .catch(error => {
+ console.error('Error generating PDF:', error);
+ alert(`Error generating PDF: ${error.message || 'Unknown error'}`);
+
+ // Reset button
+ pdfBtn.disabled = false;
+ pdfBtn.innerHTML = '<i class="fas fa-file-pdf"></i> Download PDF';
+ });
} catch (error) {
console.error('Error exporting PDF:', error);