From 6a150092a28a1ce6c2374572c382f136a96c49ed Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Thu, 16 Apr 2020 18:50:31 -0600 Subject: [PATCH] Fixed config bug in filter, updated run script to work on mac os --- app/filter.py | 12 ++++++------ run | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/filter.py b/app/filter.py index f218068..64360f0 100644 --- a/app/filter.py +++ b/app/filter.py @@ -9,8 +9,8 @@ class Filter: if config is None: config = {} - self.near_city = config['near'] if 'near' in config else None - self.dark_mode = config['dark_mode'] if 'dark_mode' in config else False + self.near = config['near'] if 'near' in config else None + self.dark = config['dark'] if 'dark' in config else False self.nojs = config['nojs'] if 'nojs' in config else False self.mobile = mobile @@ -19,7 +19,7 @@ class Filter: page = page.replace('>G<', '>Sh<') pattern = re.compile('4285f4|ea4335|fbcc05|34a853|fbbc05', re.IGNORECASE) page = pattern.sub('685e79', page) - if self.dark_mode: + if self.dark: page = page.replace('fff', '000').replace('202124', 'ddd').replace('1967D2', '3b85ea') return page @@ -47,8 +47,8 @@ class Filter: # Grab city from config, if available near = '' - if self.near_city: - near = '&near=' + urlparse.quote(self.near_city) + if self.near: + near = '&near=' + urlparse.quote(self.near) return q + tbs + tbm + start + near @@ -98,7 +98,7 @@ class Filter: a.append(nojs_link) # Set up dark mode if active - if self.dark_mode: + if self.dark: soup.find('html')['style'] = 'scrollbar-color: #333 #111;' for input_element in soup.findAll('input'): input_element['style'] = 'color:#fff;' diff --git a/run b/run index 289dce9..e878ca4 100755 --- a/run +++ b/run @@ -3,8 +3,7 @@ # ./run # Runs the full web app # ./run test # Runs the testing suite -SCRIPT=`realpath $0` -SCRIPT_DIR=`dirname $SCRIPT` +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" # Set default port if unavailable if [[ -z "${PORT}" ]]; then