Skip to content

Commit

Permalink
Cookie consent by lilcezz (#105)
Browse files Browse the repository at this point in the history
* Update app.py

* Update utils.py

* Update map.html

* Update config.ini.example

* Update map.html

* Goodbye Travis! 👀

* Add logging

* Update utils.py
  • Loading branch information
darkelement1987 committed Apr 20, 2018
1 parent a43cf78 commit 5fab015
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#captcha-solving # Enables captcha solving. (default=False)
#show-all-zoom-level # Show all Pokemon, even excluded, at this map zoom level.
# Set to 0 to disable this feature. Set to 19 or higher for nice results.
#cookies # Enable cookie consent. (default=False)


# Database settings
Expand Down
3 changes: 3 additions & 0 deletions pogom/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ def fullmap(self, statusname=None):
'fixed_display': not args.fixed_location,
'custom_css': args.custom_css,
'custom_js': args.custom_js,
'cookies': args.cookies,
'medalpokemon': args.medalpokemon
}

Expand All @@ -393,6 +394,7 @@ def fullmap(self, statusname=None):
gmaps_key=args.gmaps_key,
lang=args.locale,
show=visibility_flags,
cookies=args.cookies,
rarityFileName=args.rarity_filename)

def raw_data(self):
Expand Down Expand Up @@ -717,6 +719,7 @@ def get_stats(self):
lng=self.current_location[1],
generateImages=str(args.generate_images).lower(),
gmaps_key=args.gmaps_key,
cookies=args.cookies,
show=visibility_flags)

def get_gymdata(self):
Expand Down
7 changes: 7 additions & 0 deletions pogom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,9 @@ def get_args():
help='Use ImageMagick to generate dynamic' +
'icons on demand.',
action='store_true', default=False)
parser.add_argument('-cc', '--cookies',
help=('Enable cookie consent.'),
action='store_true', default=False)
parser.add_argument('-pgsu', '--pgscout-url', default=None,
help='URL to query PGScout for Pokemon IV/CP.')
parser.add_argument('-lurl', '--lure-url', default=None,
Expand Down Expand Up @@ -1011,6 +1014,10 @@ def init_args(args):
args.enc_whitelist_file))
watchercfg['enc_whitelist'] = (args.enc_whitelist_file, None)

# Cookie consent
if args.cookies:
log.info("Cookie consent enabled")

# Prepare webhook whitelist - empty list means no restrictions
args.webhook_whitelist = []
if args.webhook_whitelist_file:
Expand Down
5 changes: 4 additions & 1 deletion templates/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -750,5 +750,8 @@ <h3>Location Icon Marker</h3>
<script src="{{ url_for('static', filename='dist/js/weather.min.js').lstrip('/') }}"></script>
<script defer src="https://maps.googleapis.com/maps/api/js?key={{ gmaps_key }}&amp;callback=initMap&amp;libraries=places,geometry"></script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
</body>
{% if show.cookies %}
<script type="text/javascript" id="cookieinfo" src="//cookieinfoscript.com/js/cookieinfo.min.js"></script>
{% endif %}
</body>
</html>

0 comments on commit 5fab015

Please sign in to comment.