Add variant route

This commit is contained in:
oldnapalm
2021-09-16 08:29:27 -03:00
parent 7b01b11290
commit e5ca8e3fbc
4 changed files with 162 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ all:
protoc --python_out=. tcp-node-msgs.proto
protoc --python_out=. hash-seeds.proto
protoc --python_out=. events.proto
protoc --python_out=. variants.proto
clean:
rm -f *_pb2.py *_pb2.pyc
+9
View File
@@ -0,0 +1,9 @@
syntax = "proto2";
message Variant {
required string name = 1;
optional uint32 value = 2;
}
message Variants {
repeated Variant variants = 1;
}
+118
View File
@@ -0,0 +1,118 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: variants.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='variants.proto',
package='',
syntax='proto2',
serialized_options=None,
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0evariants.proto\"&\n\x07Variant\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\r\n\x05value\x18\x02 \x01(\r\"&\n\x08Variants\x12\x1a\n\x08variants\x18\x01 \x03(\x0b\x32\x08.Variant'
)
_VARIANT = _descriptor.Descriptor(
name='Variant',
full_name='Variant',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='Variant.name', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='Variant.value', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=18,
serialized_end=56,
)
_VARIANTS = _descriptor.Descriptor(
name='Variants',
full_name='Variants',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='variants', full_name='Variants.variants', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=58,
serialized_end=96,
)
_VARIANTS.fields_by_name['variants'].message_type = _VARIANT
DESCRIPTOR.message_types_by_name['Variant'] = _VARIANT
DESCRIPTOR.message_types_by_name['Variants'] = _VARIANTS
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
Variant = _reflection.GeneratedProtocolMessageType('Variant', (_message.Message,), {
'DESCRIPTOR' : _VARIANT,
'__module__' : 'variants_pb2'
# @@protoc_insertion_point(class_scope:Variant)
})
_sym_db.RegisterMessage(Variant)
Variants = _reflection.GeneratedProtocolMessageType('Variants', (_message.Message,), {
'DESCRIPTOR' : _VARIANTS,
'__module__' : 'variants_pb2'
# @@protoc_insertion_point(class_scope:Variants)
})
_sym_db.RegisterMessage(Variants)
# @@protoc_insertion_point(module_scope)
+34
View File
@@ -44,6 +44,7 @@ import protobuf.world_pb2 as world_pb2
import protobuf.zfiles_pb2 as zfiles_pb2
import protobuf.hash_seeds_pb2 as hash_seeds_pb2
import protobuf.events_pb2 as events_pb2
import protobuf.variants_pb2 as variants_pb2
import online_sync
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
@@ -1984,6 +1985,39 @@ def auth_realms_zwift_tokens_access_codes():
return FAKE_JWT, 200
@app.route('/experimentation/v1/variant', methods=['POST'])
def experimentation_v1_variant():
variant_list = [('game_1_12_pc_skip_activity_save_retry', None),
('return_to_home', 1),
('game_1_12_nhd_v1', 1),
('game_1_13_japanese_medium_font', 1),
('game_1_12_1_retire_client_chat_culling', 1),
('game_1_14_draftlock_fix', None),
('xplatform_partner_connection_vitality', None),
('game_1_16_new_route_ui', 1),
('pack_dynamics_30_global', None),
('pack_dynamics_30_makuri', None),
('pack_dynamics_30_london', None),
('pack_dynamics_30_watopia', None),
('pack_dynamics_30_exclude_events', None),
('game_1_17_server_connection_notifications', None),
('zc_ios_aug_2021_release_sync', None),
('game_1_16_2_ble_alternate_unpair_all_paired_devices', 1),
('game_1_17_game_client_activity_event', None),
('game_1_17_tdf_femmes_yellow_jersey', None),
('game_1_17_ble_disable_component_sport_filter', None),
('game_1_15_assert_disable_abort', 1),
('game_1_14_settings_refactor', None)]
variants = variants_pb2.Variants()
for variant in variant_list:
item = variants.variants.add()
item.name = variant[0]
if variant[1] is not None:
item.value = variant[1]
return variants.SerializeToString(), 200
def run_standalone(passed_online, passed_global_pace_partners, passed_global_bots, passed_global_ghosts, passed_ghosts_enabled, passed_save_ghost, passed_player_update_queue, passed_discord):
global online
global global_pace_partners