diff --git a/config.php.example b/config.php.example index 8c1002a..55798cc 100644 --- a/config.php.example +++ b/config.php.example @@ -8,6 +8,9 @@ "google_language_site" => "", "google_language_results" => "", + // You can set a language for results in wikipedia + "wikipedia_language": "en", + // You can use any Invidious instance here "invidious_instance_for_video_results" => "https://invidious.namazso.eu", diff --git a/docker/attributes.sh b/docker/attributes.sh index 012c7c2..c933033 100755 --- a/docker/attributes.sh +++ b/docker/attributes.sh @@ -19,13 +19,17 @@ export OPEN_SEARCH_HOST=${OPEN_SEARCH_HOST:-"127.0.0.1"} # Replace the 'config.php' script, which contains the most common search engine configurations, with these environment setups # These environment setups can be found in 'config.php', and the default configurations can be useful for most use cases -export CONFIG_GOOGLE_DOMAIN=${CONFIG_GOOGLE_DOMAIN:-".com"} +export CONFIG_GOOGLE_DOMAIN=${CONFIG_GOOGLE_DOMAIN:-"com"} export CONFIG_GOOGLE_LANGUAGE=${CONFIG_GOOGLE_LANGUAGE:-"en"} export CONFIG_INVIDIOUS_INSTANCE=${CONFIG_INVIDIOUS_INSTANCE:-"invidious.namazso.eu"} export CONFIG_HIDDEN_SERVICE_SEARCH=${CONFIG_HIDDEN_SERVICE_SEARCH:-false} export CONFIG_DISABLE_BITTORRENT_SEARCH=${CONFIG_DISABLE_BITTORRENT_SEARCH:-false} export CONFIG_BITTORRENT_TRACKERS=${CONFIG_BITTORRENT_TRACKERS:-"&tr=http://nyaa.tracker.wf:7777/announce&tr=udp://open.stealth.si:80/announce&tr=udp://tracker.opentrackr.org:1337/announce&tr=udp://exodus.desync.com:6969/announce&tr=udp://tracker.torrent.eu.org:451/announce"} +# The settings that will be used to handle Wikipedia results displayed on the libreX search page +# the settings below can be edited via environment variables. +export CONFIG_WIKIPEDIA_LANGUAGE=${CONFIG_WIKIPEDIA_LANGUAGE:-"en"} + # Supported apps integration configuration. These empty spaces can be set up using free hosts as pointers # A particular example is using the "https://yewtu.be" or a self-hosted host to integrate the invidious app to librex export APP_INVIDIOUS=${APP_INVIDIOUS:-""} diff --git a/docker/php/config.php b/docker/php/config.php index ded967d..f90b765 100644 --- a/docker/php/config.php +++ b/docker/php/config.php @@ -4,6 +4,8 @@ "google_language" => "${CONFIG_GOOGLE_LANGUAGE}", "invidious_instance_for_video_results" => "${CONFIG_INVIDIOUS_INSTANCE}", + "wikipedia_language" => "${CONFIG_WIKIPEDIA_LANGUAGE}", + "disable_bittorent_search" => ${CONFIG_DISABLE_BITTORRENT_SEARCH}, "bittorent_trackers" => "${CONFIG_BITTORRENT_TRACKERS}", "disable_hidden_service_search" => ${CONFIG_HIDDEN_SERVICE_SEARCH}, diff --git a/docker/server/nginx.dockerfile b/docker/server/nginx.dockerfile index 59c7a9f..19182b4 100644 --- a/docker/server/nginx.dockerfile +++ b/docker/server/nginx.dockerfile @@ -1,5 +1,9 @@ # Install Nginx with FastCGI enabled, optimizing its performance for serving content RUN apk add nginx +# forward request and error logs to docker log collector +RUN ln -sf "/dev/stdout" "/var/log/nginx/access.log" &&\ + ln -sf "/dev/stderr" "/var/log/nginx/error.log" + # After executing the 'docker run' command, run the 'prepare.sh' script CMD [ "/bin/sh", "-c", "docker/server/prepare.sh" ] diff --git a/engines/google/text.php b/engines/google/text.php index 27b7eec..05cdcf9 100644 --- a/engines/google/text.php +++ b/engines/google/text.php @@ -55,7 +55,8 @@ $url = "https://check.torproject.org/torbulkexitlist"; break; case 7: - $url = "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts%7Cpageimages&exintro&explaintext&redirects=1&pithumbsize=500&titles=$query_encoded"; + $wikipedia_language = $config->wikipedia_language; + $url = "https://$wikipedia_language.wikipedia.org/w/api.php?format=json&action=query&prop=extracts%7Cpageimages&exintro&explaintext&redirects=1&pithumbsize=500&titles=$query_encoded"; break; } diff --git a/engines/special/wikipedia.php b/engines/special/wikipedia.php index d24dd21..ec15e69 100644 --- a/engines/special/wikipedia.php +++ b/engines/special/wikipedia.php @@ -1,6 +1,8 @@ wikipedia_language; - $source = check_for_privacy_frontend("https://en.wikipedia.org/wiki/$query"); + $source = check_for_privacy_frontend("https://$wikipedia_language.wikipedia.org/wiki/$query"); $response = array( "special_response" => array( "response" => htmlspecialchars($description),