Skip to content

Commit

Permalink
Merge branch 'zoffline:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm authored Oct 1, 2024
2 parents e80c989 + 6e04e4d commit 5702157
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 69 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ zoffline can be installed on the same machine as Zwift or another local machine.
<details><summary>Windows Instructions</summary>

* Install Zwift
* If your Zwift version is 1.0.135346, you're all set.
* If your Zwift version is 1.0.135522, you're all set.
* If Zwift is not installed, install it before installing zoffline.
* If your Zwift version is newer than 1.0.135346 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.135346 and zoffline is not running from source: wait for zoffline to be updated.
* If your Zwift version is newer than 1.0.135522 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.135522 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/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)
Expand All @@ -124,9 +124,9 @@ to generate your own certificates and do the same.
<details><summary>macOS Instructions</summary>

* Install Zwift
* If your Zwift version is 1.0.135346, you're all set.
* If your Zwift version is 1.0.135522, you're all set.
* If Zwift is not installed, install it before installing zoffline.
* If your Zwift version is newer than 1.0.135346: 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.135522: 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 file [ssl/cert-zwift-com.pem](https://github.com/zoffline/zwift-offline/raw/master/ssl/cert-zwift-com.pem) in this repo to a known location.
* Open Keychain Access, select "System" under "Keychains", select "Certificates" under "Category"
* Click "File - Import Items..." and import cert-zwift-com.pem
Expand Down
2 changes: 1 addition & 1 deletion cdn/gameassets/Zwift_Updates_Root/ZwiftMac_ver_cur.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Zwift version="1.0.135346" sversion="1.74.2 (135346)" gbranch="rc/1.74.2" gcommit="cee9bc1a0695188de219a22cd80558aa1305ad14" GAME_URL="https://us-or-rly101.zwift.com" manifest="ZwiftMac_1.0.135346_5ea34d1d_manifest.xml" manifest_checksum="-152007760" ver_cur_checksum="1636541751"/>
<Zwift version="1.0.135522" sversion="1.75.0 (135522)" gbranch="rc/1.75.0" gcommit="8ae443ecd463479b622a0dd567a12fc63e1364fe" GAME_URL="https://us-or-rly101.zwift.com" manifest="ZwiftMac_1.0.135522_0b195230_manifest.xml" manifest_checksum="26082961" ver_cur_checksum="-1668066900"/>
2 changes: 1 addition & 1 deletion cdn/gameassets/Zwift_Updates_Root/Zwift_ver_cur.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<Zwift version="1.0.135346" sversion="1.74.2 (135346)" gbranch="rc/1.74.2" gcommit="cee9bc1a0695188de219a22cd80558aa1305ad14" GAME_URL="https://us-or-rly101.zwift.com" manifest="Zwift_1.0.135346_5ea34d1d_manifest.xml" manifest_checksum="-798143194" ver_cur_checksum="-866057058"/>
<Zwift version="1.0.135522" sversion="1.75.0 (135522)" gbranch="rc/1.75.0" gcommit="8ae443ecd463479b622a0dd567a12fc63e1364fe" GAME_URL="https://us-or-rly101.zwift.com" manifest="Zwift_1.0.135522_0b195230_manifest.xml" manifest_checksum="-1024030966" ver_cur_checksum="392804262"/>
4 changes: 4 additions & 0 deletions data/climbs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,9 @@
{
"name": "Ski Lift Climb (8.6 km / 689 m)",
"road": "10000"
},
{
"name": "Trollstigen (12.4 km / 784 m)",
"road": "10037"
}
]
12 changes: 12 additions & 0 deletions data/entitlements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -570,5 +570,17 @@
{
"id": 1829,
"name": "ENTITLEMENT_CYCLING_JERSEY_EVENTS_ZWIFT10YANNIVERSARY2024"
},
{
"id": 1830,
"name": "ENTITLEMENT_GLASSES_OAKLEYKATOGLASSES"
},
{
"id": 1831,
"name": "ENTITLEMENT_CYCLING_JERSEY_EVENTS_ZWIFTCAMPBASELINE2024"
},
{
"id": 1832,
"name": "ENTITLEMENT_WHEELS_ZWIFTCAMPBASELINE2024"
}
]
9 changes: 8 additions & 1 deletion data/events.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@
"course": 2,
"sport": 0
},
{
"name": "Scotland - BRAEk-fast Crits and Grits",
"route": 377566656,
"distance": 22144.7,
"course": 17,
"sport": 0
},
{
"name": "Scotland - Glasgow Reverse",
"route": 1258415487,
Expand Down Expand Up @@ -261,7 +268,7 @@
{
"name": "Watopia - Italian Villas Circuit",
"route": 3573087582,
"distance": 2714.5,
"distance": 4342.4,
"course": 6,
"sport": 1
},
Expand Down
2 changes: 1 addition & 1 deletion data/game_info.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions data/start_lines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,11 @@
"road": 0,
"time": 209509
},
"377566656": {
"name": "Scotland - BRAEk-fast Crits and Grits",
"road": 3,
"time": 366100
},
"-187217705": {
"name": "Scotland - City and the Sgurr",
"road": 3,
Expand Down
41 changes: 40 additions & 1 deletion data/variants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
"values": {
"fields": {
"shortNames": {
"stringValue": "tomi2022,tdz2023ride,tdz2023run,tow2023ride,tow2023run,portaltest2,climbportal2023,missyuci,towfall2023ride,climbportaltest3,za2023,towfall2023run,tdz2024ride,tdz2024run,tbs2024ride,springtraining2024,climbportal2024,zwiftacademy2024,zwiftcampbaseline2024"
"stringValue": "tomi2022,tdz2023ride,tdz2023run,tow2023ride,tow2023run,portaltest2,climbportal2023,missyuci,towfall2023ride,climbportaltest3,za2023,towfall2023run,tdz2024ride,tdz2024run,tbs2024ride,springtraining2024,climbportal2024,zwiftacademy2024,zwiftcampbaseline2024,tow2024ride"
}
}
}
Expand Down Expand Up @@ -1318,6 +1318,7 @@
},
{
"name": "game_1_74_0_robopacer_10_year_anniversary",
"value": true,
"values": {}
},
{
Expand All @@ -1333,6 +1334,33 @@
"name": "game_1_74_zp_manual_calibration",
"values": {}
},
{
"name": "game_1_75_0_friend_dropin_and_scrolling_hud_messages",
"value": true,
"values": {
"fields": {
"friend_dropped_in_message_enabled": {
"boolValue": false
},
"scrolling_hud_messages": {
"boolValue": true
}
}
}
},
{
"name": "game_1_75_bypass_zpe",
"values": {}
},
{
"name": "game_1_75_fix_pause_button_position",
"value": true,
"values": {}
},
{
"name": "game_1_75_sweeper_check",
"values": {}
},
{
"name": "game_1_76_bike_leveling",
"values": {
Expand Down Expand Up @@ -1503,6 +1531,10 @@
"value": true,
"values": {}
},
{
"name": "game_disable_cached_subgroup_protobuf",
"values": {}
},
{
"name": "game_dlc",
"value": true,
Expand Down Expand Up @@ -1551,6 +1583,10 @@
"name": "game_end_game_session",
"values": {}
},
{
"name": "game_fireworks",
"values": {}
},
{
"name": "game_garage_gearing",
"values": {}
Expand All @@ -1576,6 +1612,9 @@
"game_minimap_graph_update": {
"boolValue": true
},
"minimap_use_only_good_routes": {
"boolValue": true
},
"optimized_tss_calculation": {
"boolValue": true
},
Expand Down
6 changes: 5 additions & 1 deletion protobuf/profile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ message PlayerProfile {
}

message PlayerProfiles {
repeated PlayerProfile profiles = 1;
repeated PlayerProfile profiles = 1;
}

message ProfileEntitlement {
Expand Down Expand Up @@ -247,6 +247,10 @@ message ProfileEntitlement {
repeated Platform platforms = 14;
}

message ProfileEntitlements {
repeated ProfileEntitlement entitlements = 1;
}

enum FollowStatus {
FOLLOWSTATUS0 = 0;
UNKNOWN = 1;
Expand Down
72 changes: 37 additions & 35 deletions protobuf/profile_pb2.py

Large diffs are not rendered by default.

59 changes: 36 additions & 23 deletions zwift_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1743,29 +1743,14 @@ def bikeFrameToStr(val):
return GD['bikeframes'][val]
return "---"

def do_api_profiles(profile_id, is_json):
profile = profile_pb2.PlayerProfile()
profile_file = '%s/%s/profile.bin' % (STORAGE_DIR, profile_id)
if not os.path.isfile(profile_file):
profile.id = profile_id
profile.email = current_user.username
profile.first_name = current_user.first_name
profile.last_name = current_user.last_name
else:
with open(profile_file, 'rb') as fd:
profile.ParseFromString(fd.read())
profile.id = profile_id
if not profile.email:
profile.email = '[email protected]'
for entitlement in list(profile.entitlements):
if entitlement.type == profile_pb2.ProfileEntitlement.EntitlementType.RIDE:
profile.entitlements.remove(entitlement)
e = profile.entitlements.add()
e.type = profile_pb2.ProfileEntitlement.EntitlementType.RIDE
e.id = -1
e.status = profile_pb2.ProfileEntitlement.ProfileEntitlementStatus.ACTIVE
if not profile.mix_panel_distinct_id:
profile.mix_panel_distinct_id = str(uuid.uuid4())
def update_entitlements(profile):
for entitlement in list(profile.entitlements):
if entitlement.type == profile_pb2.ProfileEntitlement.EntitlementType.RIDE:
profile.entitlements.remove(entitlement)
e = profile.entitlements.add()
e.type = profile_pb2.ProfileEntitlement.EntitlementType.RIDE
e.id = -1
e.status = profile_pb2.ProfileEntitlement.ProfileEntitlementStatus.ACTIVE
if os.path.isfile('%s/unlock_entitlements.txt' % STORAGE_DIR) or os.path.isfile('%s/unlock_all_equipment.txt' % STORAGE_DIR):
with open('%s/data/entitlements.txt' % SCRIPT_DIR) as f:
entitlements = json.load(f)
Expand All @@ -1778,6 +1763,19 @@ def do_api_profiles(profile_id, is_json):
e.type = profile_pb2.ProfileEntitlement.EntitlementType.USE
e.id = entitlement['id']
e.status = profile_pb2.ProfileEntitlement.ProfileEntitlementStatus.ACTIVE

def do_api_profiles(profile_id, is_json):
profile = profile_pb2.PlayerProfile()
profile_file = '%s/%s/profile.bin' % (STORAGE_DIR, profile_id)
if os.path.isfile(profile_file):
with open(profile_file, 'rb') as fd:
profile.ParseFromString(fd.read())
else:
profile.email = current_user.username
profile.first_name = current_user.first_name
profile.last_name = current_user.last_name
profile.mix_panel_distinct_id = str(uuid.uuid4())
profile.id = profile_id
if is_json: #todo: publicId, bodyType, totalRunCalories != total_watt_hours, totalRunTimeInMinutes != time_ridden_in_minutes etc
if profile.dob != "":
profile.age = age(datetime.datetime.strptime(profile.dob, "%m/%d/%Y"))
Expand All @@ -1800,6 +1798,7 @@ def do_api_profiles(profile_id, is_json):
copyAttributes(jprofile, jprofileFull, 'privateAttributes')
return jsonify(jprofile)
else:
update_entitlements(profile)
return profile.SerializeToString(), 200

@app.route('/api/profiles/me', methods=['GET'], strict_slashes=False)
Expand All @@ -1811,6 +1810,20 @@ def api_profiles_me():
else:
return do_api_profiles(current_user.player_id, False)

@app.route('/api/profiles/me/entitlements', methods=['GET'])
@jwt_to_session_cookie
@login_required
def api_profiles_me_entitlements():
profile = profile_pb2.PlayerProfile()
profile_file = '%s/%s/profile.bin' % (STORAGE_DIR, current_user.player_id)
if os.path.isfile(profile_file):
with open(profile_file, 'rb') as fd:
profile.ParseFromString(fd.read())
update_entitlements(profile)
entitlements = profile_pb2.ProfileEntitlements()
entitlements.entitlements.extend(profile.entitlements)
return entitlements.SerializeToString(), 200

@app.route('/api/profiles/<int:profile_id>', methods=['GET'])
@jwt_to_session_cookie
@login_required
Expand Down

0 comments on commit 5702157

Please sign in to comment.