diff --git a/protobuf/world.proto b/protobuf/world.proto index d3cc788..656abd5 100644 --- a/protobuf/world.proto +++ b/protobuf/world.proto @@ -11,3 +11,8 @@ message World { message Worlds { repeated World worlds = 1; } + +message WorldAttributes { + /* repeated RiderAttributes riders = 1; */ + required int64 world_time = 2; +} diff --git a/protobuf/world_pb2.py b/protobuf/world_pb2.py index 97b3efa..4423bd2 100644 --- a/protobuf/world_pb2.py +++ b/protobuf/world_pb2.py @@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor( name='world.proto', package='', syntax='proto2', - serialized_pb=_b('\n\x0bworld.proto\"`\n\x05World\x12\n\n\x02id\x18\x01 \x02(\r\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\n\n\x02\x66\x33\x18\x03 \x02(\r\x12\n\n\x02\x66\x35\x18\x05 \x02(\x04\x12\x12\n\nworld_time\x18\x06 \x02(\x04\x12\x11\n\treal_time\x18\x07 \x02(\x04\" \n\x06Worlds\x12\x16\n\x06worlds\x18\x01 \x03(\x0b\x32\x06.World') + serialized_pb=_b('\n\x0bworld.proto\"`\n\x05World\x12\n\n\x02id\x18\x01 \x02(\r\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\n\n\x02\x66\x33\x18\x03 \x02(\r\x12\n\n\x02\x66\x35\x18\x05 \x02(\x04\x12\x12\n\nworld_time\x18\x06 \x02(\x04\x12\x11\n\treal_time\x18\x07 \x02(\x04\" \n\x06Worlds\x12\x16\n\x06worlds\x18\x01 \x03(\x0b\x32\x06.World\"%\n\x0fWorldAttributes\x12\x12\n\nworld_time\x18\x02 \x02(\x03') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -122,9 +122,41 @@ _WORLDS = _descriptor.Descriptor( serialized_end=145, ) + +_WORLDATTRIBUTES = _descriptor.Descriptor( + name='WorldAttributes', + full_name='WorldAttributes', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='world_time', full_name='WorldAttributes.world_time', index=0, + number=2, type=3, cpp_type=2, label=2, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=147, + serialized_end=184, +) + _WORLDS.fields_by_name['worlds'].message_type = _WORLD DESCRIPTOR.message_types_by_name['World'] = _WORLD DESCRIPTOR.message_types_by_name['Worlds'] = _WORLDS +DESCRIPTOR.message_types_by_name['WorldAttributes'] = _WORLDATTRIBUTES World = _reflection.GeneratedProtocolMessageType('World', (_message.Message,), dict( DESCRIPTOR = _WORLD, @@ -140,5 +172,12 @@ Worlds = _reflection.GeneratedProtocolMessageType('Worlds', (_message.Message,), )) _sym_db.RegisterMessage(Worlds) +WorldAttributes = _reflection.GeneratedProtocolMessageType('WorldAttributes', (_message.Message,), dict( + DESCRIPTOR = _WORLDATTRIBUTES, + __module__ = 'world_pb2' + # @@protoc_insertion_point(class_scope:WorldAttributes) + )) +_sym_db.RegisterMessage(WorldAttributes) + # @@protoc_insertion_point(module_scope) diff --git a/zwift_offline.py b/zwift_offline.py index 2e945cb..78ff99b 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -408,7 +408,12 @@ def relay_worlds_my_hash_seeds(world_id): return '[{"expiryDate":196859639979,"seed1":-733221030,"seed2":-2142448243},{"expiryDate":196860425476,"seed1":1528095532,"seed2":-2078218472},{"expiryDate":196862212008,"seed1":1794747796,"seed2":-1901929955},{"expiryDate":196862637148,"seed1":-1411883466,"seed2":1171710140},{"expiryDate":196863874267,"seed1":670195825,"seed2":-317830991}]' -# XXX: relay/worlds//attributes not implemented. seems okay with a 404 +# XXX: attributes have not been thoroughly investigated +@app.route('/relay/worlds//attributes', methods=['POST']) +def relay_worlds_attributes(world_id): + attribs = world_pb2.WorldAttributes() + attribs.world_time = world_time() + return attribs.SerializeToString(), 200 @app.route('/relay/periodic-info', methods=['GET'])