1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/searx_ynh.git synced 2024-09-03 20:16:30 +02:00
This commit is contained in:
Adrien Beudin 2014-07-22 23:55:17 +02:00
parent e6c95101c4
commit 1257e1c570
6 changed files with 119 additions and 161 deletions

View file

@ -8,7 +8,13 @@ location PATHTOCHANGE {
location @searx {
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
include uwsgi_params;
<<<<<<< HEAD
# Include SSOWAT user panel.
#include conf.d/yunohost_panel.conf.inc;
=======
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
}

View file

@ -8,7 +8,14 @@ location @searx {
uwsgi_param SCRIPT_NAME PATHTOCHANGE;
include uwsgi_params;
uwsgi_modifier1 30;
<<<<<<< HEAD
uwsgi_pass unix:///run/uwsgi/app/searx/socket;
# Include SSOWAT user panel.
#include conf.d/yunohost_panel.conf.inc;
=======
uwsgi_pass unix:/run/uwsgi/app/searx/socket;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
}

View file

@ -3,7 +3,7 @@ server:
secret_key : "ultrasecretkey" # change this!
debug : True
request_timeout : 2.0 # seconds
base_url : False
base_url : ynhbaseurl
engines:
- name : wikipedia

View file

@ -1,156 +0,0 @@
server:
port : 8888
secret_key : "ultrasecretkey" # change this!
debug : True
request_timeout : 2.0 # seconds
base_url : True
engines:
- name : wikipedia
engine : wikipedia
number_of_results : 1
paging : False
shortcut : wp
- name : bing
engine : bing
locale : en-US
shortcut : bi
- name : bing news
engine : bing_news
locale : en-US
shortcut : bin
- name : currency
engine : currency_convert
categories : general
shortcut : cc
- name : deviantart
engine : deviantart
categories : images
shortcut : da
timeout: 3.0
- name : ddg definitions
engine : duckduckgo_definitions
shortcut : ddd
- name : duckduckgo
engine : duckduckgo
locale : en-us
shortcut : ddg
- name : filecrop
engine : filecrop
categories : files
shortcut : fc
- name : flickr
engine : flickr
categories : images
shortcut : fl
timeout: 3.0
- name : github
engine : github
categories : it
shortcut : gh
- name : google
engine : google
shortcut : go
- name : google images
engine : google_images
shortcut : goi
- name : google news
engine : google_news
shortcut : gon
- name : piratebay
engine : piratebay
categories : videos, music, files
shortcut : tpb
- name : soundcloud
engine : soundcloud
categories : music
shortcut : sc
- name : stackoverflow
engine : stackoverflow
categories : it
shortcut : st
- name : startpage
engine : startpage
base_url : 'https://startpage.com/'
search_url : 'https://startpage.com/do/search'
shortcut : sp
# +30% page load time
# - name : ixquick
# engine : startpage
# base_url : 'https://www.ixquick.com/'
# search_url : 'https://www.ixquick.com/do/search'
- name : twitter
engine : twitter
categories : social media
shortcut : tw
# maybe in a fun category
# - name : uncyclopedia
# engine : mediawiki
# categories : general
# shortcut : unc
# url : https://uncyclopedia.wikia.com/
# tmp suspended - too slow, too many errors
# - name : urbandictionary
# engine : xpath
# search_url : http://www.urbandictionary.com/define.php?term={query}
# url_xpath : //div[@class="word"]//a/@href
# title_xpath : //div[@class="word"]//a
# content_xpath : //div[@class="definition"]
# shortcut : ud
- name : yahoo
engine : yahoo
shortcut : yh
- name : yahoo news
engine : yahoo_news
shortcut : yhn
- name : youtube
engine : youtube
categories : videos
shortcut : yt
- name : dailymotion
engine : dailymotion
locale : en_US
categories : videos
shortcut : dm
- name : vimeo
engine : vimeo
categories : videos
results_xpath : //div[@id="browse_content"]/ol/li
url_xpath : ./a/@href
title_xpath : ./a/div[@class="data"]/p[@class="title"]/text()
content_xpath : ./a/img/@src
shortcut : vm
locales:
en : English
de : Deutsch
hu : Magyar
fr : Français
es : Español
it : Italiano
nl : Nederlands

View file

@ -8,9 +8,16 @@ is_public=$3
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a searx
if [[ ! $? -eq 0 ]]; then
<<<<<<< HEAD
exit 1
fi
=======
exit 1
fi
# Save specific settings
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
sudo yunohost app setting searx is_public -v $is_public
# Check depends installation
@ -43,13 +50,22 @@ then
fi
#Configuration Searx
if [ $path != "/" ];
sudo cp ../conf/settings.yml /opt/searx/searx/
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml
if [ "$path" != "/" ];
then
<<<<<<< HEAD
sudo cp ../conf/settings.yml-noroot /opt/yunohost/searx/searx/settings.yml
else
sudo cp ../conf/settings.yml /opt/yunohost/searx/searx/
fi
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/yunohost/searx/searx/settings.yml
=======
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" /opt/searx/searx/settings.yml
else
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" /opt/searx/searx/settings.yml
fi
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
# Set permissions to searx directory
sudo useradd searx -d /opt/yunohost/searx
@ -61,7 +77,7 @@ sudo ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
# Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
if [ $path != "/" ];
if [ "$path" != "/" ];
then
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
else
@ -76,10 +92,13 @@ fi
sudo service nginx reload
sudo service uwsgi restart
if [ $is_public = "Yes" ];
if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting searx skipped_uris -v "/"
<<<<<<< HEAD
else
sudo sed -i 's/#include conf/include conf/' /etc/nginx/conf.d/$domain.d/searx.conf
=======
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
fi
sudo yunohost app ssowatconf

View file

@ -1,17 +1,29 @@
<<<<<<< HEAD
#!/bin/bash
=======
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
# Retrieve arguments
domain=$(sudo yunohost app setting searx domain)
path=$(sudo yunohost app setting searx path)
is_public=$(sudo yunohost app setting searx is_public)
<<<<<<< HEAD
# Check depends installation
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev uwsgi uwsgi-plugin-python -y
=======
# Remove trailing "/" for next commands
path=${path%/}
# Check depends installation
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-pybabel zlib1g-dev -y
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
# Check Swap
if [ $(sudo swapon -s | wc -l) = 1 ];
then
<<<<<<< HEAD
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=128
sudo chmod 600 /tmp/myswapfile
sudo mkswap /tmp/myswapfile
@ -34,10 +46,28 @@ sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
sudo cp -r ../sources/* /opt/yunohost/searx/
sudo virtualenv /opt/yunohost/searx
sudo bash -c "source /opt/yunohost/searx/bin/activate && pip install -r /opt/yunohost/searx/requirements.txt"
=======
sudo dd if=/dev/zero of=/tmp/myswapfile bs=1M count=1024
sudo chmod 600 /tmp/myswapfile
sudo mkswap /tmp/myswapfile
sudo swapon /tmp/myswapfile
fi
# Init virtualenv
if [ ! -d /opt/searx ];
then
sudo mkdir /opt/searx
fi
sudo cp -r ../sources/* /opt/searx
sudo virtualenv /opt/searx
sudo bash -c "source /opt/searx/bin/activate && pip install -r /opt/searx/requirements.txt"
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca
# Disable swapfile
if [ -f /tmp/myswapfile ];
then
<<<<<<< HEAD
sudo swapoff /tmp/myswapfile
sudo rm -f /tmp/myswapfile
fi
@ -59,3 +89,55 @@ fi
## Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo service uwsgi restart
=======
sudo swapoff /tmp/myswapfile
sudo rm -f /tmp/myswapfile
fi
# Remove trailing "/" for next commands if installing on a subpath
if [ "$path" != "/" ];
then
path=${path%/}
fi
#Configuration Searx
sudo cp ../conf/settings.yml /opt/searx/searx/
sudo sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" /opt/searx/searx/settings.yml
if [ "$path" != "/" ];
then
sudo sed -i -e "s@ynhbaseurl@https://$domain$path/@g" /opt/searx/searx/settings.yml
else
sudo sed -i -e "s@ynhbaseurl@https://$domain$path@g" /opt/searx/searx/settings.yml
fi
# Set permissions to searx directory
sudo useradd searx -d /opt/searx
sudo chown searx:searx -R /opt/searx
# Copy uwsgi config
sudo cp ../conf/searx.ini /etc/uwsgi/apps-available/
sudo ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
# Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
if [ "$path" != "/" ];
then
sudo cp ../conf/nginx.conf-noroot /etc/nginx/conf.d/$domain.d/searx.conf
else
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/searx.conf
fi
# Fix permission
#sudo find /opt/searx/ -type d -exec chmod 2755 {} \;
#sudo find /opt/searx/ -type f -exec chmod g+r,o+r {} \;
## Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo service uwsgi restart
if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting searx skipped_uris -v "/"
fi
sudo yunohost app ssowatconf
>>>>>>> 90736b2cc32bd424c78355499e1bfb61062af8ca