diff --git a/app/Search.php b/app/Search.php index 5b098f0e5..7e226a8a2 100644 --- a/app/Search.php +++ b/app/Search.php @@ -33,7 +33,20 @@ public static function providerDetails($provider) return false; } - return (object) $providers[$provider] ?? false; + $details = (object) $providers[$provider] ?? false; + + // For SearXNG, use user-configured URL + if ($provider === 'searx') { + $searxUrl = Setting::fetch('searx_url'); + if (!empty($searxUrl)) { + // Ensure URL doesn't have trailing slash + $searxUrl = rtrim($searxUrl, '/'); + $details->url = $searxUrl . '/search'; + $details->autocomplete = $searxUrl . '/autocompleter?format=x-suggestions&q={query}'; + } + } + + return $details; } /** diff --git a/database/seeders/SettingsSeeder.php b/database/seeders/SettingsSeeder.php index 8618c5263..1d95f6e9d 100755 --- a/database/seeders/SettingsSeeder.php +++ b/database/seeders/SettingsSeeder.php @@ -145,6 +145,7 @@ public function run(): void 'qwant' => 'app.options.qwant', 'bing' => 'app.options.bing', 'startpage' => 'app.options.startpage', + 'searx' => 'app.options.searx', ]); if (! $setting = Setting::find(4)) { @@ -349,5 +350,19 @@ public function run(): void $setting->label = 'app.settings.treat_tags_as'; $setting->save(); } + + if (! $setting = Setting::find(15)) { + $setting = new Setting; + $setting->id = 15; + $setting->group_id = 3; + $setting->key = 'searx_url'; + $setting->type = 'text'; + $setting->label = 'app.settings.searx_url'; + $setting->value = ''; + $setting->save(); + } else { + $setting->label = 'app.settings.searx_url'; + $setting->save(); + } } } diff --git a/lang/en/app.php b/lang/en/app.php index 3c31f53d6..c90fc9c76 100644 --- a/lang/en/app.php +++ b/lang/en/app.php @@ -17,6 +17,7 @@ 'settings.window_target.new' => 'Open in a new tab', 'settings.homepage_search' => 'Homepage Search', 'settings.search_provider' => 'Default Search Provider', + 'settings.searx_url' => 'SearXNG Instance URL', 'settings.language' => 'Language', 'settings.reset' => 'Reset back to default', 'settings.remove' => 'Remove', @@ -38,6 +39,7 @@ 'options.bing' => 'Bing', 'options.qwant' => 'Qwant', 'options.startpage' => 'StartPage', + 'options.searx' => 'SearXNG', 'options.yes' => 'Yes', 'options.no' => 'No', 'options.nzbhydra' => 'NZBHydra', diff --git a/storage/app/searchproviders.yaml b/storage/app/searchproviders.yaml index 540367364..a882ebd9d 100644 --- a/storage/app/searchproviders.yaml +++ b/storage/app/searchproviders.yaml @@ -45,3 +45,12 @@ startpage: method: get target: _blank query: query + +searx: + id: searx + url: https://searx.example.com/search + name: SearXNG + method: get + target: _blank + query: q + autocomplete: https://searx.example.com/autocompleter?format=x-suggestions&q={query}