Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions database/seeders/SettingsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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();
}
}
}
2 changes: 2 additions & 0 deletions lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
9 changes: 9 additions & 0 deletions storage/app/searchproviders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}