From eaa3aa3e3889c539f5e44a579990fa2d6cd52824 Mon Sep 17 00:00:00 2001 From: FrostTheFox Date: Wed, 14 Sep 2016 15:53:38 -0400 Subject: [PATCH 01/33] Update pokemon.json (#1305) --- static/data/pokemon.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/data/pokemon.json b/static/data/pokemon.json index bf3303d476..3b482969ce 100644 --- a/static/data/pokemon.json +++ b/static/data/pokemon.json @@ -1811,7 +1811,7 @@ }, "143": { "name": "Snorlax", - "rarity": "Rare", + "rarity": "Very Rare", "types": [ { "type": "Normal", From e6de0458137f97dab2492dc501fa7287897c844f Mon Sep 17 00:00:00 2001 From: Johnny Disco Date: Wed, 14 Sep 2016 16:02:24 -0400 Subject: [PATCH 02/33] Matches Polyfill (#1100) --- static/js/app.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/static/js/app.js b/static/js/app.js index b6a8470c7a..2d1fb7508b 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -2,6 +2,20 @@ 'use strict' // Methods/polyfills. + if (!Element.prototype.matches) { + Element.prototype.matches = + Element.prototype.matchesSelector || + Element.prototype.mozMatchesSelector || + Element.prototype.msMatchesSelector || + Element.prototype.oMatchesSelector || + Element.prototype.webkitMatchesSelector || + function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s) + var i = matches.length + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1 + } + } // addEventsListener var addEventsListener = function (o, t, e) { From b7f4f2dc27448653aa8e529f4467050151a2e100 Mon Sep 17 00:00:00 2001 From: gabaod Date: Sat, 17 Sep 2016 17:04:57 -0500 Subject: [PATCH 03/33] Update index.rst (#1322) updated windows link for nodejs, was 4.4.7 move to 4.5.0 --- docs/basic-install/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basic-install/index.rst b/docs/basic-install/index.rst index 9f0a2a5928..b8cb31d508 100644 --- a/docs/basic-install/index.rst +++ b/docs/basic-install/index.rst @@ -87,7 +87,7 @@ Linux/OSX: In order to run from a git clone, you must compile the front-end assets with node. Make sure you have node installed for your platform: - * `Windows `_ + * `Windows `_ * `OSX `_ * Linux -- refer to the `package installation `_ for your flavor of OS From 0ecc55adcc2d493d227763232421e9bc8711b7bc Mon Sep 17 00:00:00 2001 From: primaxius Date: Sat, 17 Sep 2016 23:05:36 -0600 Subject: [PATCH 04/33] Move commandline page from wiki to docs (#1326) Reorganizing to keep docs in docs --- docs/extras/commandline.md | 159 +++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 docs/extras/commandline.md diff --git a/docs/extras/commandline.md b/docs/extras/commandline.md new file mode 100644 index 0000000000..c364e350e1 --- /dev/null +++ b/docs/extras/commandline.md @@ -0,0 +1,159 @@ +usage: runserver.py + [-h] [-a AUTH_SERVICE] [-u USERNAME] [-p PASSWORD] + [-w WORKERS] [-asi ACCOUNT_SEARCH_INTERVAL] + [-ari ACCOUNT_REST_INTERVAL] [-ac ACCOUNTCSV] + [-l LOCATION] [-j] [-st STEP_LIMIT] [-sd SCAN_DELAY] + [-ld LOGIN_DELAY] [-lr LOGIN_RETRIES] [-mf MAX_FAILURES] + [-msl MIN_SECONDS_LEFT] [-dc] [-H HOST] [-P PORT] + [-L LOCALE] [-c] [-m MOCK] [-ns] [-os] [-nsc] [-fl] -k + GMAPS_KEY [--spawnpoints-only] [-C] [-D DB] [-cd] [-np] + [-ng] [-nk] [-ss [SPAWNPOINT_SCANNING]] + [--dump-spawnpoints] [-pd PURGE_DATA] [-px PROXY] + [-pxt PROXY_TIMEOUT] [-pxd PROXY_DISPLAY] + [--db-type DB_TYPE] [--db-name DB_NAME] + [--db-user DB_USER] [--db-pass DB_PASS] + [--db-host DB_HOST] [--db-port DB_PORT] + [--db-max_connections DB_MAX_CONNECTIONS] + [--db-threads DB_THREADS] [-wh [WEBHOOKS [WEBHOOKS ...]]] + [-gi] [--webhook-updates-only] [--wh-threads WH_THREADS] + [--ssl-certificate SSL_CERTIFICATE] + [--ssl-privatekey SSL_PRIVATEKEY] [-ps] [-sn STATUS_NAME] + [-spp STATUS_PAGE_PASSWORD] [-el ENCRYPT_LIB] + [-v [filename.log] | -vv [filename.log] | -d] + +Args that start with '--' (eg. -a) can also be set in a config file +(C:\Users\User\Desktop\Pogom\PokemonGo-map\pogom\../config/config.ini or ). +The recognized syntax for setting (key, value) pairs is based on the INI and +YAML formats (e.g. key=value or foo=TRUE). For full documentation of the +differences from the standards please refer to the ConfigArgParse +documentation. If an arg is specified in more than one place, then commandline +values override environment variables which override config file values which +override defaults. + +optional arguments: + -h, --help Show this help message and exit. + -a AUTH_SERVICE, --auth-service AUTH_SERVICE + Auth Services, either one for all accounts or one per + account: ptc or google. Defaults all to ptc. + -u USERNAME, --username USERNAME + Usernames, one per account. + -p PASSWORD, --password PASSWORD + Passwords, either single one for all accounts or one + per account. + -w WORKERS, --workers WORKERS + Number of search worker threads to start. Defaults to + the number of accounts specified. + -asi ACCOUNT_SEARCH_INTERVAL, --account-search-interval ACCOUNT_SEARCH_INTERVAL + Seconds for accounts to search before switching to a + new account. 0 to disable. + -ari ACCOUNT_REST_INTERVAL, --account-rest-interval ACCOUNT_REST_INTERVAL + Seconds for accounts to rest when they fail or are + switched out. + -ac ACCOUNTCSV, --accountcsv ACCOUNTCSV + Load accounts from CSV file containing + "auth_service,username,passwd" lines. + -l LOCATION, --location LOCATION + Location, can be an address or coordinates. + -j, --jitter Apply random -9m to +9m jitter to location. + -st STEP_LIMIT, --step-limit STEP_LIMIT + Steps. + -sd SCAN_DELAY, --scan-delay SCAN_DELAY + Time delay between requests in scan threads. + -ld LOGIN_DELAY, --login-delay LOGIN_DELAY + Time delay between each login attempt. + -lr LOGIN_RETRIES, --login-retries LOGIN_RETRIES + Number of logins attempts before refreshing a thread. + -mf MAX_FAILURES, --max-failures MAX_FAILURES + Maximum number of failures to parse locations before + an account will go into a two hour sleep. + -msl MIN_SECONDS_LEFT, --min-seconds-left MIN_SECONDS_LEFT + Time that must be left on a spawn before considering + it too late and skipping it. eg. 600 would skip + anything with < 10 minutes remaining. Default 0. + -dc, --display-in-console + Display Found Pokemon in Console. + -H HOST, --host HOST Set web server listening host. + -P PORT, --port PORT Set web server listening port. + -L LOCALE, --locale LOCALE + Locale for Pokemon names (default: en, check + static/dist/locales for more). + -c, --china Coordinates transformer for China. + -m MOCK, --mock MOCK Mock mode - point to a fpgo endpoint instead of using + the real PogoApi, ec: http://127.0.0.1:9090. + -ns, --no-server No-Server Mode. Starts the searcher but not the + Webserver. + -os, --only-server Server-Only Mode. Starts only the Webserver without + the searcher. + -nsc, --no-search-control + Disables search control. + -fl, --fixed-location + Hides the search bar for use in shared maps. + -k GMAPS_KEY, --gmaps-key GMAPS_KEY + Google Maps Javascript API Key. + --spawnpoints-only Only scan locations with spawnpoints in them. + -C, --cors Enable CORS on web server. + -D DB, --db DB Database filename. + -cd, --clear-db Deletes the existing database before starting the + Webserver. + -np, --no-pokemon Disables Pokemon from the map (including parsing them + into local db). + -ng, --no-gyms Disables Gyms from the map (including parsing them + into local db). + -nk, --no-pokestops Disables PokeStops from the map (including parsing + them into local db). + -ss [SPAWNPOINT_SCANNING], --spawnpoint-scanning [SPAWNPOINT_SCANNING] + Use spawnpoint scanning (instead of hex grid). Scans + in a circle based on step_limit when on DB. + --dump-spawnpoints dump the spawnpoints from the db to json (only for use + with -ss). + -pd PURGE_DATA, --purge-data PURGE_DATA + Clear pokemon from database this many hours after they + disappear (0 to disable). + -px PROXY, --proxy PROXY + Proxy url (e.g. socks5://127.0.0.1:9050). + -pxt PROXY_TIMEOUT, --proxy-timeout PROXY_TIMEOUT + Timeout settings for proxy checker in seconds. + -pxd PROXY_DISPLAY, --proxy-display PROXY_DISPLAY + Display info on which proxy beeing used (index or + full) To be used with -ps. + --db-type DB_TYPE Type of database to be used (default: sqlite). + --db-name DB_NAME Name of the database to be used. + --db-user DB_USER Username for the database. + --db-pass DB_PASS Password for the database. + --db-host DB_HOST IP or hostname for the database. + --db-port DB_PORT Port for the database. + --db-max_connections DB_MAX_CONNECTIONS + Max connections (per thread) for the database. + --db-threads DB_THREADS + Number of db threads; increase if the db queue falls + behind. + -wh [WEBHOOKS [WEBHOOKS ...]], --webhook [WEBHOOKS [WEBHOOKS ...]] + Define URL(s) to POST webhook information to. + -gi, --gym-info Get all details about gyms (causes an additional API + hit for every gym). + --webhook-updates-only + Only send updates (pok├®mon & lured pok├®stops). + --wh-threads WH_THREADS + Number of webhook threads; increase if the webhook + queue falls behind. + --ssl-certificate SSL_CERTIFICATE + Path to SSL certificate file. + --ssl-privatekey SSL_PRIVATEKEY + Path to SSL private key file. + -ps, --print-status Show a status screen instead of log messages. Can + switch between status and logs by pressing enter. + -sn STATUS_NAME, --status-name STATUS_NAME + Enable status page database update using STATUS_NAME + as main worker name. + -spp STATUS_PAGE_PASSWORD, --status-page-password STATUS_PAGE_PASSWORD + Set the status page password. + -el ENCRYPT_LIB, --encrypt-lib ENCRYPT_LIB + Path to encrypt lib to be used instead of the shipped + ones. + -v [filename.log], --verbose [filename.log] + Show debug messages from PomemonGo-Map and pgoapi. + Optionally specify file to log to. + -vv [filename.log], --very-verbose [filename.log] + Like verbose, but show debug messages from all modules + as well. Optionally specify file to log to. + -d, --debug Depreciated, use -v or -vv instead. From b915646ea35f7aff59270c5c37039b46703e196b Mon Sep 17 00:00:00 2001 From: primaxius Date: Sat, 17 Sep 2016 23:40:33 -0600 Subject: [PATCH 05/33] fixes (#1327) There! More example.py --- docs/extras/commandline.md | 319 +++++++++++++++++++------------------ 1 file changed, 160 insertions(+), 159 deletions(-) diff --git a/docs/extras/commandline.md b/docs/extras/commandline.md index c364e350e1..8dbb5474d3 100644 --- a/docs/extras/commandline.md +++ b/docs/extras/commandline.md @@ -1,159 +1,160 @@ -usage: runserver.py - [-h] [-a AUTH_SERVICE] [-u USERNAME] [-p PASSWORD] - [-w WORKERS] [-asi ACCOUNT_SEARCH_INTERVAL] - [-ari ACCOUNT_REST_INTERVAL] [-ac ACCOUNTCSV] - [-l LOCATION] [-j] [-st STEP_LIMIT] [-sd SCAN_DELAY] - [-ld LOGIN_DELAY] [-lr LOGIN_RETRIES] [-mf MAX_FAILURES] - [-msl MIN_SECONDS_LEFT] [-dc] [-H HOST] [-P PORT] - [-L LOCALE] [-c] [-m MOCK] [-ns] [-os] [-nsc] [-fl] -k - GMAPS_KEY [--spawnpoints-only] [-C] [-D DB] [-cd] [-np] - [-ng] [-nk] [-ss [SPAWNPOINT_SCANNING]] - [--dump-spawnpoints] [-pd PURGE_DATA] [-px PROXY] - [-pxt PROXY_TIMEOUT] [-pxd PROXY_DISPLAY] - [--db-type DB_TYPE] [--db-name DB_NAME] - [--db-user DB_USER] [--db-pass DB_PASS] - [--db-host DB_HOST] [--db-port DB_PORT] - [--db-max_connections DB_MAX_CONNECTIONS] - [--db-threads DB_THREADS] [-wh [WEBHOOKS [WEBHOOKS ...]]] - [-gi] [--webhook-updates-only] [--wh-threads WH_THREADS] - [--ssl-certificate SSL_CERTIFICATE] - [--ssl-privatekey SSL_PRIVATEKEY] [-ps] [-sn STATUS_NAME] - [-spp STATUS_PAGE_PASSWORD] [-el ENCRYPT_LIB] - [-v [filename.log] | -vv [filename.log] | -d] - -Args that start with '--' (eg. -a) can also be set in a config file -(C:\Users\User\Desktop\Pogom\PokemonGo-map\pogom\../config/config.ini or ). -The recognized syntax for setting (key, value) pairs is based on the INI and -YAML formats (e.g. key=value or foo=TRUE). For full documentation of the -differences from the standards please refer to the ConfigArgParse -documentation. If an arg is specified in more than one place, then commandline -values override environment variables which override config file values which -override defaults. - -optional arguments: - -h, --help Show this help message and exit. - -a AUTH_SERVICE, --auth-service AUTH_SERVICE - Auth Services, either one for all accounts or one per - account: ptc or google. Defaults all to ptc. - -u USERNAME, --username USERNAME - Usernames, one per account. - -p PASSWORD, --password PASSWORD - Passwords, either single one for all accounts or one - per account. - -w WORKERS, --workers WORKERS - Number of search worker threads to start. Defaults to - the number of accounts specified. - -asi ACCOUNT_SEARCH_INTERVAL, --account-search-interval ACCOUNT_SEARCH_INTERVAL - Seconds for accounts to search before switching to a - new account. 0 to disable. - -ari ACCOUNT_REST_INTERVAL, --account-rest-interval ACCOUNT_REST_INTERVAL - Seconds for accounts to rest when they fail or are - switched out. - -ac ACCOUNTCSV, --accountcsv ACCOUNTCSV - Load accounts from CSV file containing - "auth_service,username,passwd" lines. - -l LOCATION, --location LOCATION - Location, can be an address or coordinates. - -j, --jitter Apply random -9m to +9m jitter to location. - -st STEP_LIMIT, --step-limit STEP_LIMIT - Steps. - -sd SCAN_DELAY, --scan-delay SCAN_DELAY - Time delay between requests in scan threads. - -ld LOGIN_DELAY, --login-delay LOGIN_DELAY - Time delay between each login attempt. - -lr LOGIN_RETRIES, --login-retries LOGIN_RETRIES - Number of logins attempts before refreshing a thread. - -mf MAX_FAILURES, --max-failures MAX_FAILURES - Maximum number of failures to parse locations before - an account will go into a two hour sleep. - -msl MIN_SECONDS_LEFT, --min-seconds-left MIN_SECONDS_LEFT - Time that must be left on a spawn before considering - it too late and skipping it. eg. 600 would skip - anything with < 10 minutes remaining. Default 0. - -dc, --display-in-console - Display Found Pokemon in Console. - -H HOST, --host HOST Set web server listening host. - -P PORT, --port PORT Set web server listening port. - -L LOCALE, --locale LOCALE - Locale for Pokemon names (default: en, check - static/dist/locales for more). - -c, --china Coordinates transformer for China. - -m MOCK, --mock MOCK Mock mode - point to a fpgo endpoint instead of using - the real PogoApi, ec: http://127.0.0.1:9090. - -ns, --no-server No-Server Mode. Starts the searcher but not the - Webserver. - -os, --only-server Server-Only Mode. Starts only the Webserver without - the searcher. - -nsc, --no-search-control - Disables search control. - -fl, --fixed-location - Hides the search bar for use in shared maps. - -k GMAPS_KEY, --gmaps-key GMAPS_KEY - Google Maps Javascript API Key. - --spawnpoints-only Only scan locations with spawnpoints in them. - -C, --cors Enable CORS on web server. - -D DB, --db DB Database filename. - -cd, --clear-db Deletes the existing database before starting the - Webserver. - -np, --no-pokemon Disables Pokemon from the map (including parsing them - into local db). - -ng, --no-gyms Disables Gyms from the map (including parsing them - into local db). - -nk, --no-pokestops Disables PokeStops from the map (including parsing - them into local db). - -ss [SPAWNPOINT_SCANNING], --spawnpoint-scanning [SPAWNPOINT_SCANNING] - Use spawnpoint scanning (instead of hex grid). Scans - in a circle based on step_limit when on DB. - --dump-spawnpoints dump the spawnpoints from the db to json (only for use - with -ss). - -pd PURGE_DATA, --purge-data PURGE_DATA - Clear pokemon from database this many hours after they - disappear (0 to disable). - -px PROXY, --proxy PROXY - Proxy url (e.g. socks5://127.0.0.1:9050). - -pxt PROXY_TIMEOUT, --proxy-timeout PROXY_TIMEOUT - Timeout settings for proxy checker in seconds. - -pxd PROXY_DISPLAY, --proxy-display PROXY_DISPLAY - Display info on which proxy beeing used (index or - full) To be used with -ps. - --db-type DB_TYPE Type of database to be used (default: sqlite). - --db-name DB_NAME Name of the database to be used. - --db-user DB_USER Username for the database. - --db-pass DB_PASS Password for the database. - --db-host DB_HOST IP or hostname for the database. - --db-port DB_PORT Port for the database. - --db-max_connections DB_MAX_CONNECTIONS - Max connections (per thread) for the database. - --db-threads DB_THREADS - Number of db threads; increase if the db queue falls - behind. - -wh [WEBHOOKS [WEBHOOKS ...]], --webhook [WEBHOOKS [WEBHOOKS ...]] - Define URL(s) to POST webhook information to. - -gi, --gym-info Get all details about gyms (causes an additional API - hit for every gym). - --webhook-updates-only - Only send updates (pok├®mon & lured pok├®stops). - --wh-threads WH_THREADS - Number of webhook threads; increase if the webhook - queue falls behind. - --ssl-certificate SSL_CERTIFICATE - Path to SSL certificate file. - --ssl-privatekey SSL_PRIVATEKEY - Path to SSL private key file. - -ps, --print-status Show a status screen instead of log messages. Can - switch between status and logs by pressing enter. - -sn STATUS_NAME, --status-name STATUS_NAME - Enable status page database update using STATUS_NAME - as main worker name. - -spp STATUS_PAGE_PASSWORD, --status-page-password STATUS_PAGE_PASSWORD - Set the status page password. - -el ENCRYPT_LIB, --encrypt-lib ENCRYPT_LIB - Path to encrypt lib to be used instead of the shipped - ones. - -v [filename.log], --verbose [filename.log] - Show debug messages from PomemonGo-Map and pgoapi. - Optionally specify file to log to. - -vv [filename.log], --very-verbose [filename.log] - Like verbose, but show debug messages from all modules - as well. Optionally specify file to log to. - -d, --debug Depreciated, use -v or -vv instead. + usage: runserver.py + [-h] [-a AUTH_SERVICE] [-u USERNAME] [-p PASSWORD] + [-w WORKERS] [-asi ACCOUNT_SEARCH_INTERVAL] + [-ari ACCOUNT_REST_INTERVAL] [-ac ACCOUNTCSV] + [-l LOCATION] [-j] [-st STEP_LIMIT] [-sd SCAN_DELAY] + [-ld LOGIN_DELAY] [-lr LOGIN_RETRIES] [-mf MAX_FAILURES] + [-msl MIN_SECONDS_LEFT] [-dc] [-H HOST] [-P PORT] + [-L LOCALE] [-c] [-m MOCK] [-ns] [-os] [-nsc] [-fl] -k + GMAPS_KEY [--spawnpoints-only] [-C] [-D DB] [-cd] [-np] + [-ng] [-nk] [-ss [SPAWNPOINT_SCANNING]] + [--dump-spawnpoints] [-pd PURGE_DATA] [-px PROXY] + [-pxt PROXY_TIMEOUT] [-pxd PROXY_DISPLAY] + [--db-type DB_TYPE] [--db-name DB_NAME] + [--db-user DB_USER] [--db-pass DB_PASS] + [--db-host DB_HOST] [--db-port DB_PORT] + [--db-max_connections DB_MAX_CONNECTIONS] + [--db-threads DB_THREADS] [-wh [WEBHOOKS [WEBHOOKS ...]]] + [-gi] [--webhook-updates-only] [--wh-threads WH_THREADS] + [--ssl-certificate SSL_CERTIFICATE] + [--ssl-privatekey SSL_PRIVATEKEY] [-ps] [-sn STATUS_NAME] + [-spp STATUS_PAGE_PASSWORD] [-el ENCRYPT_LIB] + [-v [filename.log] | -vv [filename.log] | -d] + + Args that start with '--' (eg. -a) can also be set in a config file + (C:\Users\User\Desktop\Pogom\PokemonGo-map\pogom\../config/config.ini or ). + The recognized syntax for setting (key, value) pairs is based on the INI and + YAML formats (e.g. key=value or foo=TRUE). For full documentation of the + differences from the standards please refer to the ConfigArgParse + documentation. If an arg is specified in more than one place, then commandline + values override environment variables which override config file values which + override defaults. + + optional arguments: + -h, --help Show this help message and exit. + -a AUTH_SERVICE, --auth-service AUTH_SERVICE + Auth Services, either one for all accounts or one per + account: ptc or google. Defaults all to ptc. + -u USERNAME, --username USERNAME + Usernames, one per account. + -p PASSWORD, --password PASSWORD + Passwords, either single one for all accounts or one + per account. + -w WORKERS, --workers WORKERS + Number of search worker threads to start. Defaults to + the number of accounts specified. + -asi ACCOUNT_SEARCH_INTERVAL, --account-search-interval ACCOUNT_SEARCH_INTERVAL + Seconds for accounts to search before switching to a + new account. 0 to disable. + -ari ACCOUNT_REST_INTERVAL, --account-rest-interval ACCOUNT_REST_INTERVAL + Seconds for accounts to rest when they fail or are + switched out. + -ac ACCOUNTCSV, --accountcsv ACCOUNTCSV + Load accounts from CSV file containing + "auth_service,username,passwd" lines. + -l LOCATION, --location LOCATION + Location, can be an address or coordinates. + -j, --jitter Apply random -9m to +9m jitter to location. + -st STEP_LIMIT, --step-limit STEP_LIMIT + Steps. + -sd SCAN_DELAY, --scan-delay SCAN_DELAY + Time delay between requests in scan threads. + -ld LOGIN_DELAY, --login-delay LOGIN_DELAY + Time delay between each login attempt. + -lr LOGIN_RETRIES, --login-retries LOGIN_RETRIES + Number of logins attempts before refreshing a thread. + -mf MAX_FAILURES, --max-failures MAX_FAILURES + Maximum number of failures to parse locations before + an account will go into a two hour sleep. + -msl MIN_SECONDS_LEFT, --min-seconds-left MIN_SECONDS_LEFT + Time that must be left on a spawn before considering + it too late and skipping it. eg. 600 would skip + anything with < 10 minutes remaining. Default 0. + -dc, --display-in-console + Display Found Pokemon in Console. + -H HOST, --host HOST Set web server listening host. + -P PORT, --port PORT Set web server listening port. + -L LOCALE, --locale LOCALE + Locale for Pokemon names (default: en, check + static/dist/locales for more). + -c, --china Coordinates transformer for China. + -m MOCK, --mock MOCK Mock mode - point to a fpgo endpoint instead of using + the real PogoApi, ec: http://127.0.0.1:9090. + -ns, --no-server No-Server Mode. Starts the searcher but not the + Webserver. + -os, --only-server Server-Only Mode. Starts only the Webserver without + the searcher. + -nsc, --no-search-control + Disables search control. + -fl, --fixed-location + Hides the search bar for use in shared maps. + -k GMAPS_KEY, --gmaps-key GMAPS_KEY + Google Maps Javascript API Key. + --spawnpoints-only Only scan locations with spawnpoints in them. + -C, --cors Enable CORS on web server. + -D DB, --db DB Database filename. + -cd, --clear-db Deletes the existing database before starting the + Webserver. + -np, --no-pokemon Disables Pokemon from the map (including parsing them + into local db). + -ng, --no-gyms Disables Gyms from the map (including parsing them + into local db). + -nk, --no-pokestops Disables PokeStops from the map (including parsing + them into local db). + -ss [SPAWNPOINT_SCANNING], --spawnpoint-scanning [SPAWNPOINT_SCANNING] + Use spawnpoint scanning (instead of hex grid). Scans + in a circle based on step_limit when on DB. + --dump-spawnpoints dump the spawnpoints from the db to json (only for use + with -ss). + -pd PURGE_DATA, --purge-data PURGE_DATA + Clear pokemon from database this many hours after they + disappear (0 to disable). + -px PROXY, --proxy PROXY + Proxy url (e.g. socks5://127.0.0.1:9050). + -pxt PROXY_TIMEOUT, --proxy-timeout PROXY_TIMEOUT + Timeout settings for proxy checker in seconds. + -pxd PROXY_DISPLAY, --proxy-display PROXY_DISPLAY + Display info on which proxy beeing used (index or + full) To be used with -ps. + --db-type DB_TYPE Type of database to be used (default: sqlite). + --db-name DB_NAME Name of the database to be used. + --db-user DB_USER Username for the database. + --db-pass DB_PASS Password for the database. + --db-host DB_HOST IP or hostname for the database. + --db-port DB_PORT Port for the database. + --db-max_connections DB_MAX_CONNECTIONS + Max connections (per thread) for the database. + --db-threads DB_THREADS + Number of db threads; increase if the db queue falls + behind. + -wh [WEBHOOKS [WEBHOOKS ...]], --webhook [WEBHOOKS [WEBHOOKS ...]] + Define URL(s) to POST webhook information to. + -gi, --gym-info Get all details about gyms (causes an additional API + hit for every gym). + --webhook-updates-only + Only send updates (pok├®mon & lured pok├®stops). + --wh-threads WH_THREADS + Number of webhook threads; increase if the webhook + queue falls behind. + --ssl-certificate SSL_CERTIFICATE + Path to SSL certificate file. + --ssl-privatekey SSL_PRIVATEKEY + Path to SSL private key file. + -ps, --print-status Show a status screen instead of log messages. Can + switch between status and logs by pressing enter. + -sn STATUS_NAME, --status-name STATUS_NAME + Enable status page database update using STATUS_NAME + as main worker name. + -spp STATUS_PAGE_PASSWORD, --status-page-password STATUS_PAGE_PASSWORD + Set the status page password. + -el ENCRYPT_LIB, --encrypt-lib ENCRYPT_LIB + Path to encrypt lib to be used instead of the shipped + ones. + -v [filename.log], --verbose [filename.log] + Show debug messages from PomemonGo-Map and pgoapi. + Optionally specify file to log to. + -vv [filename.log], --very-verbose [filename.log] + Like verbose, but show debug messages from all modules + as well. Optionally specify file to log to. + -d, --debug Depreciated, use -v or -vv instead. + From c9188e3db2b820792adc8b7a26f1ecba8e360f6e Mon Sep 17 00:00:00 2001 From: primaxius Date: Mon, 19 Sep 2016 14:06:28 -0600 Subject: [PATCH 06/33] Added Title to command line page and misc fix (#1335) --- docs/extras/commandline.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/extras/commandline.md b/docs/extras/commandline.md index 8dbb5474d3..2b5d404c98 100644 --- a/docs/extras/commandline.md +++ b/docs/extras/commandline.md @@ -1,3 +1,5 @@ +# Command Line + usage: runserver.py [-h] [-a AUTH_SERVICE] [-u USERNAME] [-p PASSWORD] [-w WORKERS] [-asi ACCOUNT_SEARCH_INTERVAL] @@ -132,7 +134,7 @@ -gi, --gym-info Get all details about gyms (causes an additional API hit for every gym). --webhook-updates-only - Only send updates (pok├®mon & lured pok├®stops). + Only send updates (pokemon & lured pokestops). --wh-threads WH_THREADS Number of webhook threads; increase if the webhook queue falls behind. From 95899220f36a45f1f8a1fbddfc7fc0cfe107602d Mon Sep 17 00:00:00 2001 From: Johnny Disco Date: Tue, 20 Sep 2016 22:43:41 -0400 Subject: [PATCH 07/33] webworker (#1287) --- .eslintrc.json | 1 + static/js/map.common.js | 5 +++ static/js/map.js | 89 ++++++++++++++++++++++++++++------------- 3 files changed, 68 insertions(+), 27 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 08069c84bb..379afb5988 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,6 +23,7 @@ "setupPokemonMarker": true, "isTouchDevice": true, + "isMobileDevice": true, "pokemonSprites": true, "noLabelsStyle": true, "darkStyle": true, diff --git a/static/js/map.common.js b/static/js/map.common.js index 932cac3067..fbf08ae7b3 100644 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -850,3 +850,8 @@ function isTouchDevice () { // Should cover most browsers return 'ontouchstart' in window || navigator.maxTouchPoints } + +function isMobileDevice () { + // Basic mobile OS (not browser) detection + return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) +} diff --git a/static/js/map.js b/static/js/map.js index 5b76c50377..090bf39dde 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -32,9 +32,10 @@ var searchMarker var storeZoom = true var scanPath - var selectedStyle = 'light' +var updateWorker +var lastUpdateTime var gymTypes = ['Uncontested', 'Mystic', 'Valor', 'Instinct'] var audio = new Audio('static/sounds/ding.mp3') @@ -1017,6 +1018,7 @@ function updateMap () { if ($('#stats').hasClass('visible')) { countMarkers() } + lastUpdateTime = Date.now() }) } @@ -1220,6 +1222,62 @@ function i8ln (word) { } } +function updateGeoLocation () { + if (navigator.geolocation && (Store.get('geoLocate') || Store.get('followMyLocation'))) { + navigator.geolocation.getCurrentPosition(function (position) { + var lat = position.coords.latitude + var lng = position.coords.longitude + var center = new google.maps.LatLng(lat, lng) + + if (Store.get('geoLocate')) { + // the search function makes any small movements cause a loop. Need to increase resolution + if ((typeof searchMarker !== 'undefined') && (getPointDistance(searchMarker.getPosition(), center) > 40)) { + $.post('next_loc?lat=' + lat + '&lon=' + lng).done(function () { + map.panTo(center) + searchMarker.setPosition(center) + }) + } + } + if (Store.get('followMyLocation')) { + if ((typeof locationMarker !== 'undefined') && (getPointDistance(locationMarker.getPosition(), center) >= 5)) { + map.panTo(center) + locationMarker.setPosition(center) + Store.set('followMyLocationPosition', { lat: lat, lng: lng }) + } + } + }) + } +} + +function createUpdateWorker () { + try { + if (isMobileDevice() && (window.Worker)) { + var updateBlob = new Blob([`onmessage = function(e) { + var data = e.data + if (data.name === 'backgroundUpdate') { + self.setInterval(function () {self.postMessage({name: 'backgroundUpdate'})}, 5000) + } + }`]) + + var updateBlobURL = window.URL.createObjectURL(updateBlob) + + updateWorker = new Worker(updateBlobURL) + + updateWorker.onmessage = function (e) { + var data = e.data + if (document.hidden && data.name === 'backgroundUpdate' && Date.now() - lastUpdateTime > 2500) { + updateMap() + updateGeoLocation() + } + } + + updateWorker.postMessage({name: 'backgroundUpdate'}) + } + } catch (ex) { + console.log('Webworker error: ' + ex.message) + } +} + // // Page Ready Exection // @@ -1441,32 +1499,9 @@ $(function () { // run interval timers to regularly update map and timediffs window.setInterval(updateLabelDiffTime, 1000) window.setInterval(updateMap, 5000) - window.setInterval(function () { - if (navigator.geolocation && (Store.get('geoLocate') || Store.get('followMyLocation'))) { - navigator.geolocation.getCurrentPosition(function (position) { - var lat = position.coords.latitude - var lng = position.coords.longitude - var center = new google.maps.LatLng(lat, lng) - - if (Store.get('geoLocate')) { - // the search function makes any small movements cause a loop. Need to increase resolution - if ((typeof searchMarker !== 'undefined') && (getPointDistance(searchMarker.getPosition(), center) > 40)) { - $.post('next_loc?lat=' + lat + '&lon=' + lng).done(function () { - map.panTo(center) - searchMarker.setPosition(center) - }) - } - } - if (Store.get('followMyLocation')) { - if ((typeof locationMarker !== 'undefined') && (getPointDistance(locationMarker.getPosition(), center) >= 5)) { - map.panTo(center) - locationMarker.setPosition(center) - Store.set('followMyLocationPosition', { lat: lat, lng: lng }) - } - } - }) - } - }, 1000) + window.setInterval(updateGeoLocation, 1000) + + createUpdateWorker() // Wipe off/restore map icons when switches are toggled function buildSwitchChangeListener (data, dataType, storageKey) { From 92e3e6c61364ab1e82de811f272b42362693a744 Mon Sep 17 00:00:00 2001 From: Jools Date: Wed, 21 Sep 2016 05:47:54 +0300 Subject: [PATCH 08/33] Output better error when csv file has > 3 fields (#1336) --- pogom/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pogom/utils.py b/pogom/utils.py index 3a8caccffa..b4cd3af996 100755 --- a/pogom/utils.py +++ b/pogom/utils.py @@ -262,6 +262,10 @@ def get_args(): else: field_error = 'password' + if num_fields > 3: + print 'Too many fields in accounts file: max supported are 3 fields. Found {} fields'.format(num_fields) + sys.exit(1) + # If something is wrong display error. if field_error != '': type_error = 'empty!' From 705432e560852bad4446c17172cfea6bf45e7867 Mon Sep 17 00:00:00 2001 From: FrostTheFox Date: Tue, 20 Sep 2016 22:49:07 -0400 Subject: [PATCH 09/33] Correct multi-acc doc --- docs/extras/multi-account.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/extras/multi-account.md b/docs/extras/multi-account.md index c1b05d9521..a2b7fe291d 100644 --- a/docs/extras/multi-account.md +++ b/docs/extras/multi-account.md @@ -49,12 +49,12 @@ password: [password01, password02, password03] ## Using CSV file: -To use multiple accounts from a CSV file, you create a CSV file with the auth method, username and password on each line. Additional fields after the password are ignored. +To use multiple accounts from a CSV file, you create a CSV file with the auth method, username and password on each line. Shorten to 3 fields only, more than 3 fields will error out. CSV File Example: ``` ptc,thunderfox01,password01 -ptc,thunderfox02,password02,other,information +google,thunderfox02@gmail.com,password02 ``` Example: `python runserver.py -ac accounts.csv` From da262efd522521e73600cf6b06e30bf22e4869c0 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 21 Sep 2016 15:32:51 -0400 Subject: [PATCH 10/33] Prevent header from cutting off bottom (#1343) Same issue/fix as #873, this time affecting the stats side bar instead of the menu bar --- static/sass/layout/_stats.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/sass/layout/_stats.scss b/static/sass/layout/_stats.scss index 795da6881a..475f7191de 100644 --- a/static/sass/layout/_stats.scss +++ b/static/sass/layout/_stats.scss @@ -7,7 +7,9 @@ background: #F8F8F8; box-shadow: none; color: _palette(accent2, fg-bold); - height: 100%; + height: -webkit-calc(100% - 3.5em); + height: -moz-calc(100% - 3.5em); + height: calc(100% - 3.5em); max-width: 80%; overflow-y: auto; padding: 1.5em 1.5em 4em 1.5em; From 647209ea56111ecc01bfa533a01b5b45ac196ec2 Mon Sep 17 00:00:00 2001 From: Fabian Sperrle Date: Wed, 21 Sep 2016 21:33:35 +0200 Subject: [PATCH 11/33] Close info window upon second click (#1238) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the info window for Pokémon, Gyms, etc. can only be closed with the little x. This adds a stateful click handler that closes the info window with a second click. Implements #1237 --- static/js/map.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/static/js/map.js b/static/js/map.js index 090bf39dde..361ffcc280 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -739,10 +739,17 @@ function clearSelection () { function addListeners (marker) { marker.addListener('click', function () { - marker.infoWindow.open(map, marker) - clearSelection() - updateLabelDiffTime() - marker.persist = true + if (!marker.infoWindowIsOpen) { + marker.infoWindow.open(map, marker) + clearSelection() + updateLabelDiffTime() + marker.persist = true + marker.infoWindowIsOpen = true + } else { + marker.persist = null + marker.infoWindow.close() + marker.infoWindowIsOpen = false + } }) google.maps.event.addListener(marker.infoWindow, 'closeclick', function () { From a3cd518a64599db92b3697e35a4e0d4ee13a6a6d Mon Sep 17 00:00:00 2001 From: Shawn Tunney Date: Wed, 21 Sep 2016 15:34:52 -0400 Subject: [PATCH 12/33] Decrease Number of Upserted Rows (#1091) * Decrease step size * Check the type of DB --- pogom/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pogom/models.py b/pogom/models.py index 7e123d6466..252ba622c8 100755 --- a/pogom/models.py +++ b/pogom/models.py @@ -908,7 +908,13 @@ def clean_db_loop(args): def bulk_upsert(cls, data): num_rows = len(data.values()) i = 0 - step = 120 + + if args.db_type == 'mysql': + step = 120 + else: + # SQLite has a default max number of parameters of 999, + # so we need to limit how many rows we insert for it. + step = 50 while i < num_rows: log.debug('Inserting items %d to %d', i, min(i + step, num_rows)) From ef11873a4eeb9bdf078f6aaf1867b09193a0e216 Mon Sep 17 00:00:00 2001 From: Acidvenom73 Date: Wed, 21 Sep 2016 21:47:20 +0200 Subject: [PATCH 13/33] setup.bat now won't set paths if already set, now also installs npm (#770) * Various fixes Updated to install npm and now includes more user output. Now also won't set paths if already set, which was a problem if you ran the setup more than once. * Update setup.bat * Updated to not use temp files As requested by Balthamel, it now no longer uses a temp file but rathers stores it in a variable. --- Tools/Easy-Setup/setup.bat | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Tools/Easy-Setup/setup.bat b/Tools/Easy-Setup/setup.bat index 7e0273663c..d297e69765 100644 --- a/Tools/Easy-Setup/setup.bat +++ b/Tools/Easy-Setup/setup.bat @@ -1,4 +1,5 @@ @echo off +echo Requesting Administrator Access... pushd %~dp0 :: Running prompt elevated :------------------------------------- @@ -22,23 +23,55 @@ if '%errorlevel%' NEQ '0' ( pushd "%CD%" CD /D "%~dp0" :-------------------------------------- +echo. +echo Setting PATHs... +echo. IF EXIST C:\Python27 ( set PATH2=C:\Python27 ) ELSE ( echo Python path not found, please specify or install. +echo. set /p PATH2= Specify Python path: ) + +for /f "tokens=*" %%i in ('echo "%PATH%" ^| find /c /i "%PATH2%"') do set output=%%i +if %output% equ 1 ( +goto found +) else ( +goto notfound +) + +:found +cls +echo Path is already set, skipping... +goto Continue + +:notfound +cls setx PATH "%PATH%;%PATH2%;%PATH2%\Scripts;" +echo. +echo Path set, continuing.. +goto Continue + + +:Continue popd +echo. +echo Installing requirements... +echo. + "%PATH2%\python" get-pip.py cd ..\.. "%PATH2%\Scripts\pip" install -r requirements.txt "%PATH2%\Scripts\pip" install -r requirements.txt --upgrade +call npm install +call npm run build + cd config set /p API= Enter your Google API key here: "%PATH2%\python" -c "print open('config.ini.example').read().replace('#gmaps-key:','gmaps-key:%API%')" > config.ini From b52ba3b7b699d33f51564998d3cb7c5e4db75353 Mon Sep 17 00:00:00 2001 From: karololszak Date: Wed, 21 Sep 2016 22:08:11 +0200 Subject: [PATCH 14/33] Update the "Easy setup" script (#1217) --- Tools/Easy-Setup/easy-setup.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tools/Easy-Setup/easy-setup.sh b/Tools/Easy-Setup/easy-setup.sh index d3ed5f8518..fc8b30aa6a 100755 --- a/Tools/Easy-Setup/easy-setup.sh +++ b/Tools/Easy-Setup/easy-setup.sh @@ -8,7 +8,11 @@ echo "" if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then echo "Installing python development tools..." - sudo apt-get install python python-dev + sudo apt-get install python python-dev build-essential -y + echo "Adding node repo..." + curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - + echo "Installing node..." + sudo apt-get install nodejs -y else echo "This script only supports debain based Linux distros." echo "Please install manually." @@ -18,7 +22,11 @@ fi echo "Installing pip..." sudo python get-pip.py echo "Installing required python packages..." -pip install -r $scriptDir/../../requirements.txt +sudo pip install -r $scriptDir/../../requirements.txt --upgrade +echo "Installing frontend dependencies..." +npm --prefix $scriptDir/../../ install $scriptDir/../../ +echo "Building frontend..." +npm run build echo "Configuring Google Maps API..." cp $scriptDir/../../config/config.ini.example $scriptDir/../../config/config.ini From 0813b62710eb9a292421075b508375aab18a6a3c Mon Sep 17 00:00:00 2001 From: KyleBoyer Date: Wed, 21 Sep 2016 18:17:56 -0500 Subject: [PATCH 15/33] Fully Implement On Demand Mode(Conflicts resolved) (#1271) * On demand mode * On demand mode * On demand mode * On demand mode * Pause before checking time in service --- pogom/app.py | 16 +++++++++++++--- pogom/search.py | 14 +++++++++----- pogom/utils.py | 1 + runserver.py | 9 +++++++-- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/pogom/app.py b/pogom/app.py index 6ac0f3e9a9..f9bdd69023 100755 --- a/pogom/app.py +++ b/pogom/app.py @@ -15,7 +15,7 @@ from . import config from .models import Pokemon, Gym, Pokestop, ScannedLocation, MainWorker, WorkerStatus - +from .utils import now log = logging.getLogger(__name__) compress = Compress() @@ -39,6 +39,9 @@ def __init__(self, import_name, **kwargs): def set_search_control(self, control): self.search_control = control + def set_heartbeat_control(self, heartb): + self.heartbeat = heartb + def set_location_queue(self, queue): self.location_queue = queue @@ -50,7 +53,7 @@ def get_search_control(self): def post_search_control(self): args = get_args() - if not args.search_control: + if not args.search_control or args.on_demand_timeout > 0: return 'Search control is disabled', 403 action = request.args.get('action', 'none') if action == 'on': @@ -64,9 +67,12 @@ def post_search_control(self): return self.get_search_control() def fullmap(self): + self.heartbeat[0] = now() args = get_args() + if args.on_demand_timeout > 0: + self.search_control.clear() fixed_display = "none" if args.fixed_location else "inline" - search_display = "inline" if args.search_control else "none" + search_display = "inline" if args.search_control and args.on_demand_timeout <= 0 else "none" return render_template('map.html', lat=self.current_location[0], @@ -78,6 +84,10 @@ def fullmap(self): ) def raw_data(self): + self.heartbeat[0] = now() + args = get_args() + if args.on_demand_timeout > 0: + self.search_control.clear() d = {} swLat = request.args.get('swLat') swLng = request.args.get('swLng') diff --git a/pogom/search.py b/pogom/search.py index a05e8a347c..d5ef55d8c7 100644 --- a/pogom/search.py +++ b/pogom/search.py @@ -251,7 +251,7 @@ def worker_status_db_thread(threads_status, name, db_updates_queue): # The main search loop that keeps an eye on the over all process -def search_overseer_thread(args, new_location_queue, pause_bit, encryption_lib_path, db_updates_queue, wh_queue): +def search_overseer_thread(args, new_location_queue, pause_bit, heartb, encryption_lib_path, db_updates_queue, wh_queue): log.info('Search overseer starting') @@ -345,6 +345,10 @@ def search_overseer_thread(args, new_location_queue, pause_bit, encryption_lib_p # The real work starts here but will halt on pause_bit.set() while True: + if args.on_demand_timeout > 0 and (now() - args.on_demand_timeout) > heartb[0]: + pause_bit.set() + log.info("Searching paused due to inactivity...") + # Wait here while scanning is paused while pause_bit.is_set(): scheduler.scanning_paused() @@ -433,6 +437,10 @@ def search_worker_thread(args, account_queue, account_failures, search_items_que account_failures.append({'account': account, 'last_fail_time': now(), 'reason': 'failures'}) break # exit this loop to get a new account and have the API recreated + while pause_bit.is_set(): + status['message'] = 'Scanning paused' + time.sleep(2) + # If this account has been running too long, let it rest if (args.account_search_interval is not None): if (status['starttime'] <= (now() - args.account_search_interval)): @@ -441,10 +449,6 @@ def search_worker_thread(args, account_queue, account_failures, search_items_que account_failures.append({'account': account, 'last_fail_time': now(), 'reason': 'rest interval'}) break - while pause_bit.is_set(): - status['message'] = 'Scanning paused' - time.sleep(2) - # Grab the next thing to search (when available) status['message'] = 'Waiting for item from queue' step, step_location, appears, leaves = search_items_queue.get() diff --git a/pogom/utils.py b/pogom/utils.py index b4cd3af996..bf2ecf8ac6 100755 --- a/pogom/utils.py +++ b/pogom/utils.py @@ -172,6 +172,7 @@ def get_args(): parser.add_argument('-spp', '--status-page-password', default=None, help='Set the status page password') parser.add_argument('-el', '--encrypt-lib', help='Path to encrypt lib to be used instead of the shipped ones') + parser.add_argument('-odt', '--on-demand_timeout', help='Pause searching while web UI is inactive for this timeout(in seconds)', type=int, default=0) verbosity = parser.add_mutually_exclusive_group() verbosity.add_argument('-v', '--verbose', help='Show debug messages from PomemonGo-Map and pgoapi. Optionally specify file to log to.', nargs='?', const='nofile', default=False, metavar='filename.log') verbosity.add_argument('-vv', '--very-verbose', help='Like verbose, but show debug messages from all modules as well. Optionally specify file to log to.', nargs='?', const='nofile', default=False, metavar='filename.log') diff --git a/runserver.py b/runserver.py index 8692f9c736..340b9ee88b 100755 --- a/runserver.py +++ b/runserver.py @@ -20,7 +20,7 @@ from pogom import config from pogom.app import Pogom -from pogom.utils import get_args, get_encryption_lib_path +from pogom.utils import get_args, get_encryption_lib_path, now from pogom.search import search_overseer_thread from pogom.models import init_database, create_tables, drop_tables, Pokemon, db_updater, clean_db_loop @@ -203,6 +203,10 @@ def main(): # Control the search status (running or not) across threads pause_bit = Event() pause_bit.clear() + if args.on_demand_timeout > 0: + pause_bit.set() + + heartbeat = [now()] # Setup the location tracking queue and push the first location on new_location_queue = Queue() @@ -252,7 +256,7 @@ def main(): file.write(json.dumps(spawns)) log.info('Finished exporting spawn points') - argset = (args, new_location_queue, pause_bit, encryption_lib_path, db_updates_queue, wh_updates_queue) + argset = (args, new_location_queue, pause_bit, heartbeat, encryption_lib_path, db_updates_queue, wh_updates_queue) log.debug('Starting a %s search thread', args.scheduler) search_thread = Thread(target=search_overseer_thread, name='search-overseer', args=argset) @@ -266,6 +270,7 @@ def main(): init_cache_busting(app) app.set_search_control(pause_bit) + app.set_heartbeat_control(heartbeat) app.set_location_queue(new_location_queue) config['ROOT_PATH'] = app.root_path From ceda5213f1eaf0e8b4c4458e2f8861df19473214 Mon Sep 17 00:00:00 2001 From: averylarry Date: Wed, 21 Sep 2016 18:31:45 -0500 Subject: [PATCH 16/33] Fix alphabetical order (#1110) --- static/js/statistics.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/statistics.js b/static/js/statistics.js index bf37bf9a29..c7c3a96c79 100644 --- a/static/js/statistics.js +++ b/static/js/statistics.js @@ -116,10 +116,10 @@ function processSeen (seen) { return a['pokemon_id'] - b['pokemon_id'] } else if (sort.options[sort.selectedIndex].value === 'name') { if (a['pokemon_name'].toLowerCase() < b['pokemon_name'].toLowerCase()) { - return 1 + return -1 } if (a['pokemon_name'].toLowerCase() > b['pokemon_name'].toLowerCase()) { - return -1 + return 1 } return 0 } else { From ac8a732ed30df85b80c26047f3747c27a4d4fe16 Mon Sep 17 00:00:00 2001 From: Johnny Disco Date: Wed, 21 Sep 2016 19:32:41 -0400 Subject: [PATCH 17/33] Suppress virtual keyboard - update - mobile OS detection (#1289) * [Fix] issue #622, statistics 2x Uncaught TypeError * Fix lint errors * Prevent OSK on Touch * Select Boxes prevent Virtual Keyboard Appearing on Touch Devices * remove unnecessary loop * basic mobile os detection --- static/js/map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/map.js b/static/js/map.js index 361ffcc280..29ef1de3df 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1498,7 +1498,7 @@ $(function () { $selectPokemonNotify.val(Store.get('remember_select_notify')).trigger('change') $selectRarityNotify.val(Store.get('remember_select_rarity_notify')).trigger('change') - if (isTouchDevice()) { + if (isTouchDevice() && isMobileDevice()) { $('.select2-search input').prop('readonly', true) } }) From 03207ffdc0424e13bc2d7f2a2ec666b1fc3a771d Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Wed, 21 Sep 2016 18:56:34 -0700 Subject: [PATCH 18/33] fixed order in which some things must be installed --- docs/basic-install/linux.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/basic-install/linux.rst b/docs/basic-install/linux.rst index 012f12346c..a6d75b288a 100644 --- a/docs/basic-install/linux.rst +++ b/docs/basic-install/linux.rst @@ -10,8 +10,10 @@ You can install the required packages on Ubuntu by running the following command .. code-block:: bash + sudo apt-get install -y python python-pip python-dev build-essential git curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - - sudo apt-get install -y python python-pip python-dev nodejs nodejs-legacy build-essential + sudo apt-get install -y nodejs + Debian 7/8 ********** From d8e8ce84be4999741a93a8e021c5b08379890c49 Mon Sep 17 00:00:00 2001 From: rbryson74 Date: Wed, 21 Sep 2016 22:17:11 -0600 Subject: [PATCH 19/33] Fix for some cases of 0,0,0 returns (#1097) Some users reporting 0,0,0 returns on subsequent auth token refreshes after the first. --- pogom/search.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pogom/search.py b/pogom/search.py index d5ef55d8c7..eac0d8e07e 100644 --- a/pogom/search.py +++ b/pogom/search.py @@ -481,15 +481,18 @@ def search_worker_thread(args, account_queue, account_failures, search_items_que # No sleep here; we've not done anything worth sleeping for. Plus we clearly need to catch up! continue - status['message'] = 'Searching at {:6f},{:6f}'.format(step_location[0], step_location[1]) - log.info(status['message']) - # Let the api know where we intend to be for this loop + # doing this before check_login so it does not also have to be done there + # when the auth token is refreshed api.set_position(*step_location) # Ok, let's get started -- check our login status check_login(args, account, api, step_location, status['proxy_url']) + # putting this message after the check_login so the messages aren't out of order + status['message'] = 'Searching at {:6f},{:6f}'.format(step_location[0], step_location[1]) + log.info(status['message']) + # Make the actual request (finally!) response_dict = map_request(api, step_location, args.jitter) @@ -595,7 +598,6 @@ def check_login(args, account, api, position, proxy_url): # Try to login (a few times, but don't get stuck here) i = 0 - api.set_position(position[0], position[1], position[2]) while i < args.login_retries: try: if proxy_url: @@ -612,7 +614,7 @@ def check_login(args, account, api, position, proxy_url): time.sleep(args.login_delay) log.debug('Login for account %s successful', account['username']) - time.sleep(args.scan_delay) + time.sleep(20) def map_request(api, position, jitter=False): From 6f442b39ffdb7840678d2a1da2eb3dba39203c4a Mon Sep 17 00:00:00 2001 From: Xcelled Date: Thu, 22 Sep 2016 00:46:42 -0400 Subject: [PATCH 20/33] Update pull request template (#399) * Update pull request template * Changed checklist into a comment * Stupid markdown comments --- .github/PULL_REQUEST_TEMPLATE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 903c6adb52..555dbe708c 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -23,6 +23,9 @@ ## Checklist: + + + - [ ] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. From 19b71c6ab4f4b36291a42294dd9c101386282220 Mon Sep 17 00:00:00 2001 From: cmachikas Date: Thu, 22 Sep 2016 00:48:38 -0400 Subject: [PATCH 21/33] Auth Update for nginx.md (#221) * Auth Update for nginx.md Adding large block for httpd nginx authentication with reverse proxy * Update nginx.md --- docs/extras/nginx.md | 91 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/docs/extras/nginx.md b/docs/extras/nginx.md index 6a5b48b818..e21c99e114 100644 --- a/docs/extras/nginx.md +++ b/docs/extras/nginx.md @@ -71,3 +71,94 @@ server { } } ``` + +## Adding simple httpd Authentication. + +This will guide you through setting up simple HTTP Authentication using nginx and reverse proxy protocols. These instructions are written for someone using a Debian/Ubuntu VPS. Your enviroment may have slightly different requirements, however the concepts as a whole should still stand. This guide assumes you have nginx installed and running, and a `conf.d/*.conf` file created, such as `/etc/nginx/conf.d/pokemongo-map.conf`, as the example above provides, and that you're running your service on port 5000, and want it to be accessable at http://your_ip/go/, although it supports other ports and locations. + +`*` denotes a wildcard, and will be used to stand for your site's `*.conf` file, please __do not__ literally type `sudo nano /etc/nginx/conf.d/*.conf`. + +1. Create a .htpasswd file inside `/etc/nginx/`. Some suggested methods to create a .htpasswd file are below. + - Linux users can use the apache2-tools package to create the files. + -First, get the apache2-utils package + ``` + sudo apt-get install apache2-utils + ``` + -Then run the htpasswd command + ``` + sudo htpasswd -c /etc/nginx/.htpasswd exampleuser + ``` + + This will prompt you for a new password for user exampleuser. Remove the `-c` tag for additional entries to the file. Opening the file with a text exitor such as nano should show one line for each user, with an encrypted password following, in the format of user:pass. + + - Manual generation of the file can be done using tools such as: http://www.htaccesstools.com/htpasswd-generator/. After manually generating the file, please place it in `/etc/nginx/`, or wherever your distro installs `nginx.conf` and the rest of your config files. +2. Open your `*.conf` file with a text editor, with a command such as `sudo nano /etc/nginx/conf.d/pokemongo-map.conf`. Add the following two lines underneath the domain path. + + ``` + auth_basic "Restricted"; + auth_basic_user_file /etc/nginx/.htpasswd; + ``` + + If your `*.conf` file matches the example provided above, you should have the following. + + ``` + server { + location /go/ { + auth_basic "Restricted"; + auth_basic_user_file /etc/nginx/.htpasswd; + proxy_pass http://127.0.0.1:5000/; + } + } + ``` + Now, we're going to go ahead and fill out the `*.conf` file with the rest of the information to make our service work, and shore up our nginx config, by appending the following between the authentication block and proxy_pass. + + ``` + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto http; + proxy_set_header Host $http_host; + proxy_redirect off; + ``` + + Here is a fully completed example `*.conf`, with working httpd authentication. Notice, this example does not use SSL / 443, although the method can be adapted to it! + + ``` + upstream pokemonmap{ + server 127.0.0.1:5000 fail_timeout=0 + } + server { + listen 80; + server_name [sub.domain.com] [your_ip]; + + location /go/ { + auth_basic "Restricted"; + auth_basic_user_file /etc/nginx/.htpasswd; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto http; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://[your_ip]:5000; + break; + } + } + ``` +3. Test your nginx configuration using the command `sudo nginx -t`. If this returns a positive result, restart the nginx service using `sudo service nginx restart`. +4. Verify your configuration is working by loading http://your_ip/go/ or http://sub.your.domain/go/, or however else you have it set in your `*.conf`. Please verify it's working before proceeding to step 5, or it will be much harder to troubleshoot! + + Troubleshooting: + - **I can't reach my server at http://your_ip/go/!** + + Check http://your_ip:5000/. If you cannot see it there, your issue lies with your server, not with nginx! If you can see it there, but cannot see it at http://your_ip/go/, your issue lies with nginx. Please check your config files to make sure they are pointing at the right places, and that your `sudo nginx -t` checks out. + + - **nginx -t doesn't check out.** + + Check the error messages for which line is creating the error, and work your way backwards from there. Many times it's just a missed `;` or `}`. + +5. Finally, we're going to modify our runserver.py command to operate with the `-H 127.0.0.1` flag, only allowing our webapp to be accessable from Localhost. As nginx is running on the local system, nginx will still be able to fetch the webapp, and serve it, through the proxy and authentication, to remote users, but remote users will not be able to connect directly to the webapp itself. If your runserver command is + + ```python runserver.py -u user -p pass -k key -l "my,coords" -st 10 -P 5000``` + + You are going to want to update it to the following: + + ```python runserver.py -u user -p pass -k key -l "my,coords" -st 10 -P 5000 -H 127.0.0.1``` + + From there, we're going to want to check and see that you can get to your server, albeit through authentication, at http://your_ip/go/, and that you cannot get to your server at http://your_ip/go:5000/. If that works, you're all set up! From 10fdf160d694b10cfe74f6a6c2b1c8c7b0326f20 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Fri, 23 Sep 2016 20:32:37 +0200 Subject: [PATCH 22/33] Removed references to third party docker container (#1359) * Removed references to third party container * Changed references to container we control --- docs/advanced-install/amazon-ecs.md | 46 +++++++++++++---------------- docs/advanced-install/docker.md | 27 ++++++++--------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/docs/advanced-install/amazon-ecs.md b/docs/advanced-install/amazon-ecs.md index 53ab6098f4..64b34c303b 100644 --- a/docs/advanced-install/amazon-ecs.md +++ b/docs/advanced-install/amazon-ecs.md @@ -2,7 +2,7 @@ > **Warning** -- Most cloud providers have been IP blocked from accessing the API -Amazon ECS is essentially managed docker allowed you to run multi-container environments easily with minimal configuration. In this guide we'll create an ECS Task that will run a single pokemongo-map container with a MariaDB container +Amazon ECS is essentially managed docker allowed you to run multi-container environments easily with minimal configuration. In this guide we'll create an ECS Task that will run a single pokemongo-map container with a MariaDB container for persisting the data ## Requirements @@ -14,12 +14,12 @@ Amazon ECS is essentially managed docker allowed you to run multi-container envi In the AWS ECS console create a Task Definition with the JSON below. You will need to set the following values: -* `POKEMON_USERNAME` - username for pokemongo -* `POKEMON_PASSWORD` - password for pokemongo -* `POKEMON_AUTH_SERVICE` - Define if you are using google or ptc auth -* `POKEMON_LOCATION` - Location to search -* `POKEMON_DB_USER` - Database user for MariaDB -* `POKEMON_DB_PASS` - Database password for MariaDB +* `POGOM_USERNAME` - username for pokemongo +* `POGOM_PASSWORD` - password for pokemongo +* `POGOM_AUTH_SERVICE` - Define if you are using google or ptc auth +* `POGOM_LOCATION` - Location to search +* `POGOM_DB_USER` - Database user for MariaDB +* `POGOM_DB_PASS` - Database password for MariaDB ```json { @@ -48,51 +48,47 @@ In the AWS ECS console create a Task Definition with the JSON below. You will ne "dockerSecurityOptions": null, "environment": [ { - "name": "POKEMON_DB_TYPE", + "name": "POGOM_DB_TYPE", "value": "mysql" }, { - "name": "POKEMON_LOCATION", + "name": "POGOM_LOCATION", "value": "Seattle, WA" }, { - "name": "POKEMON_DB_HOST", + "name": "POGOM_DB_HOST", "value": "database" }, { - "name": "POKEMON_NUM_THREADS", + "name": "POGOM_NUM_THREADS", "value": "1" }, { - "name": "POKEMON_DB_NAME", + "name": "POGOM_DB_NAME", "value": "pogom" }, { - "name": "POKEMON_PASSWORD", + "name": "POGOM_PASSWORD", "value": "MyPassword" }, { - "name": "POKEMON_GMAPS_KEY", + "name": "POGOM_GMAPS_KEY", "value": "SUPERSECRET" }, { - "name": "POKEMON_AUTH_SERVICE", + "name": "POGOM_AUTH_SERVICE", "value": "ptc" }, { - "name": "POKEMON_DB_PASS", + "name": "POGOM_DB_PASS", "value": "somedbpassword" }, { - "name": "POKEMON_DB_USER", + "name": "POGOM_DB_USER", "value": "pogom" }, { - "name": "POKEMON_STEP_LIMIT", - "value": "10" - }, - { - "name": "POKEMON_USERNAME", + "name": "POGOM_USERNAME", "value": "MyUser" } ], @@ -101,7 +97,7 @@ In the AWS ECS console create a Task Definition with the JSON below. You will ne ], "workingDirectory": null, "readonlyRootFilesystem": null, - "image": "ashex/pokemongo-map", + "image": "frostthefox/pokemongo-map", "command": null, "user": null, "dockerLabels": null, @@ -160,6 +156,6 @@ In the AWS ECS console create a Task Definition with the JSON below. You will ne ``` -If you would like to add workers you can easily do so by adding another container with the additional variable `POKEMON_NO_SERVER` set to `true`. You have to let one of the pokemongo-map containers start first to create the database, an easy way to control this is to create a link from the worker to the primary one as it will delay the start. +If you would like to add workers you can easily do so by adding another container with the additional variable `POGOM_NO_SERVER` set to `true`. You have to let one of the pokemongo-map containers start first to create the database, an easy way to control this is to create a link from the worker to the primary one as it will delay the start. -Once the Task is running you'll be able to access the app via the Instances IP on port 80. \ No newline at end of file +Once the Task is running you'll be able to access the app via the Instances IP on port 80. diff --git a/docs/advanced-install/docker.md b/docs/advanced-install/docker.md index 450a21e2e5..2b1c1f9706 100644 --- a/docs/advanced-install/docker.md +++ b/docs/advanced-install/docker.md @@ -22,14 +22,14 @@ If that doesn't bother you, and you just want to give PokemonGo-Map a go, keep o In order to start the map, you've got to run your docker container with a few arguments, such as authentication type, account, password, desired location and steps. If you don't know which arguments are necessary, you can use the following command to get help: ``` -docker run --rm pokemap/pokemongo-map -h +docker run --rm frostthefox/pokemongo-map -h ``` To be able to access the map in your machine via browser, you've got to bind a port on your host machine to the one wich will be exposed by the container (default is 5000). The following docker run command is an example of to launch a container with a very basic setup of the map, following the instructions above: ``` docker run -d --name pogomap -p 5000:5000 \ - pokemap/pokemongo-map \ + frostthefox/pokemongo-map \ -a ptc -u username -p password \ -k 'your-google-maps-key' \ -l 'lat, lon' \ @@ -94,24 +94,23 @@ Open that URL in your browser and you're ready to rock! In order to update your PokemonGo-Map docker image, you should stop/remove all the containers running with the current (outdated) version (refer to "Stopping the server"), pull the latest docker image version, and restart everything. To pull the latest image, use the following command: ``` -docker pull pokemap/pokemongo-map +docker pull frostthefox/pokemongo-map ``` If you are running a ngrok container, you've got to stop it as well. To start the server after updating your image, simply use the same commands that were used before, and the containers will be launched with the latest version. ## Running on docker cloud -If you want to run pokemongo-map on a service that doesn't support arguments like docker cloud or ECS, you'll need to use one of the more specialised images out there that supports variables. The image `ashex/pokemongo-map` handles variables, below is an example: +If you want to run pokemongo-map on a service that doesn't support arguments like docker cloud or ECS, you'll need to pass settings via variables below is an example: ```bash docker run -d -P \ - -e "AUTH_SERVICE=ptc" \ - -e "USERNAME=UserName" \ - -e "PASSWORD=Password" \ - -e "LOCATION=Seattle, WA" \ - -e "STEP_LIMIT=5" \ - -e "GMAPS_KEY=SUPERSECRET" \ - ashex/pokemongo-map + -e "POGOM_AUTH_SERVICE=ptc" \ + -e "POGOM_USERNAME=UserName" \ + -e "POGOM_PASSWORD=Password" \ + -e "POGOM_LOCATION=Seattle, WA" \ + -e "POGOM_GMAPS_KEY=SUPERSECRET" \ + frostthefox/pokemongo-map ``` ## Advanced Docker Setup @@ -162,7 +161,7 @@ Now that we have a persistent database up and running, we need to launch our Pok ``` docker run -d --name pogomap --net=pogonw -p 5000:5000 \ - pokemap/pokemongo-map \ + frostthefox/pokemongo-map \ -a ptc -u username -p password \ -k 'your-google-maps-key' \ -l 'lat, lon' \ @@ -191,7 +190,7 @@ If you would like to launch a different worker sharing the same db, to scan a di ``` docker run -d --name pogomap2 --net=pogonw \ - pokemap/pokemongo-map \ + frostthefox/pokemongo-map \ -a ptc -u username2 -p password2 \ -k 'your-google-maps-key' \ -l 'newlat, newlon' \ @@ -247,7 +246,7 @@ If you have a docker image for a notification webhook that you want to be called ``` docker run -d --name pogomap --net=pogonw -p 5000:5000 \ - pokemap/pokemongo-map \ + frostthefox/pokemongo-map \ -a ptc -u username -p password \ -k 'your-google-maps-key' \ -l 'lat, lon' \ From 4b79e61c83ec6f707dc10f8e7f8e5272f00517e6 Mon Sep 17 00:00:00 2001 From: primaxius Date: Fri, 23 Sep 2016 13:53:40 -0600 Subject: [PATCH 23/33] SpawnPoint Scanning Confusion - changed --spawnpoints-only to --skip-empty (#1372) * Change --spawnpoints-only to --skip-empty Change --spawnpoints-only to --skip-empty with better description in order to stop the confusion between TBTerra's Spawnpoint Scanning and this. * Update commandline.md to include --skip-empty --- docs/extras/commandline.md | 205 +++++++++++++++++++++++-------------- pogom/utils.py | 4 +- 2 files changed, 128 insertions(+), 81 deletions(-) diff --git a/docs/extras/commandline.md b/docs/extras/commandline.md index 2b5d404c98..879d3548cc 100644 --- a/docs/extras/commandline.md +++ b/docs/extras/commandline.md @@ -1,6 +1,6 @@ # Command Line - usage: runserver.py + usage: runserver.py [-h] [-a AUTH_SERVICE] [-u USERNAME] [-p PASSWORD] [-w WORKERS] [-asi ACCOUNT_SEARCH_INTERVAL] [-ari ACCOUNT_REST_INTERVAL] [-ac ACCOUNTCSV] @@ -8,155 +8,202 @@ [-ld LOGIN_DELAY] [-lr LOGIN_RETRIES] [-mf MAX_FAILURES] [-msl MIN_SECONDS_LEFT] [-dc] [-H HOST] [-P PORT] [-L LOCALE] [-c] [-m MOCK] [-ns] [-os] [-nsc] [-fl] -k - GMAPS_KEY [--spawnpoints-only] [-C] [-D DB] [-cd] [-np] - [-ng] [-nk] [-ss [SPAWNPOINT_SCANNING]] - [--dump-spawnpoints] [-pd PURGE_DATA] [-px PROXY] - [-pxt PROXY_TIMEOUT] [-pxd PROXY_DISPLAY] - [--db-type DB_TYPE] [--db-name DB_NAME] - [--db-user DB_USER] [--db-pass DB_PASS] - [--db-host DB_HOST] [--db-port DB_PORT] + GMAPS_KEY [--skip-empty] [-C] [-D DB] [-cd] [-np] [-ng] + [-nk] [-ss [SPAWNPOINT_SCANNING]] [--dump-spawnpoints] + [-pd PURGE_DATA] [-px PROXY] [-pxsc] [-pxt PROXY_TIMEOUT] + [-pxd PROXY_DISPLAY] [--db-type DB_TYPE] + [--db-name DB_NAME] [--db-user DB_USER] + [--db-pass DB_PASS] [--db-host DB_HOST] + [--db-port DB_PORT] [--db-max_connections DB_MAX_CONNECTIONS] [--db-threads DB_THREADS] [-wh [WEBHOOKS [WEBHOOKS ...]]] - [-gi] [--webhook-updates-only] [--wh-threads WH_THREADS] + [-gi] [--disable-clean] [--webhook-updates-only] + [--wh-threads WH_THREADS] [--ssl-certificate SSL_CERTIFICATE] [--ssl-privatekey SSL_PRIVATEKEY] [-ps] [-sn STATUS_NAME] [-spp STATUS_PAGE_PASSWORD] [-el ENCRYPT_LIB] - [-v [filename.log] | -vv [filename.log] | -d] + [-odt ON_DEMAND_TIMEOUT] [-v [filename.log] | -vv + [filename.log] | -d] Args that start with '--' (eg. -a) can also be set in a config file - (C:\Users\User\Desktop\Pogom\PokemonGo-map\pogom\../config/config.ini or ). - The recognized syntax for setting (key, value) pairs is based on the INI and - YAML formats (e.g. key=value or foo=TRUE). For full documentation of the - differences from the standards please refer to the ConfigArgParse - documentation. If an arg is specified in more than one place, then commandline - values override environment variables which override config file values which - override defaults. + (/home/primaxius/PokemonGo-Map/pogom/../config/config.ini or ). The recognized + syntax for setting (key, value) pairs is based on the INI and YAML formats + (e.g. key=value or foo=TRUE). For full documentation of the differences from + the standards please refer to the ConfigArgParse documentation. If an arg is + specified in more than one place, then commandline values override environment + variables which override config file values which override defaults. optional arguments: - -h, --help Show this help message and exit. + -h, --help show this help message and exit [env var: + POGOMAP_HELP] -a AUTH_SERVICE, --auth-service AUTH_SERVICE Auth Services, either one for all accounts or one per - account: ptc or google. Defaults all to ptc. + account: ptc or google. Defaults all to ptc. [env var: + POGOMAP_AUTH_SERVICE] -u USERNAME, --username USERNAME - Usernames, one per account. + Usernames, one per account. [env var: + POGOMAP_USERNAME] -p PASSWORD, --password PASSWORD Passwords, either single one for all accounts or one - per account. + per account. [env var: POGOMAP_PASSWORD] -w WORKERS, --workers WORKERS Number of search worker threads to start. Defaults to - the number of accounts specified. + the number of accounts specified. [env var: + POGOMAP_WORKERS] -asi ACCOUNT_SEARCH_INTERVAL, --account-search-interval ACCOUNT_SEARCH_INTERVAL Seconds for accounts to search before switching to a - new account. 0 to disable. + new account. 0 to disable. [env var: + POGOMAP_ACCOUNT_SEARCH_INTERVAL] -ari ACCOUNT_REST_INTERVAL, --account-rest-interval ACCOUNT_REST_INTERVAL Seconds for accounts to rest when they fail or are - switched out. + switched out [env var: POGOMAP_ACCOUNT_REST_INTERVAL] -ac ACCOUNTCSV, --accountcsv ACCOUNTCSV Load accounts from CSV file containing - "auth_service,username,passwd" lines. + "auth_service,username,passwd" lines [env var: + POGOMAP_ACCOUNTCSV] -l LOCATION, --location LOCATION - Location, can be an address or coordinates. - -j, --jitter Apply random -9m to +9m jitter to location. + Location, can be an address or coordinates [env var: + POGOMAP_LOCATION] + -j, --jitter Apply random -9m to +9m jitter to location [env var: + POGOMAP_JITTER] -st STEP_LIMIT, --step-limit STEP_LIMIT - Steps. + Steps [env var: POGOMAP_STEP_LIMIT] -sd SCAN_DELAY, --scan-delay SCAN_DELAY - Time delay between requests in scan threads. + Time delay between requests in scan threads [env var: + POGOMAP_SCAN_DELAY] -ld LOGIN_DELAY, --login-delay LOGIN_DELAY - Time delay between each login attempt. + Time delay between each login attempt [env var: + POGOMAP_LOGIN_DELAY] -lr LOGIN_RETRIES, --login-retries LOGIN_RETRIES - Number of logins attempts before refreshing a thread. + Number of logins attempts before refreshing a thread + [env var: POGOMAP_LOGIN_RETRIES] -mf MAX_FAILURES, --max-failures MAX_FAILURES Maximum number of failures to parse locations before - an account will go into a two hour sleep. + an account will go into a two hour sleep [env var: + POGOMAP_MAX_FAILURES] -msl MIN_SECONDS_LEFT, --min-seconds-left MIN_SECONDS_LEFT Time that must be left on a spawn before considering it too late and skipping it. eg. 600 would skip - anything with < 10 minutes remaining. Default 0. + anything with < 10 minutes remaining. Default 0. [env + var: POGOMAP_MIN_SECONDS_LEFT] -dc, --display-in-console - Display Found Pokemon in Console. - -H HOST, --host HOST Set web server listening host. - -P PORT, --port PORT Set web server listening port. + Display Found Pokemon in Console [env var: + POGOMAP_DISPLAY_IN_CONSOLE] + -H HOST, --host HOST Set web server listening host [env var: POGOMAP_HOST] + -P PORT, --port PORT Set web server listening port [env var: POGOMAP_PORT] -L LOCALE, --locale LOCALE Locale for Pokemon names (default: en, check - static/dist/locales for more). - -c, --china Coordinates transformer for China. + static/dist/locales for more) [env var: + POGOMAP_LOCALE] + -c, --china Coordinates transformer for China [env var: + POGOMAP_CHINA] -m MOCK, --mock MOCK Mock mode - point to a fpgo endpoint instead of using - the real PogoApi, ec: http://127.0.0.1:9090. + the real PogoApi, ec: http://127.0.0.1:9090 [env var: + POGOMAP_MOCK] -ns, --no-server No-Server Mode. Starts the searcher but not the - Webserver. + Webserver. [env var: POGOMAP_NO_SERVER] -os, --only-server Server-Only Mode. Starts only the Webserver without - the searcher. + the searcher. [env var: POGOMAP_ONLY_SERVER] -nsc, --no-search-control - Disables search control. + Disables search control [env var: + POGOMAP_NO_SEARCH_CONTROL] -fl, --fixed-location - Hides the search bar for use in shared maps. + Hides the search bar for use in shared maps. [env var: + POGOMAP_FIXED_LOCATION] -k GMAPS_KEY, --gmaps-key GMAPS_KEY - Google Maps Javascript API Key. - --spawnpoints-only Only scan locations with spawnpoints in them. - -C, --cors Enable CORS on web server. - -D DB, --db DB Database filename. + Google Maps Javascript API Key [env var: + POGOMAP_GMAPS_KEY] + --skip-empty Enables skipping of empty cells in normal scans - + requires previously populated database (not to be used + with -ss) [env var: POGOMAP_SKIP_EMPTY] + -C, --cors Enable CORS on web server [env var: POGOMAP_CORS] + -D DB, --db DB Database filename [env var: POGOMAP_DB] -cd, --clear-db Deletes the existing database before starting the - Webserver. + Webserver. [env var: POGOMAP_CLEAR_DB] -np, --no-pokemon Disables Pokemon from the map (including parsing them - into local db). + into local db) [env var: POGOMAP_NO_POKEMON] -ng, --no-gyms Disables Gyms from the map (including parsing them - into local db). + into local db) [env var: POGOMAP_NO_GYMS] -nk, --no-pokestops Disables PokeStops from the map (including parsing - them into local db). + them into local db) [env var: POGOMAP_NO_POKESTOPS] -ss [SPAWNPOINT_SCANNING], --spawnpoint-scanning [SPAWNPOINT_SCANNING] Use spawnpoint scanning (instead of hex grid). Scans - in a circle based on step_limit when on DB. + in a circle based on step_limit when on DB [env var: + POGOMAP_SPAWNPOINT_SCANNING] --dump-spawnpoints dump the spawnpoints from the db to json (only for use - with -ss). + with -ss) [env var: POGOMAP_DUMP_SPAWNPOINTS] -pd PURGE_DATA, --purge-data PURGE_DATA Clear pokemon from database this many hours after they - disappear (0 to disable). + disappear (0 to disable) [env var: POGOMAP_PURGE_DATA] -px PROXY, --proxy PROXY - Proxy url (e.g. socks5://127.0.0.1:9050). + Proxy url (e.g. socks5://127.0.0.1:9050) [env var: + POGOMAP_PROXY] + -pxsc, --proxy-skip-check + Disable checking of proxies before start [env var: + POGOMAP_PROXY_SKIP_CHECK] -pxt PROXY_TIMEOUT, --proxy-timeout PROXY_TIMEOUT - Timeout settings for proxy checker in seconds. + Timeout settings for proxy checker in seconds [env + var: POGOMAP_PROXY_TIMEOUT] -pxd PROXY_DISPLAY, --proxy-display PROXY_DISPLAY Display info on which proxy beeing used (index or - full) To be used with -ps. - --db-type DB_TYPE Type of database to be used (default: sqlite). - --db-name DB_NAME Name of the database to be used. - --db-user DB_USER Username for the database. - --db-pass DB_PASS Password for the database. - --db-host DB_HOST IP or hostname for the database. - --db-port DB_PORT Port for the database. + full) To be used with -ps [env var: + POGOMAP_PROXY_DISPLAY] + --db-type DB_TYPE Type of database to be used (default: sqlite) [env + var: POGOMAP_DB_TYPE] + --db-name DB_NAME Name of the database to be used [env var: + POGOMAP_DB_NAME] + --db-user DB_USER Username for the database [env var: POGOMAP_DB_USER] + --db-pass DB_PASS Password for the database [env var: POGOMAP_DB_PASS] + --db-host DB_HOST IP or hostname for the database [env var: + POGOMAP_DB_HOST] + --db-port DB_PORT Port for the database [env var: POGOMAP_DB_PORT] --db-max_connections DB_MAX_CONNECTIONS - Max connections (per thread) for the database. + Max connections (per thread) for the database [env + var: POGOMAP_DB_MAX_CONNECTIONS] --db-threads DB_THREADS Number of db threads; increase if the db queue falls - behind. + behind [env var: POGOMAP_DB_THREADS] -wh [WEBHOOKS [WEBHOOKS ...]], --webhook [WEBHOOKS [WEBHOOKS ...]] - Define URL(s) to POST webhook information to. + Define URL(s) to POST webhook information to [env var: + POGOMAP_WEBHOOK] -gi, --gym-info Get all details about gyms (causes an additional API - hit for every gym). + hit for every gym) [env var: POGOMAP_GYM_INFO] + --disable-clean Disable clean db loop [env var: POGOMAP_DISABLE_CLEAN] --webhook-updates-only - Only send updates (pokemon & lured pokestops). + Only send updates (pokémon & lured pokéstops) [env + var: POGOMAP_WEBHOOK_UPDATES_ONLY] --wh-threads WH_THREADS Number of webhook threads; increase if the webhook - queue falls behind. + queue falls behind [env var: POGOMAP_WH_THREADS] --ssl-certificate SSL_CERTIFICATE - Path to SSL certificate file. + Path to SSL certificate file [env var: + POGOMAP_SSL_CERTIFICATE] --ssl-privatekey SSL_PRIVATEKEY - Path to SSL private key file. + Path to SSL private key file [env var: + POGOMAP_SSL_PRIVATEKEY] -ps, --print-status Show a status screen instead of log messages. Can - switch between status and logs by pressing enter. + switch between status and logs by pressing enter. [env + var: POGOMAP_PRINT_STATUS] -sn STATUS_NAME, --status-name STATUS_NAME Enable status page database update using STATUS_NAME - as main worker name. + as main worker name [env var: POGOMAP_STATUS_NAME] -spp STATUS_PAGE_PASSWORD, --status-page-password STATUS_PAGE_PASSWORD - Set the status page password. + Set the status page password [env var: + POGOMAP_STATUS_PAGE_PASSWORD] -el ENCRYPT_LIB, --encrypt-lib ENCRYPT_LIB Path to encrypt lib to be used instead of the shipped - ones. + ones [env var: POGOMAP_ENCRYPT_LIB] + -odt ON_DEMAND_TIMEOUT, --on-demand_timeout ON_DEMAND_TIMEOUT + Pause searching while web UI is inactive for this + timeout(in seconds) [env var: + POGOMAP_ON_DEMAND_TIMEOUT] -v [filename.log], --verbose [filename.log] Show debug messages from PomemonGo-Map and pgoapi. - Optionally specify file to log to. + Optionally specify file to log to. [env var: + POGOMAP_VERBOSE] -vv [filename.log], --very-verbose [filename.log] Like verbose, but show debug messages from all modules - as well. Optionally specify file to log to. - -d, --debug Depreciated, use -v or -vv instead. - + as well. Optionally specify file to log to. [env var: + POGOMAP_VERY_VERBOSE] + -d, --debug Deprecated, use -v or -vv instead. [env var: + POGOMAP_DEBUG] diff --git a/pogom/utils.py b/pogom/utils.py index bf2ecf8ac6..d9596d462e 100755 --- a/pogom/utils.py +++ b/pogom/utils.py @@ -113,7 +113,7 @@ def get_args(): parser.add_argument('-k', '--gmaps-key', help='Google Maps Javascript API Key', required=True) - parser.add_argument('--spawnpoints-only', help='Only scan locations with spawnpoints in them.', + parser.add_argument('--skip-empty', help='Enables skipping of empty cells in normal scans - requires previously populated database (not to be used with -ss)', action='store_true', default=False) parser.add_argument('-C', '--cors', help='Enable CORS on web server', action='store_true', default=False) @@ -343,7 +343,7 @@ def get_args(): # Decide which scanning mode to use if args.spawnpoint_scanning: args.scheduler = 'SpawnScan' - elif args.spawnpoints_only: + elif args.skip_empty: args.scheduler = 'HexSearchSpawnpoint' else: args.scheduler = 'HexSearch' From ad9e3cba411e7725043c82afb09fb345e3dd66e5 Mon Sep 17 00:00:00 2001 From: FrostTheFox Date: Fri, 23 Sep 2016 20:28:47 -0400 Subject: [PATCH 24/33] Few doc updates (#1373) * Added little Linux thing * Some doc updates * little thing * changed 2nd gen link * added loc gen --- docs/basic-install/index.rst | 2 +- docs/extras/Community-Tools.md | 11 ++++++++++- docs/extras/faq.md | 14 +++++++++++++- docs/extras/multi-account.md | 6 ++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/basic-install/index.rst b/docs/basic-install/index.rst index b8cb31d508..cac2195098 100644 --- a/docs/basic-install/index.rst +++ b/docs/basic-install/index.rst @@ -150,7 +150,7 @@ If you are running a ``git`` version, you can update with a few quick commands: .. code-block:: bash git pull - pip install -r requirements.txt --upgrade + pip install -r requirements.txt --upgrade (Prepend sudo -H on Linux) npm install npm run build diff --git a/docs/extras/Community-Tools.md b/docs/extras/Community-Tools.md index a44648aaab..08b77a1907 100644 --- a/docs/extras/Community-Tools.md +++ b/docs/extras/Community-Tools.md @@ -1,10 +1,19 @@ # Community Tools Some useful tools made by the community for the community -## [PTC Account Generator](https://github.com/skvvv/pikapy) +## [ptc-acc-gen](https://github.com/FrostTheFox/ptc-acc-gen) +A PTC account generation script, generates any # of accounts. ToS verification/trainer name setting via PogoPlayer. Google Scripts script to accept email verification included. Outputs in .csv format. Semi-auto (Manually finish captcha) and automatic (Automatically finish captcha using 2captcha) modes. + +## [PTC Account Generator](https://github.com/sriyegna/Pikaptcha) ### An automation script that can create any number of Nintendo Pokémon Trainer Club accounts Used to generate any desired number of PTC accounts - TOS verifies them and includes a google script that can be used to verify all the emails. Outputs generated account information in .csv format. +## [PGM Multi Loc](https://beccasafan.github.io/pgm-multiloc/) +### Easily visualize locations on a map before scanning, and generate a customized launch script. +Add multiple scan locations on the map. Automatically convert an area to a beehive. Resize and move the location on the map. Disable individual hives to stop scanning a specific location. + +Generate a customized launch script, with the ability to edit the templates used for the individual commands. Pass in a list of account information that contains usernames, passwords, proxies, etc. + ## [Cor3Zer0's Map Calculator](https://github.com/Cor3Zer0/Map-Calculator) ### Calculator that helps in the creation of PokemonGo Map Used to calculate optimized flags for particular use cases given a set situation. diff --git a/docs/extras/faq.md b/docs/extras/faq.md index 34d0784aec..a335489bb4 100644 --- a/docs/extras/faq.md +++ b/docs/extras/faq.md @@ -15,7 +15,7 @@ The -dp, -dg -dl, -i, -o and -ar parameters are no longer needed. Remove them fr [See this helpful guide](external.md) -## "It's acting like the location flag is missing. +## "It's acting like the location flag is missing." `-l`, never forget. @@ -47,3 +47,15 @@ error: command 'gcc' failed with exit status 1 Your OS is missing the `gcc` compiler library. For Debian, run `apt-get install build-essentials`. For Red Hat, run `yum groupinstall 'Development Tools'` +## Formulas? +Worker Count Formula: `W= 10/T * (R/5)^2` + +Another: +``` +A = 10 / T * (R/5)^2 + +A = Accounts +R = Radius (in "steps" -st) +T = 15 minutes minus the minimum remaining amount of time you want when the pokemon is spotted. (T=15-0=15 if you are just scanning for spawn points; T= (15 - 5 ) = 10 means you will have 5 minutes left guaranteed after spotting it, more for twitter bots) +``` + diff --git a/docs/extras/multi-account.md b/docs/extras/multi-account.md index a2b7fe291d..91d87c4e07 100644 --- a/docs/extras/multi-account.md +++ b/docs/extras/multi-account.md @@ -7,12 +7,12 @@ PokemonGo-Map supports using multiple accounts to run a worker with multiple thr To use multiple accounts when running from the command line, you must specify multiple -u and -p values. -Example: `python runserver.py -u thunderfox01 -u thunderfox02 -p thunderfox01 -p thunderfox02` +Example: `python runserver.py -a ptc -u thunderfox01 -u thunderfox02 -p thunderfox01 -p thunderfox02` If you have multiple accounts with the same password, you can specify one -p value. PokemonGo-Map will use the value for all specified accounts. -Example: `python runserver.py -u thunderfox01 -u thunderfox02 -p thunderfox` +Example: `python runserver.py -a ptc -u thunderfox01 -u thunderfox02 -p thunderfox` If you have multiple accounts with different auth services, you can specify multiple -a values. @@ -25,6 +25,7 @@ To use multiple accounts with config.ini, you must surround all the accounts and Example: ``` +auth-service: ptc username: [thunderfox01, thunderfox02] password: [password01, password02] ``` @@ -34,6 +35,7 @@ If you have multiple accounts with the same password, you can specify one passwo Example: ``` +auth-service: ptc username: [thunderfox01, thunderfox02] password: password ``` From f6b94d94c5d69ce4b9b018e29bcbb47c4da1e946 Mon Sep 17 00:00:00 2001 From: TechLinkRon Date: Sat, 24 Sep 2016 00:36:35 -0400 Subject: [PATCH 25/33] Enhance Statistics Panel (#1241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Test Commit * Revert "Test Commit" aa This reverts commit e87c9d5f86c249d5a3491bd695633878344f897d. * Add sortable Pokemon stats table * Put back accidentally deleted PokeGyms stats code * add link to Pokedex * Styling fixes for statistics panel * Fix listing errors * fix some PokéSpelling errors * Only count visible pokemon/gyms/pokestops Correct issue (that has apparently existed for a while?) where items not currently on screen were included in the stats. * fix linting errors --- static/js/map.js | 22 +++++- static/js/stats.js | 131 ++++++++++++++++++++------------- static/sass/layout/_stats.scss | 32 ++++++++ templates/map.html | 23 +++++- 4 files changed, 154 insertions(+), 54 deletions(-) diff --git a/static/js/map.js b/static/js/map.js index 29ef1de3df..af66c26837 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1023,7 +1023,7 @@ function updateMap () { // drawScanPath(result.scanned); clearStaleMarkers() if ($('#stats').hasClass('visible')) { - countMarkers() + countMarkers(map) } lastUpdateTime = Date.now() }) @@ -1598,4 +1598,24 @@ $(function () { heightStyle: 'content' }) } + + // Initialize dataTable in statistics sidebar + // - turn off sorting for the 'icon' column + // - initially sort 'name' column alphabetically + + $('#pokemonList_table').DataTable({ + paging: false, + searching: false, + info: false, + errMode: 'throw', + 'language': { + 'emptyTable': '' + }, + 'columns': [ + { 'orderable': false }, + null, + null, + null + ] + }).order([1, 'asc']) }) diff --git a/static/js/stats.js b/static/js/stats.js index a8e708e32c..bc334cc2ba 100644 --- a/static/js/stats.js +++ b/static/js/stats.js @@ -1,4 +1,5 @@ -function countMarkers () { // eslint-disable-line no-unused-vars +function countMarkers (map) { // eslint-disable-line no-unused-vars + document.getElementById('stats-ldg-label').innerHTML = '' document.getElementById('stats-pkmn-label').innerHTML = 'Pokémon' document.getElementById('stats-gym-label').innerHTML = 'Gyms' document.getElementById('stats-pkstop-label').innerHTML = 'PokéStops' @@ -10,40 +11,82 @@ function countMarkers () { // eslint-disable-line no-unused-vars var pkmnTotal = 0 var pokestopCount = [] var pokestopTotal = 0 + var pokeStatTable = $('#pokemonList_table').DataTable() + + // Bounds of the currently visible map + var currentVisibleMap = map.getBounds() + + // Is a particular Pokémon/Gym/Pokéstop within the currently visible map? + var thisPokeIsVisible = false + var thisGymIsVisible = false + var thisPokestopIsVisible = false + if (Store.get('showPokemon')) { $.each(mapData.pokemons, function (key, value) { - if (pkmnCount[mapData.pokemons[key]['pokemon_id']] === 0 || !pkmnCount[mapData.pokemons[key]['pokemon_id']]) { - pkmnCount[mapData.pokemons[key]['pokemon_id']] = { - 'ID': mapData.pokemons[key]['pokemon_id'], - 'Count': 1, - 'Name': mapData.pokemons[key]['pokemon_name'] + var thisPokeLocation = { lat: mapData.pokemons[key]['latitude'], lng: mapData.pokemons[key]['longitude'] } + thisPokeIsVisible = currentVisibleMap.contains(thisPokeLocation) + + if (thisPokeIsVisible) { + pkmnTotal++ + if (pkmnCount[mapData.pokemons[key]['pokemon_id']] === 0 || !pkmnCount[mapData.pokemons[key]['pokemon_id']]) { + pkmnCount[mapData.pokemons[key]['pokemon_id']] = { + 'ID': mapData.pokemons[key]['pokemon_id'], + 'Count': 1, + 'Name': mapData.pokemons[key]['pokemon_name'] + } + } else { + pkmnCount[mapData.pokemons[key]['pokemon_id']].Count += 1 } - } else { - pkmnCount[mapData.pokemons[key]['pokemon_id']].Count += 1 } - pkmnTotal++ }) - pkmnCount.sort(sortBy('Name', false)) - var pkmnListString = '' + + var pokeCounts = [] + for (i = 0; i < pkmnCount.length; i++) { if (pkmnCount[i] && pkmnCount[i].Count > 0) { - pkmnListString += '' + pokeCounts.push( + [ + '', + '' + pkmnCount[i].Name + '', + pkmnCount[i].Count, + (Math.round(pkmnCount[i].Count * 100 / pkmnTotal * 10) / 10) + '%' + ] + ) } } - pkmnListString += '
IconNameCount%
Total' + pkmnTotal + '
' + pkmnCount[i].Name + '' + pkmnCount[i].Count + '' + Math.round(pkmnCount[i].Count * 100 / pkmnTotal * 10) / 10 + '%
' - document.getElementById('pokemonList').innerHTML = pkmnListString + + // Clear stale data, add fresh data, redraw + + $('#pokemonList_table').dataTable().show() + pokeStatTable + .clear() + .rows.add(pokeCounts) + .draw() } else { - document.getElementById('pokemonList').innerHTML = 'Pokémons markers are disabled' - } + pokeStatTable + .clear() + .draw() + + document.getElementById('pokeStatStatus').innerHTML = 'Pokémon markers are disabled' + $('#pokemonList_table').dataTable().hide() + } // end Pokémon processing + + // begin Gyms processing if (Store.get('showGyms')) { $.each(mapData.gyms, function (key, value) { - if (arenaCount[mapData.gyms[key]['team_id']] === 0 || !arenaCount[mapData.gyms[key]['team_id']]) { - arenaCount[mapData.gyms[key]['team_id']] = 1 - } else { - arenaCount[mapData.gyms[key]['team_id']] += 1 + var thisGymLocation = { lat: mapData.gyms[key]['latitude'], lng: mapData.gyms[key]['longitude'] } + thisGymIsVisible = currentVisibleMap.contains(thisGymLocation) + + if (thisGymIsVisible) { + arenaTotal++ + if (arenaCount[mapData.gyms[key]['team_id']] === 0 || !arenaCount[mapData.gyms[key]['team_id']]) { + arenaCount[mapData.gyms[key]['team_id']] = 1 + } else { + arenaCount[mapData.gyms[key]['team_id']] += 1 + } } - arenaTotal++ }) + var arenaListString = '' for (i = 0; i < arenaCount.length; i++) { if (arenaCount[i] > 0) { @@ -63,22 +106,28 @@ function countMarkers () { // eslint-disable-line no-unused-vars } else { document.getElementById('arenaList').innerHTML = 'Gyms markers are disabled' } + if (Store.get('showPokestops')) { $.each(mapData.pokestops, function (key, value) { - if (mapData.pokestops[key]['lure_expiration'] && mapData.pokestops[key]['lure_expiration'] > 0) { - if (pokestopCount[1] === 0 || !pokestopCount[1]) { - pokestopCount[1] = 1 - } else { - pokestopCount[1] += 1 - } - } else { - if (pokestopCount[0] === 0 || !pokestopCount[0]) { - pokestopCount[0] = 1 + var thisPokestopLocation = { lat: mapData.pokestops[key]['latitude'], lng: mapData.pokestops[key]['longitude'] } + thisPokestopIsVisible = currentVisibleMap.contains(thisPokestopLocation) + + if (thisPokestopIsVisible) { + if (mapData.pokestops[key]['lure_expiration'] && mapData.pokestops[key]['lure_expiration'] > 0) { + if (pokestopCount[1] === 0 || !pokestopCount[1]) { + pokestopCount[1] = 1 + } else { + pokestopCount[1] += 1 + } } else { - pokestopCount[0] += 1 + if (pokestopCount[0] === 0 || !pokestopCount[0]) { + pokestopCount[0] = 1 + } else { + pokestopCount[0] += 1 + } } + pokestopTotal++ } - pokestopTotal++ }) var pokestopListString = '
IconTeam ColorCount%
Total' + arenaTotal + '
' for (i = 0; i < pokestopCount.length; i++) { @@ -96,21 +145,3 @@ function countMarkers () { // eslint-disable-line no-unused-vars document.getElementById('pokestopList').innerHTML = 'PokéStops markers are disabled' } } - -var sortBy = function (field, reverse, primer) { - var key = primer - ? function (x) { - return primer(x[field]) - } - : function (x) { - return x[field] - } - - reverse = !reverse ? 1 : -1 - - return function (a, b) { - a = key(a) - b = key(b) - return reverse * ((a > b) - (b > a)) - } -} diff --git a/static/sass/layout/_stats.scss b/static/sass/layout/_stats.scss index 475f7191de..7fb28b8d60 100644 --- a/static/sass/layout/_stats.scss +++ b/static/sass/layout/_stats.scss @@ -108,4 +108,36 @@ @include breakpoint(small) { padding: 2.5em 1.75em; } + + .stats-label-container { + font-weight: bold; + border-width: 1px 0px; + border-style: solid; + border-color: black; + background-color: white; + margin: .75em 0 .25em 0; + } + + .stats-label-container h1 { + margin: 0.25em; + font-size: 1.2em; + font-family: 'Muli', sans-serif; + } + + // Styling for statistics dataTable + + table.dataTable.display { + margin-bottom: 2em; + } + table.dataTable.display tbody tr td, + table.dataTable.display tbody tr td img + { + vertical-align: middle; + padding: 0px 10px; + } + table.dataTable.display tbody tr td:nth-child(3) + { + text-align: center; + } + } diff --git a/templates/map.html b/templates/map.html index 7e58c9f408..d0a8448e94 100644 --- a/templates/map.html +++ b/templates/map.html @@ -30,6 +30,7 @@ + @@ -245,14 +246,29 @@

Location Icon Marker

-

Loading...

-
+

Loading...

+
+
+

+
+
+
IconStatusCount%
Total' + pokestopTotal + '
+ + + + + + +
Icon Name Count %
+
+ +

-
+

@@ -266,6 +282,7 @@

Location Icon Marker

+