From f02b91bd5e19151e8ac751060aac5eefaf0ec070 Mon Sep 17 00:00:00 2001 From: sjstein Date: Wed, 18 Nov 2020 10:06:57 -0600 Subject: [PATCH 01/13] Addressed getpass() hanging issue for incompatible OSes Added except clause for invalid uname/pass to exit gracefully Cleaned up a bit for pythonic conformance --- scripts/get_profile.py | 104 ++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 43 deletions(-) diff --git a/scripts/get_profile.py b/scripts/get_profile.py index 58ad5f7..d93f86d 100755 --- a/scripts/get_profile.py +++ b/scripts/get_profile.py @@ -3,36 +3,38 @@ # # Adapted from https://github.com/jlemon/zlogger/blob/master/get_riders.py # -#The MIT License (MIT) +# The MIT License (MIT) # -#Copyright (c) 2016 Jonathan Lemon +# Copyright (c) 2016 Jonathan Lemon # -#Permission is hereby granted, free of charge, to any person obtaining a copy -#of this software and associated documentation files (the "Software"), to deal -#in the Software without restriction, including without limitation the rights -#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -#copies of the Software, and to permit persons to whom the Software is -#furnished to do so, subject to the following conditions: +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: # -#The above copyright notice and this permission notice shall be included in all -#copies or substantial portions of the Software. +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. # -#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -#SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. -import sys, argparse, getpass -import requests +import argparse +import getpass import json -import os, time, stat -from collections import namedtuple +import os +import requests +import sys + if getattr(sys, 'frozen', False): - # If we're running as a pyinstaller bundle + # If we're running as a py installer bundle SCRIPT_DIR = os.path.dirname(sys.executable) else: SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) @@ -45,6 +47,7 @@ except NameError: global args global dbh + def post_credentials(session, username, password): # Credentials POSTing and tokens retrieval # POST https://secure.zwift.com/auth/realms/zwift/tokens/access/codes @@ -67,8 +70,8 @@ def post_credentials(session, username, password): "password": password, "grant_type": "password", }, - allow_redirects = False, - verify = args.verifyCert, + allow_redirects=False, + verify=args.verifyCert, ) if args.verbose: @@ -84,6 +87,11 @@ def post_credentials(session, username, password): except requests.exceptions.RequestException as e: print('HTTP Request failed: %s' % e) + except KeyError as e: + print('Invalid uname and/or password') + exit(-1) + + def query_player_profile(session, access_token): # Query Player Profile # GET https://us-or-rly101.zwift.com/api/profiles/ @@ -99,7 +107,7 @@ def query_player_profile(session, access_token): "Authorization": "Bearer %s" % access_token, "Accept-Language": "en-us", }, - verify = args.verifyCert, + verify=args.verifyCert, ) if args.verbose: @@ -131,7 +139,7 @@ def logout(session, refresh_token): "client_id": "Zwift_Mobile_Link", "refresh_token": refresh_token, }, - verify = args.verifyCert, + verify=args.verifyCert, ) if args.verbose: print('Response HTTP Status Code: {status_code}'.format( @@ -141,10 +149,12 @@ def logout(session, refresh_token): except requests.exceptions.RequestException as e: print('HTTP Request failed: %s' % e) + def login(session, user, password): access_token, refresh_token, expired_in = post_credentials(session, user, password) return access_token, refresh_token + def main(argv): global args global dbh @@ -152,32 +162,39 @@ def main(argv): access_token = None cookies = None - parser = argparse.ArgumentParser(description = 'Zwift Profile Fetcher') + parser = argparse.ArgumentParser(description='Zwift Profile Fetcher') parser.add_argument('-v', '--verbose', action='store_true', - help='Verbose output') + help='Verbose output') parser.add_argument('--dont-check-certificates', action='store_false', - dest='verifyCert', default=True) + dest='verifyCert', default=True) parser.add_argument('-u', '--user', help='Zwift user name') args = parser.parse_args() -# if args.user: -# password = getpass.getpass("Password for %s? " % args.user) -# else: -# file = os.environ['HOME'] + '/.zwift_cred.json' -# with open(file) as f: -# try: -# cred = json.load(f) -# except ValueError, se: -# sys.exit('"%s": %s' % (args.output, se)) -# f.close -# args.user = cred['user'] -# password = cred['pass'] + # if args.user: + # password = getpass.getpass("Password for %s? " % args.user) + # else: + # file = os.environ['HOME'] + '/.zwift_cred.json' + # with open(file) as f: + # try: + # cred = json.load(f) + # except ValueError, se: + # sys.exit('"%s": %s' % (args.output, se)) + # f.close + # args.user = cred['user'] + # password = cred['pass'] if args.user: username = args.user else: username = input("Enter Zwift login (e-mail): ") - password = getpass.getpass("Enter password: ") + if not sys.stdin.isatty(): # This terminal cannot support input without displaying text + print(f'*WARNING* The current shell ({os.name}) cannot support hidden text entry.') + print(f'Your password entry WILL BE VISIBLE.') + print(f'If you are running a bash shell under windows, try executing this program via winpty:') + print(f'>winpty python {argv[0]}') + password = input("Enter password (will be shown):") + else: + password = getpass.getpass("Enter password: ") session = requests.session() @@ -188,10 +205,11 @@ def main(argv): logout(session, refresh_token) + if __name__ == '__main__': try: main(sys.argv) except KeyboardInterrupt: pass except SystemExit as se: - print("ERROR:",se) + print("ERROR:", se) From a76459b748aeb9fddefcb7da8a84fd8c5e78afcb Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Mon, 30 Nov 2020 15:44:00 -0300 Subject: [PATCH 02/13] Update to Zwift 1.0.58982 --- README.md | 10 +++++----- cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml | 8 ++++---- cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f05c3d7..d5e9213 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,10 @@ zoffline can be installed on the same machine as Zwift or another local machine.
Windows Instructions * Install Zwift - * If your Zwift version is 1.0.57840, you're all set. + * If your Zwift version is 1.0.58982, you're all set. * If Zwift is not installed, install it before installing zoffline. - * If your Zwift version is newer than 1.0.57840 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. - * If your Zwift version is newer than 1.0.57840 and zoffline is not running from source: wait for zoffline to be updated. + * If your Zwift version is newer than 1.0.58982 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. + * If your Zwift version is newer than 1.0.58982 and zoffline is not running from source: wait for zoffline to be updated. * __NOTE:__ instead of performing the steps below you can instead just run the __configure_client__ script from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper * On your Windows machine running Zwift, copy the following files in this repo to a known location: * ``ssl/cert-zwift-com.p12`` @@ -97,9 +97,9 @@ to generate your own certificates and do the same.
Mac OS X Instructions (Thanks @oldnapalm!) * Install Zwift - * If your Zwift version is 1.0.57840, you're all set. + * If your Zwift version is 1.0.58982, you're all set. * If Zwift is not installed, install it before installing zoffline. - * If your Zwift version is newer than 1.0.57840: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. + * If your Zwift version is newer than 1.0.58982: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. * On your Mac machine running Zwift, copy the following files in this repo to a known location: * ``ssl/cert-zwift-com.p12`` * ``ssl/cert-zwift-com.pem`` diff --git a/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml b/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml index 8145a1d..99d9a62 100644 --- a/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml +++ b/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml @@ -1,7 +1,7 @@ +ver_cur_checksum="-65186171"/> diff --git a/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml b/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml index b4b8d8b..5895751 100644 --- a/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml +++ b/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml @@ -1,7 +1,7 @@ +ver_cur_checksum="261006606"/> From e24e2df8c00a58f86f5318a9f22ab387181e0058 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Mon, 30 Nov 2020 16:42:05 -0300 Subject: [PATCH 03/13] Update README.md --- README.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d5e9213..98e2402 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ to generate your own certificates and do the same.
-
Mac OS X Instructions (Thanks @oldnapalm!) +
Mac OS X Instructions * Install Zwift * If your Zwift version is 1.0.58982, you're all set. @@ -109,23 +109,6 @@ to generate your own certificates and do the same. * If you're prompted for a password, just leave it blank. There is no password. * In a terminal within the directory ``ssl/cert-zwift-com.pem`` was copied to, run ``cat cert-zwift-com.pem >> ~/Library/Application\ Support/Zwift/data/cacert.pem`` * Note: Appending the contents of ``ssl/cert-zwift-com.pem`` with a text editor doesn't work ([#62](https://github.com/zoffline/zwift-offline/issues/62)) -* Using a text editor (with admin privileges) open ``/Applications/Zwift.app/Contents/Info.plist`` - * Append these keys: - ``` - NSAppTransportSecurity - - NSExceptionDomains - - zwift.com - - NSExceptionAllowsInsecureHTTPLoads - - NSIncludesSubdomains - - - - - ``` * Using a text editor (with admin privileges) open ``/etc/hosts`` * Append this line: `` us-or-rly101.zwift.com secure.zwift.com cdn.zwift.com launcher.zwift.com``
(Where ```` is the ip address of the machine running zoffline. If @@ -193,8 +176,9 @@ To obtain your current profile: * e.g., on Linux/Mac: ``pip install stravalib`` * e.g., on Windows in command prompt: ``C:\Python27\Scripts\pip.exe install stravalib`` * Or, if using the Windows zoffline.exe version without Python installed you can run strava_auth.exe obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/strava_auth.py`` below. -* Get CLIENT_ID and CLIENT_SECRET from https://www.strava.com/settings/api +* [OPTIONAL] Get CLIENT_ID and CLIENT_SECRET from https://www.strava.com/settings/api * Run ``scripts/strava_auth.py --client-id CLIENT_ID --client-secret CLIENT_SECRET`` + * Run without arguments to use default values. * Open http://localhost:8000/ and authorize. * Move the resulting strava_token.txt (saved in whatever directory you ran strava_auth.py in) into the ``storage/`` directory. From 99233c949d6dd7b34195cd44f5a7f67933c63019 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Wed, 2 Dec 2020 06:38:05 -0300 Subject: [PATCH 04/13] Update to Zwift 1.0.59353 --- README.md | 10 +++++----- .../Zwift_Updates_Root/ZwiftMac_ver_cur.xml | 14 +++++++------- .../Zwift_Updates_Root/Zwift_ver_cur.xml | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 98e2402..e8cf186 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,10 @@ zoffline can be installed on the same machine as Zwift or another local machine.
Windows Instructions * Install Zwift - * If your Zwift version is 1.0.58982, you're all set. + * If your Zwift version is 1.0.59353, you're all set. * If Zwift is not installed, install it before installing zoffline. - * If your Zwift version is newer than 1.0.58982 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. - * If your Zwift version is newer than 1.0.58982 and zoffline is not running from source: wait for zoffline to be updated. + * If your Zwift version is newer than 1.0.59353 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. + * If your Zwift version is newer than 1.0.59353 and zoffline is not running from source: wait for zoffline to be updated. * __NOTE:__ instead of performing the steps below you can instead just run the __configure_client__ script from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper * On your Windows machine running Zwift, copy the following files in this repo to a known location: * ``ssl/cert-zwift-com.p12`` @@ -97,9 +97,9 @@ to generate your own certificates and do the same.
Mac OS X Instructions * Install Zwift - * If your Zwift version is 1.0.58982, you're all set. + * If your Zwift version is 1.0.59353, you're all set. * If Zwift is not installed, install it before installing zoffline. - * If your Zwift version is newer than 1.0.58982: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. + * If your Zwift version is newer than 1.0.59353: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. * On your Mac machine running Zwift, copy the following files in this repo to a known location: * ``ssl/cert-zwift-com.p12`` * ``ssl/cert-zwift-com.pem`` diff --git a/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml b/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml index 99d9a62..e5de0ca 100644 --- a/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml +++ b/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml @@ -1,7 +1,7 @@ - + diff --git a/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml b/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml index 5895751..b7f242f 100644 --- a/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml +++ b/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml @@ -1,7 +1,7 @@ - + From 87dc428831c3a523d366b6bfdf0fc59eee6db671 Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Tue, 15 Dec 2020 20:03:51 -0300 Subject: [PATCH 05/13] Re-add instruction for Mac client Needed for map selection --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index e8cf186..506e9f3 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,23 @@ to generate your own certificates and do the same. * If you're prompted for a password, just leave it blank. There is no password. * In a terminal within the directory ``ssl/cert-zwift-com.pem`` was copied to, run ``cat cert-zwift-com.pem >> ~/Library/Application\ Support/Zwift/data/cacert.pem`` * Note: Appending the contents of ``ssl/cert-zwift-com.pem`` with a text editor doesn't work ([#62](https://github.com/zoffline/zwift-offline/issues/62)) +* Using a text editor (with admin privileges) open ``/Applications/Zwift.app/Contents/Info.plist`` + * Append these keys: + ``` + NSAppTransportSecurity + + NSExceptionDomains + + zwift.com + + NSExceptionAllowsInsecureHTTPLoads + + NSIncludesSubdomains + + + + + ``` * Using a text editor (with admin privileges) open ``/etc/hosts`` * Append this line: `` us-or-rly101.zwift.com secure.zwift.com cdn.zwift.com launcher.zwift.com``
(Where ```` is the ip address of the machine running zoffline. If From 4f0c92f196b6d4614635de7c84b736b75c30eeae Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Thu, 17 Dec 2020 19:53:43 -0300 Subject: [PATCH 06/13] Update to Zwift 1.0.60239 --- README.md | 10 +++++----- cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml | 8 ++++---- cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 506e9f3..d9c3c39 100644 --- a/README.md +++ b/README.md @@ -69,10 +69,10 @@ zoffline can be installed on the same machine as Zwift or another local machine.
Windows Instructions * Install Zwift - * If your Zwift version is 1.0.59353, you're all set. + * If your Zwift version is 1.0.60239, you're all set. * If Zwift is not installed, install it before installing zoffline. - * If your Zwift version is newer than 1.0.59353 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. - * If your Zwift version is newer than 1.0.59353 and zoffline is not running from source: wait for zoffline to be updated. + * If your Zwift version is newer than 1.0.60239 and zoffline is running from source: copy ``C:\Program Files (x86)\Zwift\Zwift_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. + * If your Zwift version is newer than 1.0.60239 and zoffline is not running from source: wait for zoffline to be updated. * __NOTE:__ instead of performing the steps below you can instead just run the __configure_client__ script from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper * On your Windows machine running Zwift, copy the following files in this repo to a known location: * ``ssl/cert-zwift-com.p12`` @@ -97,9 +97,9 @@ to generate your own certificates and do the same.
Mac OS X Instructions * Install Zwift - * If your Zwift version is 1.0.59353, you're all set. + * If your Zwift version is 1.0.60239, you're all set. * If Zwift is not installed, install it before installing zoffline. - * If your Zwift version is newer than 1.0.59353: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. + * If your Zwift version is newer than 1.0.60239: copy ``~/Library/Application Support/Zwift/ZwiftMac_ver_cur.xml`` to zoffline's ``cdn/gameassets/Zwift_Updates_Root/`` overwriting the existing file. * On your Mac machine running Zwift, copy the following files in this repo to a known location: * ``ssl/cert-zwift-com.p12`` * ``ssl/cert-zwift-com.pem`` diff --git a/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml b/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml index e5de0ca..9fa2d6b 100644 --- a/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml +++ b/cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml @@ -1,7 +1,7 @@ +ver_cur_checksum="735979273"/> diff --git a/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml b/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml index b7f242f..3600d90 100644 --- a/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml +++ b/cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml @@ -1,7 +1,7 @@ +ver_cur_checksum="-1342059715"/> From 5782b089ae654ae77376b0a7f83e5edd8024214c Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 19:35:30 -0500 Subject: [PATCH 07/13] Ensure table creation is committed Fails in check_columns if table gets created, but not committed. Could be smarter about this and not do it everytime, but this is good enough. --- zwift_offline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zwift_offline.py b/zwift_offline.py index 7e2ad0f..113ed73 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -1547,6 +1547,7 @@ def before_first_request(): move_old_profile() init_database() db.create_all(app=app) + db.session.commit() # in case create_all created a table check_columns() db.session.close() send_message_thread = threading.Thread(target=send_server_back_online_message) From b52e73d1d5d9a9da33d0c3e8a1b36b8141f386f9 Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 19:37:15 -0500 Subject: [PATCH 08/13] Add a changelog for breaking changes --- CHANGELOG | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 CHANGELOG diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..1ff6677 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,21 @@ +# Only breaking changes in releases will be documented here. + +Update to Zwift_1.0.60239: + * With the update to this Zwift release, zoffline has included significant changes + to fully support a multiplayer mode, pace partners, and more. + * New dependencies required if running from source: pyJWT, flask-login, FlaskSQLAlchemy, gevent + * Install these with ``pip install pyjwt flask-login flask_sqlalchemy gevent`` + * Multi-profile support has been deprecated in favor of full multiplayer support. + * See Step 6 in README.md for how to enable multiplayer support. + * Create an account for each profile you had and upload their profile.bin + and credential files via the new Zwift launcher. + * Do not "upgrade" from an existing single player installation to multiplayer and then + "downgrade" back to single player without backing up your original storage directory. + You will lose your activities, segment results, and goals if you do this and don't + have a backup to restore from. + + +Update to Zwift_1.0.51959: + * Changes were made to Zwift's cacert.pem. You will likely need to re-append + cert-zwift-com.pem to Zwift's cacert.pem in a specific way. + See https://github.com/zoffline/zwift-offline/issues/62 for details. From f5f604e72f7814494d2a1c8df88667cdfe865511 Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 19:37:30 -0500 Subject: [PATCH 09/13] Update README.md --- README.md | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 85e6b26..9f1d29f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zoffline -zoffline enables the use of [Zwift](http://zwift.com) offline by acting as a partial implementation of a Zwift server. +zoffline enables the use of [Zwift](http://zwift.com) offline by acting as a partial implementation of a Zwift server. By default zoffline is only for a single player. See [Step 6: Enable Multiplayer](##step-6-optional-enable-multiplayer) for how to enable support for multiple users/profiles. zoffline also offers riding against ghosts (your previous rides). Enable this feature by checking "Enable ghosts" in zoffline's launcher. See https://github.com/zoffline/zwift-offline/issues/56 for extra details. @@ -171,6 +171,8 @@ the Zwift system tray icon and exit) and restart Zwift. ### Step 3 [OPTIONAL]: Obtain current Zwift profile +
Expand + If you don't obtain your current Zwift profile before first starting Zwift with zoffline enabled, you will be prompted to create a new profile (height, weight, gender). Your profile can be further customized and changed via the in game @@ -185,27 +187,33 @@ To obtain your current profile: * If multiplayer is enabled, use the upload button in the launcher window to import your file. * If using Docker, move profile.bin into the path you passed to ``-v`` +
-### Step 4 [OPTIONAL]: Obtain Strava API token +### Step 4 [OPTIONAL]: Upload activities to Strava + +
Expand * Install dependencies: stravalib * e.g., on Linux/Mac: ``pip install stravalib`` * e.g., on Windows in command prompt: ``C:\Python27\Scripts\pip.exe install stravalib`` - * Or, if using the Windows zoffline.exe version without Python installed you can run strava_auth.exe obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/strava_auth.py`` below. + * Or, if using the Windows zoffline.exe version without Python installed you can run ``strava_auth.exe`` obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/strava_auth.py`` below. * [OPTIONAL] Get CLIENT_ID and CLIENT_SECRET from https://www.strava.com/settings/api * Run ``scripts/strava_auth.py --client-id CLIENT_ID --client-secret CLIENT_SECRET`` * Run without arguments to use default values. * Open http://localhost:8000/ and authorize. -* Move the resulting strava_token.txt (saved in whatever directory you ran strava_auth.py in) into the ``storage/`` directory. +* Move the resulting ``strava_token.txt`` (saved in whatever directory you ran ``strava_auth.py`` in) into the ``storage/`` directory. * If multiplayer is enabled, use the upload button in the launcher window to import your file. +
### Step 5 [OPTIONAL]: Upload activities to Garmin Connect +
Expand + * Install dependencies: garmin-uploader, cryptography (optional) * e.g., on Linux/Mac: ``pip install garmin-uploader cryptography`` * e.g., on Windows in command prompt: ``C:\Python27\Scripts\pip.exe install garmin-uploader cryptography`` -* Create a file garmin_credentials.txt in the ``storage/`` directory containing your login credentials +* Create a file ``garmin_credentials.txt`` in the ``storage/`` directory containing your login credentials ``` @@ -213,16 +221,27 @@ To obtain your current profile: * Note: this is not secure. Only do this if you are comfortable with your login credentials being stored in a clear text file. * If multiplayer is enabled, use the upload button in the launcher window to encrypt the credentials file. +
### Step 6 [OPTIONAL]: Enable multiplayer -* Create a multiplayer.txt file in the ``storage`` directory. -* If you are not running zoffline on the same PC that Zwift is running: create a server-ip.txt file in the ``storage`` directory containing the IP address of the PC running zoffline. +
Expand -
Extra optional steps +To enable support for multiple users perform the steps below. zoffline's previous multi-profile support has been superceded by full multiplayer support. If you were previously using multiple profiles with zoffline you will need to enable multiplayer to continue supporting multiple users. -* To obtain the official map schedule and update files from Zwift server: create a cdn-proxy.txt file in the ``storage`` directory. This can only work if you are running zoffline on a different machine than the Zwift client. -* To enable the password reset feature: create a gmail_credentials.txt file in the ``storage`` directory containing the login credentials of a Gmail account. You need to enable the "Less secure app access" in the account settings and you may need to access https://accounts.google.com/DisplayUnlockCaptcha to allow the login from the server. +* Create a ``multiplayer.txt`` file in the ``storage`` directory. +* If you are not running zoffline on the same PC that Zwift is running: create a ``server-ip.txt`` file in the ``storage`` directory containing the IP address of the PC running zoffline. + * TCP ports 80, 443, 3023 and UDP port 3022 will need to be open on the PC running zoffline if its running remotely. +* Start Zwift and create an account in the new Zwift launcher and upload your ``profile.bin``, ``strava_credentials.txt``, and/or ``garmin_credentials.txt`` if you have them. + * This account will only exist on your zoffline server and has no relation with your actual Zwift account. + +
+ +### Extra optional steps +
Expand + +* To obtain the official map schedule and update files from Zwift server: create a ``cdn-proxy.txt`` file in the ``storage`` directory. This can only work if you are running zoffline on a different machine than the Zwift client. +* To enable the password reset feature when multiplayer is enabled: create a gmail_credentials.txt file in the ``storage`` directory containing the login credentials of a Gmail account. You need to enable the "Less secure app access" in the account settings and you may need to access https://accounts.google.com/DisplayUnlockCaptcha to allow the login from the server. * If the Zwift client is having issues connecting to the Linux server ("The request was aborted: Could not create SSL/TLS secure channel." or "The underlying connection was closed: An unexpected error occurred on a send. Received an unexpected EOF or 0 bytes from the transport stream."): change MinProtocol in /etc/ssl/openssl.cnf to TLSv1.0 ``` [system_default_sect] @@ -231,9 +250,9 @@ To obtain your current profile: ```
-## Discord and zoffline (online) server +## Community Discord and zoffline (online) server -Please join the [Discord](https://discord.gg/GMdn8F8) and our enhanced version of zoffline, hosted Online! +Please join the community supported [Discord](https://discord.gg/GMdn8F8) and their enhanced version of zoffline, hosted Online! Follow the guide in #instructions to create your account and join other Zwifters. @@ -269,7 +288,8 @@ Docker ## Note Future Zwift updates may break zoffline until it's updated. While zoffline is -enabled Zwift updates will not be installed. +enabled Zwift updates will not be installed. If a zoffline update broke +something, check the ``CHANGELOG`` for possible changes that need to be made. Don't expose zoffline to the internet, it was not designed with that in mind. From b7119fa40421a10dd5850bdaf4ea8cf4a030c634 Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 19:51:23 -0500 Subject: [PATCH 10/13] Update README.md Remove Python 2 documentation. It's still supported, but silently. --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9f1d29f..59468aa 100644 --- a/README.md +++ b/README.md @@ -27,19 +27,20 @@ To install zoffline on Windows:
Linux, Windows, or Mac OS X (from source) To install zoffline on Linux, Windows, or Mac OS X: -* Install Python 2 or 3 (https://www.python.org/downloads/) if not already installed +* Install Python 3 if not already installed + * On Windows, installing Python via the Microsoft Store is highly recommend! If using a Python installer, ensure that in the first Python installer screen "Add Python 3.x to PATH" is checked. * Install dependencies: flask, flask_sqlalchemy, flask-login, pyjwt, gevent, python-protobuf, protobuf3_to_dict, stravalib (optional) * e.g., on Linux/Mac: ``pip install flask flask_sqlalchemy flask-login pyjwt gevent protobuf protobuf3_to_dict stravalib`` - * e.g., on Windows in command prompt: ``C:\Python27\Scripts\pip.exe install flask flask_sqlalchemy flask-login pyjwt gevent protobuf protobuf3_to_dict stravalib`` - * Python 3 is installed by default in ``C:\Users\\AppData\Local\Programs\Python\Python38-32`` instead of ``C:\Python27`` + * e.g., on Windows in command prompt: ``pip install flask flask_sqlalchemy flask-login pyjwt gevent protobuf protobuf3_to_dict stravalib`` + * You may need to use ``C:\Users\\AppData\Local\Programs\Python\Python39\Scripts\pip.exe`` instead of just ``pip`` * Clone or download this repo * If you are not running zoffline on the same PC that Zwift is running: create a ``server-ip.txt`` file in the ``storage`` directory containing the IP address of the PC running zoffline. * Run standalone.py before starting Zwift * e.g., on Linux/Mac: ``sudo ./standalone.py`` * sudo is needed because we're binding to the privileged ports 80 and 443. * If using Python 3, but Python 3 is not your system default run ``sudo python3 standalone.py`` - * e.g., on Windows in command prompt: ``C:\Python27\python.exe standalone.py`` - * For Python 3 the command will likely be ``C:\Users\\AppData\Local\Programs\Python\Python38-32\python.exe standalone.py`` + * e.g., on Windows in command prompt: ``python standalone.py`` + * You may need to use ``C:\Users\\AppData\Local\Programs\Python\Python39\python.exe`` instead of just ``python`` * Start Zwift with standalone.py running (__after completing step 2__) * Note: When upgrading zoffline, be sure to retain the ``storage`` directory. It contains your Zwift progress state. @@ -195,7 +196,8 @@ To obtain your current profile: * Install dependencies: stravalib * e.g., on Linux/Mac: ``pip install stravalib`` - * e.g., on Windows in command prompt: ``C:\Python27\Scripts\pip.exe install stravalib`` + * e.g., on Windows in command prompt: ``pip install stravalib`` + * You may need to use ``C:\Users\\AppData\Local\Programs\Python\Python39\Scripts\pip.exe`` instead of just ``pip`` * Or, if using the Windows zoffline.exe version without Python installed you can run ``strava_auth.exe`` obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/strava_auth.py`` below. * [OPTIONAL] Get CLIENT_ID and CLIENT_SECRET from https://www.strava.com/settings/api * Run ``scripts/strava_auth.py --client-id CLIENT_ID --client-secret CLIENT_SECRET`` @@ -212,7 +214,8 @@ To obtain your current profile: * Install dependencies: garmin-uploader, cryptography (optional) * e.g., on Linux/Mac: ``pip install garmin-uploader cryptography`` - * e.g., on Windows in command prompt: ``C:\Python27\Scripts\pip.exe install garmin-uploader cryptography`` + * e.g., on Windows in command prompt: ``pip install garmin-uploader cryptography`` + * You may need to use ``C:\Users\\AppData\Local\Programs\Python\Python39\Scripts\pip.exe`` instead of just ``pip`` * Create a file ``garmin_credentials.txt`` in the ``storage/`` directory containing your login credentials ``` @@ -262,7 +265,8 @@ Docker -or- -* Python 2 or 3 (https://www.python.org/downloads/) +* Python 3 (https://www.python.org/downloads/) + * On Windows, installing Python via the Microsoft Store is highly recommend! If using a Python installer, ensure that in the first Python installer screen "Add Python 3.x to PATH" is checked. * Flask (http://flask.pocoo.org/) * ``pip install flask`` * python-protobuf (https://pypi.org/project/protobuf/) From 627e3271e67e1cfed8b15db64c97053986c84ad6 Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 20:17:37 -0500 Subject: [PATCH 11/13] Add packages to docker container for building new python deps --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3e46cd7..3992402 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER zoffline WORKDIR /usr/src/app -RUN apk add --no-cache git +RUN apk add --no-cache git gcc musl-dev libffi-dev openssl-dev file make RUN pip install flask flask_sqlalchemy flask-login pyjwt gevent protobuf protobuf3_to_dict stravalib garmin-uploader cryptography RUN git clone --depth 1 https://github.com/zoffline/zwift-offline From 823e13615b8a8088ce14c0dbc9ef97e95ee6f0fa Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 20:21:53 -0500 Subject: [PATCH 12/13] Fix link in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59468aa..9237b91 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zoffline -zoffline enables the use of [Zwift](http://zwift.com) offline by acting as a partial implementation of a Zwift server. By default zoffline is only for a single player. See [Step 6: Enable Multiplayer](##step-6-optional-enable-multiplayer) for how to enable support for multiple users/profiles. +zoffline enables the use of [Zwift](http://zwift.com) offline by acting as a partial implementation of a Zwift server. By default zoffline is only for a single player. See [Step 6: Enable Multiplayer](#step-6-optional-enable-multiplayer) for how to enable support for multiple users/profiles. zoffline also offers riding against ghosts (your previous rides). Enable this feature by checking "Enable ghosts" in zoffline's launcher. See https://github.com/zoffline/zwift-offline/issues/56 for extra details. From 7ee8d7d758dd283b9023b80970bcb2a258b113c5 Mon Sep 17 00:00:00 2001 From: zoffline Date: Fri, 18 Dec 2020 20:23:21 -0500 Subject: [PATCH 13/13] Fix indentation in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9237b91..a90bfa6 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ To obtain your current profile: * Move the resulting ``strava_token.txt`` (saved in whatever directory you ran ``strava_auth.py`` in) into the ``storage/`` directory. * If multiplayer is enabled, use the upload button in the launcher window to import your file. -
+
### Step 5 [OPTIONAL]: Upload activities to Garmin Connect @@ -224,7 +224,7 @@ To obtain your current profile: * Note: this is not secure. Only do this if you are comfortable with your login credentials being stored in a clear text file. * If multiplayer is enabled, use the upload button in the launcher window to encrypt the credentials file. -
+
### Step 6 [OPTIONAL]: Enable multiplayer @@ -238,7 +238,7 @@ To enable support for multiple users perform the steps below. zoffline's previou * Start Zwift and create an account in the new Zwift launcher and upload your ``profile.bin``, ``strava_credentials.txt``, and/or ``garmin_credentials.txt`` if you have them. * This account will only exist on your zoffline server and has no relation with your actual Zwift account. -
+
### Extra optional steps
Expand