From 20fce34db312aa93516ee27fa989f1d5ccb8c4e1 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sat, 11 Apr 2020 15:24:00 -0600 Subject: [PATCH] Added opensearch setup --- README.md | 7 ++++--- app/static/opensearch.template | 19 +++++++++---------- opensearch.py | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 opensearch.py diff --git a/README.md b/README.md index 0ebe2e3..e23a1e7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Shoogle -Get Google search results, but without any ads, javascript, or AMP links. Easily deployable via Docker, and customizable with a single config text file. Quick and simple to integrate as a primary search engine replacement on both desktop and mobile. +Get Google search results, but without any ads, javascript, or AMP links. Easily deployable via Docker, and customizable with a single config text file. Quick and simple to integrate as a primary search engine replacement on both desktop and mobile. ## Prerequisites - Docker ([Windows](https://docs.docker.com/docker-for-windows/install/), [macOS](https://docs.docker.com/docker-for-mac/install/), [Ubuntu](https://docs.docker.com/engine/install/ubuntu/), [other Linux distros](https://docs.docker.com/engine/install/binaries/)) @@ -20,7 +20,7 @@ heroku login heroku container:login git clone https://github.com/benbusby/shoogle.git cd shoogle -heroku create +heroku create heroku container:push web heroku container:release web heroku open @@ -31,8 +31,9 @@ TODO ## Extra Steps - Set Shoogle as your primary search engine + - From the main shoogle folder, run `python opensearch.py "\"` - Firefox (Desktop) - - Navigate to your running app's url, and click the 3 dot menu in the address bar. At the bottom, there should be an option to "Add Search Engine". Once you've clicked this, open your Firefox Preferences menu, click "Search" in the left menu, and use the available dropdown to select "Shoogle" from the list. + - Navigate to your app's url, and click the 3 dot menu in the address bar. At the bottom, there should be an option to "Add Search Engine". Once you've clicked this, open your Firefox Preferences menu, click "Search" in the left menu, and use the available dropdown to select "Shoogle" from the list. - Firefox (Mobile) - In the mobile app Settings page, tap "Search" within the "General" section. There should be an option titled "Add Search Engine" to select. It should prompt you to enter a title and search query url - use the following elements to fill out the form: - Title: "Shoogle" diff --git a/app/static/opensearch.template b/app/static/opensearch.template index 601b7e1..04f43b8 100644 --- a/app/static/opensearch.template +++ b/app/static/opensearch.template @@ -1,14 +1,13 @@ - [SNK] - [Search engine full name and summary] - [UTF-8] - [https://example.com/favicon.ico] - - - - + Shoogle + Shoogle: A lightweight, deployable Google search proxy for desktop/mobile that removes Javascript, AMP links, and ads + UTF-8 + /static/img/favicon.ico + + - - [https://example.com/search] + + SHOOGLE_URL + diff --git a/opensearch.py b/opensearch.py new file mode 100644 index 0000000..29482f9 --- /dev/null +++ b/opensearch.py @@ -0,0 +1,19 @@ +import sys + +template_path = './app/static/opensearch.template' +opensearch_path = './app/static/opensearch.xml' +replace_tag = 'SHOOGLE_URL' + +if len(sys.argv) != 2: + print('You must provide the url as an argument for this script.') + print('Example: python opensearch.py "https://my-app-1776.herokuapps.com"') + sys.exit(0) + +app_url = sys.argv[1] +opensearch_template = open(template_path, 'r').read() + +with open(opensearch_path, 'w') as opensearch_xml: + opensearch_xml.write(opensearch_template.replace(replace_tag, app_url)) + opensearch_xml.close() + +print('\nDone - you may now set Shoogle as your primary search engine')