From 515583c60f6705bd2478a7f7de4d43b37ec9adff Mon Sep 17 00:00:00 2001 From: oldnapalm <38410858+oldnapalm@users.noreply.github.com> Date: Mon, 12 Aug 2024 16:52:01 -0300 Subject: [PATCH] Add disable_zoffline.bat --- README.md | 8 ++++---- scripts/configure_client.bat | 4 ++-- scripts/disable_zoffline.bat | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 scripts/disable_zoffline.bat diff --git a/README.md b/README.md index 21ecccc8..68141a16 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ To install zoffline on Windows: * 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 the downloaded zoffline.exe * Once run, zoffline will create a ``storage`` directory in the same folder it's in to store your Zwift progress. -* Start Zwift with zoffline.exe running (__after completing step 2__ or running __configure_client__ script from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper) +* Start Zwift with zoffline.exe running (__after completing step 2__ or running __configure_client__ script from https://github.com/oldnapalm/zoffline-helper/releases/latest) * It takes zoffline a few seconds to start. Wait until text appears in the command prompt before opening Zwift. * When done with Zwift, press Ctrl+C in the command line to close zoffline. @@ -100,7 +100,7 @@ zoffline can be installed on the same machine as Zwift or another local machine. * If Zwift is not installed, install it before installing zoffline. * If your Zwift version is newer than 1.0.133616 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.133616 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 +* __NOTE:__ instead of performing the steps below you can instead just run the __configure_client__ script from https://github.com/oldnapalm/zoffline-helper/releases/latest * On your Windows machine running Zwift, copy the following files in this repo to a known location: * [ssl/cert-zwift-com.p12](https://github.com/zoffline/zwift-offline/raw/master/ssl/cert-zwift-com.p12) * [ssl/cert-zwift-com.pem](https://github.com/zoffline/zwift-offline/raw/master/ssl/cert-zwift-com.pem) @@ -219,7 +219,7 @@ To obtain your current profile: * __NOTE:__ instead of performing the steps below you can instead use the "Settings - Zwift" button in the launcher window (Windows and macOS only). * Ensure zoffline is disabled. * Run ``scripts/get_profile.py -u `` - * Or, if using the Windows zoffline.exe version without Python installed you can run ``get_profile.exe`` obtained from https://github.com/zoffline/zwift-offline/releases/tag/zoffline_helper in place of ``scripts/get_profile.py`` + * Or, if using the Windows zoffline.exe version without Python installed you can run ``get_profile.exe`` obtained from https://github.com/oldnapalm/zoffline-helper/releases/latest in place of ``scripts/get_profile.py`` * Move the resulting ``profile.bin``, ``achievements.bin`` and ``economy_config.txt`` (saved in whatever directory you ran get_profile.py in) into the ``storage/1`` directory. * If using zoffline.exe on Windows, create a ``storage/1`` directory within the same folder as zoffline.exe if it does not already exist. * If using Docker, the directory ``1`` should be in the path you passed to ``-v`` @@ -233,7 +233,7 @@ To obtain your current profile: * Get CLIENT_ID and CLIENT_SECRET from https://www.strava.com/settings/api * __NOTE:__ instead of performing the steps below you can instead set the authorization callback domain of your API application to ``launcher.zwift.com`` and use the "Settings - Strava" button in the launcher window (Windows and macOS only). * Run ``scripts/strava_auth.py --client-id CLIENT_ID --client-secret CLIENT_SECRET`` - * 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`` + * Or, if using the Windows zoffline.exe version without Python installed you can run ``strava_auth.exe`` obtained from https://github.com/oldnapalm/zoffline-helper/releases/latest in place of ``scripts/strava_auth.py`` * 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/1`` directory. * If testing, ride at least 300 meters, shorter activities won't be uploaded. diff --git a/scripts/configure_client.bat b/scripts/configure_client.bat index 7d3ba72c..c28703a5 100644 --- a/scripts/configure_client.bat +++ b/scripts/configure_client.bat @@ -5,8 +5,6 @@ ECHO. NET SESSION >nul 2>&1 || ( PowerShell start -verb runas '%~0' & EXIT /B ) -CD /D "%~dp0" - SET HOSTS="%WINDIR%\system32\drivers\etc\hosts" COPY %HOSTS% %HOSTS%.bak >nul TYPE %HOSTS%.bak | FINDSTR /V /I zwift > %HOSTS% @@ -164,4 +162,6 @@ IF %ERRORLEVEL% NEQ 0 ( ECHO. +TASKKILL /F /IM ZwiftLauncher.exe >nul 2>&1 + PAUSE diff --git a/scripts/disable_zoffline.bat b/scripts/disable_zoffline.bat new file mode 100644 index 00000000..c9230d9d --- /dev/null +++ b/scripts/disable_zoffline.bat @@ -0,0 +1,15 @@ +@ECHO OFF +TITLE disable_zoffline + +NET SESSION >nul 2>&1 || ( PowerShell start -verb runas '%~0' & EXIT /B ) + +SET HOSTS="%WINDIR%\system32\drivers\etc\hosts" +COPY %HOSTS% %HOSTS%.bak >nul +ECHO Removing servers from hosts file +TYPE %HOSTS%.bak | FINDSTR /V /I zwift > %HOSTS% + +ECHO. + +TASKKILL /F /IM ZwiftLauncher.exe >nul 2>&1 + +PAUSE