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.

Add eslint.config.js and fix duplicate JS functions

LearningCircuit20616ff4a377
diff --git a/.gitleaks.toml b/.gitleaks.toml
index a0f7e9ee79..968cf8ca9f 100644
--- a/.gitleaks.toml
+++ b/.gitleaks.toml
@@ -100,7 +100,11 @@ commits = [
regexes = [
# Allow comments that explain API key usage but don't contain actual keys
'''# API_KEY: OpenRouter API key''',
- '''OPENROUTER_API_KEY'''
+ '''OPENROUTER_API_KEY''',
+ # Allow JavaScript variable declarations that happen to use "token" as a variable name
+ '''const token = document\.querySelector''',
+ '''let token = document\.querySelector''',
+ '''var token = document\.querySelector'''
]
# Target specific files for scanning
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6e0a3880dd..74824eefa4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -16,6 +16,7 @@ repos:
- id: gitleaks
name: Detect secrets with gitleaks
description: "Detect hardcoded secrets like passwords, API keys, and tokens"
+ args: ["--config", ".gitleaks.toml"]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000000..54ca89432e
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,74 @@
+// ESLint flat config for JavaScript files
+// https://eslint.org/docs/latest/use/configure/configuration-files-new
+
+export default [
+ {
+ // Apply to all JavaScript files
+ files: ["**/*.js", "**/*.mjs"],
+
+ // Ignore common directories
+ ignores: [
+ "node_modules/**",
+ "dist/**",
+ "build/**",
+ "**/*.min.js",
+ "tests/ui_tests/node_modules/**",
+ ],
+
+ // Basic rules - keep it minimal to avoid breaking existing code
+ rules: {
+ // Only error on critical issues
+ "no-undef": "off", // Disabled - browser globals not defined
+ "no-unused-vars": "off", // Disabled - too noisy for existing code
+ },
+
+ languageOptions: {
+ ecmaVersion: 2022,
+ sourceType: "module",
+ globals: {
+ // Browser globals
+ window: "readonly",
+ document: "readonly",
+ console: "readonly",
+ setTimeout: "readonly",
+ setInterval: "readonly",
+ clearTimeout: "readonly",
+ clearInterval: "readonly",
+ fetch: "readonly",
+ URL: "readonly",
+ URLSearchParams: "readonly",
+ FormData: "readonly",
+ Blob: "readonly",
+ File: "readonly",
+ FileReader: "readonly",
+ localStorage: "readonly",
+ sessionStorage: "readonly",
+ navigator: "readonly",
+ location: "readonly",
+ history: "readonly",
+ CustomEvent: "readonly",
+ Event: "readonly",
+ EventTarget: "readonly",
+ HTMLElement: "readonly",
+ Element: "readonly",
+ Node: "readonly",
+ NodeList: "readonly",
+ MutationObserver: "readonly",
+ ResizeObserver: "readonly",
+ IntersectionObserver: "readonly",
+ requestAnimationFrame: "readonly",
+ cancelAnimationFrame: "readonly",
+ performance: "readonly",
+ // Node.js globals (for config files)
+ module: "readonly",
+ require: "readonly",
+ process: "readonly",
+ __dirname: "readonly",
+ __filename: "readonly",
+ exports: "readonly",
+ Buffer: "readonly",
+ global: "readonly",
+ },
+ },
+ },
+];
diff --git a/src/local_deep_research/web/static/js/pages/news.js b/src/local_deep_research/web/static/js/pages/news.js
index 13742a753a..23b56856c5 100644
--- a/src/local_deep_research/web/static/js/pages/news.js
+++ b/src/local_deep_research/web/static/js/pages/news.js
@@ -1968,7 +1968,17 @@ function showAlert(message, type = 'info') {
}
function getCSRFToken() {
- return document.querySelector('meta[name="csrf-token"]').getAttribute('content');
+ // Try to get from meta tag first
+ const csrfMeta = document.querySelector('meta[name="csrf-token"]');
+ if (csrfMeta) return csrfMeta.content;
+
+ // Try to get from cookie
+ const cookies = document.cookie.split(';');
+ for (let cookie of cookies) {
+ const [name, value] = cookie.trim().split('=');
+ if (name === 'csrf_token') return decodeURIComponent(value);
+ }
+ return '';
}
// Refresh feed
@@ -2365,21 +2375,6 @@ function saveNewsAnalysis(researchId) {
showAlert('Analysis saved for later', 'success');
}
-// Helper function to get CSRF token
-function getCSRFToken() {
- // Try to get from meta tag first
- const token = document.querySelector('meta[name="csrf-token"]');
- if (token) return token.content;
-
- // Try to get from cookie
- const cookies = document.cookie.split(';');
- for (let cookie of cookies) {
- const [name, value] = cookie.trim().split('=');
- if (name === 'csrf_token') return decodeURIComponent(value);
- }
- return '';
-}
-
// Search history functions
async function loadSearchHistory() {
try {
@@ -2639,31 +2634,6 @@ function collapseAll() {
showAlert('All items collapsed', 'info');
}
-// Expandable content functions
-function toggleExpanded(newsId) {
- const element = document.querySelector(`[data-news-id="${newsId}"]`);
- if (!element) return;
-
- if (expandedNewsIds.has(newsId)) {
- expandedNewsIds.delete(newsId);
- element.classList.remove('is-expanded');
- } else {
- expandedNewsIds.add(newsId);
- element.classList.add('is-expanded');
- // Mark as read when expanded
- if (!readNewsIds.has(newsId)) {
- markAsRead(newsId);
- saveReadStatus();
- }
- }
-
- // Rotate the chevron icon
- const icon = element.querySelector('.expand-icon');
- if (icon) {
- icon.style.transform = expandedNewsIds.has(newsId) ? 'rotate(180deg)' : 'rotate(0)';
- }
-}
-
// Share and export functions
function shareNews(newsId) {
const item = newsItems.find(n => n.id === newsId);