diff --git a/conf/config.php.example b/conf/config.php.example index 6c42f62..d53280e 100644 --- a/conf/config.php.example +++ b/conf/config.php.example @@ -5,21 +5,120 @@ "google_domain" => "com", // Google results will be in this language - "google_language" => "en", + "google_language_site" => "", + "google_language_results" => "", + "google_number_of_results" => 10, + + // 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.snopyta.org", "disable_bittorent_search" => false, - "bittorent_trackers" => "&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce", + "bittorent_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", - /* - Preset privacy friendly frontends for users, these can be overwritten by users in settings - e.g.: "invidious" => "https://yewtu.be", + "disable_hidden_service_search" => false, + + /* + Preset privacy friendly frontends for users, these can be overwritten by users in the settings + e.g.: Preset the invidious instance URL: "instance_url" => "https://yewtu.be", */ - "invidious" => "", - "bibliogram" => "", - "nitter" => "", - "libreddit" => "", - "proxitok" => "", - "wikiless" => "", + + "frontends" => array( + "invidious" => array( + "instance_url" => "", + "project_url" => "https://docs.invidious.io/instances/", + "original_name" => "YouTube", + "original_url" => "youtube.com" + ), + "rimgo" => array( + "instance_url" => "", + "project_url" => "https://codeberg.org/video-prize-ranch/rimgo#instances", + "original_name" => "Imgur", + "original_url" => "imgur.com" + ), + "scribe" => array( + "instance_url" => "", + "project_url" => "https://git.sr.ht/~edwardloveall/scribe/tree/main/docs/instances.md", + "original_name" => "Medium", + "original_url" => "medium.com" + ), + "gothub" => array( + "instance_url" => "", + "project_url" => "https://codeberg.org/gothub/gothub#instances", + "original_name" => "GitHub", + "original_url" => "github.com" + ), + "librarian" => array( + "instance_url" => "", + "project_url" => "https://codeberg.org/librarian/librarian#clearnet", + "original_name" => "Odysee", + "original_url" => "odysee.com" + ), + + "nitter" => array( + "instance_url" => "", + "project_url" => "https://github.com/zedeus/nitter/wiki/Instances", + "original_name" => "Twitter", + "original_url" => "twitter.com" + ), + + "libreddit" => array( + "instance_url" => "", + "project_url" => "https://github.com/libreddit/libreddit-instances/blob/master/instances.md", + "original_name" => "Reddit", + "original_url" => "reddit.com" + ), + "proxitok" => array( + "instance_url" => "", + "project_url" => "https://github.com/pablouser1/ProxiTok/wiki/Public-instances", + "original_name" => "TikTok", + "original_url" => "tiktok.com" + ), + "wikiless" => array( + "instance_url" => "", + "project_url" => "https://github.com/Metastem/wikiless#instances", + "original_name" => "Wikipedia", + "original_url" => "wikipedia.org" + ), + "quetre" => array( + "instance_url" => "", + "project_url" => "https://github.com/zyachel/quetre#instances", + "original_name" => "Quora", + "original_url" => "quora.com" + ), + "libremdb" => array( + "instance_url" => "", + "project_url" => "https://github.com/zyachel/libremdb#instances", + "original_name" => "IMDb", + "original_url" => "imdb.com" + ), + "breezewiki" => array( + "instance_url" => "", + "project_url" => "https://docs.breezewiki.com/Links.html", + "original_name" => "Fandom", + "original_url" => "fandom.com" + ), + "anonymousoverflow" => array( + "instance_url" => "", + "project_url" => "https://github.com/httpjamesm/AnonymousOverflow#clearnet-instances", + "original_name" => "StackOverflow", + "original_url" => "stackoverflow.com" + ), + "suds" => array( + "instance_url" => "", + "project_url" => "https://git.vern.cc/cobra/Suds/src/branch/main/instances.json", + "original_name" => "Snopes", + "original_url" => "snopes.com" + ), + "biblioreads" => array( + "instance_url" => "", + "project_url" => "https://github.com/nesaku/BiblioReads#instances", + "original_name" => "Goodreads", + "original_url" => "goodreads.com" + ) + ), /* To send requests trough a proxy uncomment CURLOPT_PROXY and CURLOPT_PROXYTYPE: @@ -39,15 +138,14 @@ // CURLOPT_PROXYTYPE => CURLPROXY_HTTP, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", - CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36", - CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, + CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36", + CURLOPT_IPRESOLVE => CURL_IPRESOLVE_WHATEVER, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP, CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP, CURLOPT_MAXREDIRS => 5, - CURLOPT_TIMEOUT => 8, + CURLOPT_TIMEOUT => 18, CURLOPT_VERBOSE => false ) - ); ?> diff --git a/conf/opensearch.xml.example b/conf/opensearch.xml.example index fd84499..81067d4 100644 --- a/conf/opensearch.xml.example +++ b/conf/opensearch.xml.example @@ -1,14 +1,11 @@ LibreX - A meta search engine for Google. + Framework and javascript free privacy respecting meta search engine UTF-8 LibreX search - - - - + + template="/opensearch.xml?method=GET" /> \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 2aac9e5..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,45 +0,0 @@ -[Unit] -Description=LibreX: Privacy meta search engine -After=syslog.target network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/ -ExecStart=__INSTALL_DIR__/auto_updater.sh -Restart=always -RestartSec=10s - -# Sandboxing options to harden security -# Depending on specificities of your service/app, you may need to tweak these -# .. but this should be a good baseline -# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html -NoNewPrivileges=yes -PrivateTmp=yes -PrivateDevices=yes -RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 -RestrictNamespaces=yes -RestrictRealtime=yes -DevicePolicy=closed -ProtectSystem=full -ProtectControlGroups=yes -ProtectKernelModules=yes -ProtectKernelTunables=yes -LockPersonality=yes -SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap - -# Denying access to capabilities that should not be relevant for webapps -# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html -CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD -CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE -CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT -CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK -CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM -CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG -CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE -CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW -CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG - -[Install] -WantedBy=multi-user.target diff --git a/scripts/backup b/scripts/backup index 1352ed3..eaaecc1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -39,12 +39,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 1b5721c..40335e8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,15 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -29,20 +20,11 @@ ynh_change_url_nginx_config # SPECIFIC MODIFICATIONS #================================================= -ynh_add_config --template="../conf/opensearch.xml.example" --destination="$install_dir/opensearch.xml" +ynh_add_config --template="opensearch.xml.example" --destination="$install_dir/opensearch.xml" chmod 650 "$install_dir/opensearch.xml" chown $app:www-data "$install_dir/opensearch.xml" -#================================================= -# GENERIC FINALISATION -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 4d9052a..f430060 100755 --- a/scripts/install +++ b/scripts/install @@ -26,40 +26,27 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low +ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config -# Create a dedicated systemd config -ynh_add_systemd_config - # Use logrotate to manage application logfile(s) ynh_use_logrotate -yunohost service add $app --description="Privacy meta search engine" --log="/var/log/$app/$app.log" - #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.php.example" --destination="$install_dir/config.php" -ynh_add_config --template="../conf/opensearch.xml.example" --destination="$install_dir/opensearch.xml" +ynh_add_config --template="config.php.example" --destination="$install_dir/config.php" +ynh_add_config --template="opensearch.xml.example" --destination="$install_dir/opensearch.xml" chmod 400 "$install_dir/config.php" chown $app:$app "$install_dir/config.php" chmod 650 "$install_dir/opensearch.xml" chown $app:www-data "$install_dir/opensearch.xml" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=3 - -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index c10baa6..eac7b1b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -15,13 +15,6 @@ source /usr/share/yunohost/helpers # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app -fi - # Remove the dedicated systemd config ynh_remove_systemd_config diff --git a/scripts/restore b/scripts/restore index 0ce0c96..f03f180 100755 --- a/scripts/restore +++ b/scripts/restore @@ -29,15 +29,8 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - ynh_restore_file --origin_path="/etc/logrotate.d/$app" -yunohost service add $app --description="Privacy meta search engine" --log="/var/log/$app/$app.log" - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7378277..7ab5f70 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,15 +15,6 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -45,26 +36,14 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low +ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config -# Create a dedicated systemd config -ynh_add_systemd_config - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -yunohost service add $app --description="Privacy meta search engine" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=3 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # END OF SCRIPT #=================================================