Merge branch 'benbusby:main' into main
This commit is contained in:
commit
1bd1946804
57
Dockerfile
57
Dockerfile
|
@ -1,64 +1,57 @@
|
||||||
FROM python:3.8-slim as builder
|
FROM python:3.8-alpine as builder
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apk --update add \
|
||||||
build-essential \
|
build-base \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
libxslt-dev \
|
libxslt-dev \
|
||||||
libssl-dev \
|
openssl-dev \
|
||||||
libffi-dev
|
libffi-dev
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r requirements.txt
|
RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
FROM python:3.8-slim
|
FROM python:3.8-alpine
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apk add --update --no-cache tor curl bash openrc
|
||||||
libcurl4-openssl-dev \
|
# libcurl4-openssl-dev
|
||||||
tor \
|
|
||||||
curl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
ARG config_dir=/config
|
ARG config_dir=/config
|
||||||
RUN mkdir -p $config_dir
|
RUN mkdir -p $config_dir
|
||||||
VOLUME $config_dir
|
VOLUME $config_dir
|
||||||
ENV CONFIG_VOLUME=$config_dir
|
|
||||||
|
|
||||||
ARG username=''
|
ARG username=''
|
||||||
ENV WHOOGLE_USER=$username
|
|
||||||
ARG password=''
|
ARG password=''
|
||||||
ENV WHOOGLE_PASS=$password
|
|
||||||
|
|
||||||
ARG proxyuser=''
|
ARG proxyuser=''
|
||||||
ENV WHOOGLE_PROXY_USER=$proxyuser
|
|
||||||
ARG proxypass=''
|
ARG proxypass=''
|
||||||
ENV WHOOGLE_PROXY_PASS=$proxypass
|
|
||||||
ARG proxytype=''
|
ARG proxytype=''
|
||||||
ENV WHOOGLE_PROXY_TYPE=$proxytype
|
|
||||||
ARG proxyloc=''
|
ARG proxyloc=''
|
||||||
ENV WHOOGLE_PROXY_LOC=$proxyloc
|
|
||||||
|
|
||||||
ARG whoogle_dotenv=''
|
ARG whoogle_dotenv=''
|
||||||
ENV WHOOGLE_DOTENV=$whoogle_dotenv
|
|
||||||
|
|
||||||
ARG use_https=''
|
ARG use_https=''
|
||||||
ENV HTTPS_ONLY=$use_https
|
|
||||||
|
|
||||||
ARG whoogle_port=5000
|
ARG whoogle_port=5000
|
||||||
ENV EXPOSE_PORT=$whoogle_port
|
|
||||||
|
|
||||||
ARG twitter_alt='farside.link/nitter'
|
ARG twitter_alt='farside.link/nitter'
|
||||||
ENV WHOOGLE_ALT_TW=$twitter_alt
|
|
||||||
ARG youtube_alt='farside.link/invidious'
|
ARG youtube_alt='farside.link/invidious'
|
||||||
ENV WHOOGLE_ALT_YT=$youtube_alt
|
|
||||||
ARG instagram_alt='farside.link/bibliogram'
|
ARG instagram_alt='farside.link/bibliogram'
|
||||||
ENV WHOOGLE_ALT_IG=$instagram_alt
|
|
||||||
ARG reddit_alt='farside.link/libreddit'
|
ARG reddit_alt='farside.link/libreddit'
|
||||||
ENV WHOOGLE_ALT_RD=$reddit_alt
|
|
||||||
ARG medium_alt='farside.link/scribe'
|
ARG medium_alt='farside.link/scribe'
|
||||||
ENV WHOOGLE_ALT_MD=$medium_alt
|
|
||||||
ARG translate_alt='lingva.ml'
|
ARG translate_alt='lingva.ml'
|
||||||
ENV WHOOGLE_ALT_TL=$translate_alt
|
|
||||||
|
ENV CONFIG_VOLUME=$config_dir \
|
||||||
|
WHOOGLE_USER=$username \
|
||||||
|
WHOOGLE_PASS=$password \
|
||||||
|
WHOOGLE_PROXY_USER=$proxyuser \
|
||||||
|
WHOOGLE_PROXY_PASS=$proxypass \
|
||||||
|
WHOOGLE_PROXY_TYPE=$proxytype \
|
||||||
|
WHOOGLE_PROXY_LOC=$proxyloc \
|
||||||
|
WHOOGLE_DOTENV=$whoogle_dotenv \
|
||||||
|
HTTPS_ONLY=$use_https \
|
||||||
|
EXPOSE_PORT=$whoogle_port \
|
||||||
|
WHOOGLE_ALT_TW=$twitter_alt \
|
||||||
|
WHOOGLE_ALT_YT=$youtube_alt \
|
||||||
|
WHOOGLE_ALT_IG=$instagram_alt \
|
||||||
|
WHOOGLE_ALT_RD=$reddit_alt \
|
||||||
|
WHOOGLE_ALT_MD=$medium_alt \
|
||||||
|
WHOOGLE_ALT_TL=$translate_alt
|
||||||
|
|
||||||
WORKDIR /whoogle
|
WORKDIR /whoogle
|
||||||
|
|
||||||
|
|
13
README.md
13
README.md
|
@ -179,7 +179,7 @@ pip install -r requirements.txt
|
||||||
See the [available environment variables](#environment-variables) for additional configuration.
|
See the [available environment variables](#environment-variables) for additional configuration.
|
||||||
|
|
||||||
#### systemd Configuration
|
#### systemd Configuration
|
||||||
After building the virtual environment, you can add the following to `/lib/systemd/system/whoogle.service` to set up a Whoogle Search systemd service:
|
After building the virtual environment, you can add something like the following to `/lib/systemd/system/whoogle.service` to set up a Whoogle Search systemd service:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[Unit]
|
[Unit]
|
||||||
|
@ -207,8 +207,14 @@ Description=Whoogle
|
||||||
#Environment=WHOOGLE_DOTENV=1
|
#Environment=WHOOGLE_DOTENV=1
|
||||||
Type=simple
|
Type=simple
|
||||||
User=<username>
|
User=<username>
|
||||||
WorkingDirectory=<whoogle_directory>
|
# If installed as a package, add:
|
||||||
ExecStart=<whoogle_directory>/venv/bin/python3 -um app --host 0.0.0.0 --port 5000
|
ExecStart=<python_install_dir>/python3 <whoogle_install_dir>/whoogle-search --host 127.0.0.1 --port 5000
|
||||||
|
# For example:
|
||||||
|
# ExecStart=/usr/bin/python3 /home/my_username/.local/bin/whoogle-search --host 127.0.0.1 --port 5000
|
||||||
|
# Otherwise if running the app from source, add:
|
||||||
|
ExecStart=<whoogle_repo_dir>/run
|
||||||
|
# For example:
|
||||||
|
# ExecStart=/var/www/whoogle-search/run
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
@ -331,6 +337,7 @@ There are a few optional environment variables available for customizing a Whoog
|
||||||
| WHOOGLE_AUTOCOMPLETE | Controls visibility of autocomplete/search suggestions. Default on -- use '0' to disable |
|
| WHOOGLE_AUTOCOMPLETE | Controls visibility of autocomplete/search suggestions. Default on -- use '0' to disable |
|
||||||
| WHOOGLE_MINIMAL | Remove everything except basic result cards from all search queries. |
|
| WHOOGLE_MINIMAL | Remove everything except basic result cards from all search queries. |
|
||||||
| WHOOGLE_CSP | Sets a default set of 'Content-Security-Policy' headers |
|
| WHOOGLE_CSP | Sets a default set of 'Content-Security-Policy' headers |
|
||||||
|
| WHOOGLE_RESULTS_PER_PAGE | Set the number of results per page |
|
||||||
|
|
||||||
### Config Environment Variables
|
### Config Environment Variables
|
||||||
These environment variables allow setting default config values, but can be overwritten manually by using the home page config menu. These allow a shortcut for destroying/rebuilding an instance to the same config state every time.
|
These environment variables allow setting default config values, but can be overwritten manually by using the home page config menu. These allow a shortcut for destroying/rebuilding an instance to the same config state every time.
|
||||||
|
|
|
@ -3,5 +3,9 @@
|
||||||
if [ "$(whoami)" != "root" ]; then
|
if [ "$(whoami)" != "root" ]; then
|
||||||
tor -f /etc/tor/torrc
|
tor -f /etc/tor/torrc
|
||||||
else
|
else
|
||||||
service tor start
|
if (grep alpine /etc/os-release >/dev/null); then
|
||||||
|
rc-service tor start
|
||||||
|
else
|
||||||
|
service tor start
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -75,7 +75,7 @@ def test_block_results(client):
|
||||||
|
|
||||||
assert has_pinterest
|
assert has_pinterest
|
||||||
|
|
||||||
demo_config['block'] = 'pinterest.com,help.pinterest.com'
|
demo_config['block'] = 'pinterest.com'
|
||||||
rv = client.post(f'/{Endpoint.config}', data=demo_config)
|
rv = client.post(f'/{Endpoint.config}', data=demo_config)
|
||||||
assert rv._status_code == 302
|
assert rv._status_code == 302
|
||||||
|
|
||||||
|
@ -83,7 +83,10 @@ def test_block_results(client):
|
||||||
assert rv._status_code == 200
|
assert rv._status_code == 200
|
||||||
|
|
||||||
for link in BeautifulSoup(rv.data, 'html.parser').find_all('a', href=True):
|
for link in BeautifulSoup(rv.data, 'html.parser').find_all('a', href=True):
|
||||||
assert 'pinterest.com' not in urlparse(link['href']).netloc
|
result_site = urlparse(link['href']).netloc
|
||||||
|
if not result_site:
|
||||||
|
continue
|
||||||
|
assert result_site not in 'pinterest.com'
|
||||||
|
|
||||||
|
|
||||||
def test_recent_results(client):
|
def test_recent_results(client):
|
||||||
|
|
|
@ -61,6 +61,18 @@
|
||||||
# Search using GET requests only (exposes query in logs)
|
# Search using GET requests only (exposes query in logs)
|
||||||
#WHOOGLE_CONFIG_GET_ONLY=1
|
#WHOOGLE_CONFIG_GET_ONLY=1
|
||||||
|
|
||||||
|
# Remove everything except basic result cards from all search queries
|
||||||
|
#WHOOGLE_MINIMAL=0
|
||||||
|
|
||||||
|
# Set the number of results per page
|
||||||
|
#WHOOGLE_RESULTS_PER_PAGE=10
|
||||||
|
|
||||||
|
# Controls visibility of autocomplete/search suggestions
|
||||||
|
#WHOOGLE_AUTOCOMPLETE=1
|
||||||
|
|
||||||
|
# The port where Whoogle will be exposed
|
||||||
|
#EXPOSE_PORT=5000
|
||||||
|
|
||||||
# Set instance URL
|
# Set instance URL
|
||||||
#WHOOGLE_CONFIG_URL=https://<whoogle url>/
|
#WHOOGLE_CONFIG_URL=https://<whoogle url>/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user