2021-12-19 21:59:06 +03:00
|
|
|
FROM python:3.8-alpine as builder
|
2020-04-08 23:05:28 +03:00
|
|
|
|
2021-12-19 21:59:06 +03:00
|
|
|
RUN apk --update add \
|
|
|
|
build-base \
|
2021-01-06 01:53:58 +03:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
2021-12-19 21:59:06 +03:00
|
|
|
openssl-dev \
|
2021-02-26 18:49:40 +03:00
|
|
|
libffi-dev
|
2021-12-22 00:26:01 +03:00
|
|
|
|
2020-05-10 15:00:22 +03:00
|
|
|
COPY requirements.txt .
|
2021-02-26 18:49:40 +03:00
|
|
|
|
2021-12-22 00:26:01 +03:00
|
|
|
RUN pip install --upgrade pip
|
2021-02-26 18:49:40 +03:00
|
|
|
RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r requirements.txt
|
|
|
|
|
2021-12-19 21:59:06 +03:00
|
|
|
FROM python:3.8-alpine
|
2021-02-26 18:49:40 +03:00
|
|
|
|
2021-12-19 21:59:06 +03:00
|
|
|
RUN apk add --update --no-cache tor curl bash openrc
|
2021-12-22 00:26:01 +03:00
|
|
|
# libcurl4-openssl-dev
|
2020-05-10 15:00:22 +03:00
|
|
|
|
2020-05-14 03:27:04 +03:00
|
|
|
ARG config_dir=/config
|
2020-05-16 18:11:00 +03:00
|
|
|
RUN mkdir -p $config_dir
|
2020-05-14 03:27:04 +03:00
|
|
|
VOLUME $config_dir
|
|
|
|
|
2020-05-18 19:30:32 +03:00
|
|
|
ARG username=''
|
|
|
|
ARG password=''
|
Add tor and http/socks proxy support (#137)
* Add tor and http/socks proxy support
Allows users to enable/disable tor from the config menu, which will
forward all requests through Tor.
Also adds support for setting environment variables for alternative
proxy support. Setting the following variables will forward requests
through the proxy:
- WHOOGLE_PROXY_USER (optional)
- WHOOGLE_PROXY_PASS (optional)
- WHOOGLE_PROXY_TYPE (required)
- Can be "http", "socks4", or "socks5"
- WHOOGLE_PROXY_LOC (required)
- Format: "<ip address>:<port>"
See #30
* Refactor acquire_tor_conn -> acquire_tor_identity
Also updated travis CI to set up tor
* Add check for Tor socket on init, improve Tor error handling
Initializing the app sends a heartbeat request to Tor to check for
availability, and updates the home page config options accordingly. This
heartbeat is sent on every request, to ensure Tor support can be
reconfigured without restarting the entire app.
If Tor support is enabled, and a subsequent request fails, then a new
TorError exception is raised, and the Tor feature is disabled until a
valid connection is restored.
The max attempts has been updated to 10, since 5 seemed a bit too low
for how quickly the attempts go by.
* Change send_tor_signal arg type, update function doc
send_tor_signal now accepts a stem.Signal arg (a bit cleaner tbh). Also
added the doc string for the "disable" attribute in TorError.
* Fix tor identity logic in Request.send
* Update proxy init, change proxyloc var name
Proxy is now only initialized if both type and location are specified,
as neither have a default fallback and both are required. I suppose the
type could fall back to http, but seems safer this way.
Also refactored proxyurl -> proxyloc for the runtime args in order to
match the Dockerfile args.
* Add tor/proxy support for Docker builds, fix opensearch/init
The Dockerfile is now updated to include support for Tor configuration,
with a working torrc file included in the repo.
An issue with opensearch was fixed as well, which was uncovered during
testing and was simple enough to fix here. Likewise, DDG bang gen was
updated to only ever happen if the file didn't exist previously, as
testing with the file being regenerated every time was tedious.
* Add missing "@" for socks proxy requests
2020-10-29 03:47:42 +03:00
|
|
|
ARG proxyuser=''
|
|
|
|
ARG proxypass=''
|
|
|
|
ARG proxytype=''
|
|
|
|
ARG proxyloc=''
|
2021-03-28 20:27:08 +03:00
|
|
|
ARG whoogle_dotenv=''
|
2020-05-16 00:44:50 +03:00
|
|
|
ARG use_https=''
|
|
|
|
ARG whoogle_port=5000
|
Use farside.link for frontend alternatives in results (#560)
* Integrate Farside into Whoogle
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
* Expand conversion of config<->url params
Config settings can now be translated to and from URL params using a
predetermined set of "safe" keys (i.e. config settings that easily
translate to URL params).
* Allow jumping instances via Farside when ratelimited
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
Closes #554
Closes #559
2021-12-09 03:27:33 +03:00
|
|
|
ARG twitter_alt='farside.link/nitter'
|
|
|
|
ARG youtube_alt='farside.link/invidious'
|
|
|
|
ARG instagram_alt='farside.link/bibliogram'
|
|
|
|
ARG reddit_alt='farside.link/libreddit'
|
|
|
|
ARG medium_alt='farside.link/scribe'
|
2021-06-15 17:14:42 +03:00
|
|
|
ARG translate_alt='lingva.ml'
|
2022-01-14 19:59:03 +03:00
|
|
|
ARG imgur_alt='imgin.voidnet.tech'
|
|
|
|
ARG wikipedia_alt='wikiless.org'
|
2021-12-19 21:59:06 +03:00
|
|
|
|
|
|
|
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 \
|
2022-01-14 20:05:24 +03:00
|
|
|
WHOOGLE_ALT_TL=$translate_alt \
|
|
|
|
WHOOGLE_ALT_IMG=$imgur_alt \
|
2022-01-14 19:59:03 +03:00
|
|
|
WHOOGLE_ALT_WIKI=$wikipedia_alt
|
2020-12-06 01:01:21 +03:00
|
|
|
|
2021-02-26 18:49:40 +03:00
|
|
|
WORKDIR /whoogle
|
|
|
|
|
|
|
|
COPY --from=builder /install /usr/local
|
2021-03-17 19:27:08 +03:00
|
|
|
COPY misc/tor/torrc /etc/tor/torrc
|
|
|
|
COPY misc/tor/start-tor.sh misc/tor/start-tor.sh
|
2021-02-26 18:49:40 +03:00
|
|
|
COPY app/ app/
|
2021-10-19 21:44:44 +03:00
|
|
|
COPY run .
|
|
|
|
#COPY whoogle.env .
|
2020-04-08 23:05:28 +03:00
|
|
|
|
2021-07-02 23:13:42 +03:00
|
|
|
# Allow writing symlinks to build dir
|
|
|
|
RUN chown 102:102 app/static/build
|
|
|
|
|
2020-05-16 00:44:50 +03:00
|
|
|
EXPOSE $EXPOSE_PORT
|
2020-05-10 15:00:22 +03:00
|
|
|
|
2021-04-07 19:39:12 +03:00
|
|
|
HEALTHCHECK --interval=30s --timeout=5s \
|
2021-05-18 18:48:15 +03:00
|
|
|
CMD curl -f http://localhost:${EXPOSE_PORT}/healthz || exit 1
|
2021-03-08 20:38:40 +03:00
|
|
|
|
2021-03-17 19:27:08 +03:00
|
|
|
CMD misc/tor/start-tor.sh & ./run
|