Skip to content

Commit

Permalink
disable google
Browse files Browse the repository at this point in the history
  • Loading branch information
v00g100skr committed May 26, 2024
1 parent 13c89ff commit 56495ef
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions deploy/websocket_server/websocket_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ async def echo(websocket, path):
"country": country,
}

tracker = shared_data.trackers[f"{client_ip}_{client_port}"] = GtagMP(
api_secret=api_secret, measurement_id=measurement_id, client_id="temp_id"
)
#tracker = shared_data.trackers[f"{client_ip}_{client_port}"] = GtagMP(
# api_secret=api_secret, measurement_id=measurement_id, client_id="temp_id"
#)

match path:
case "/data_v1":
Expand Down Expand Up @@ -217,38 +217,38 @@ def split_message(message):
case "firmware":
client["firmware"] = data
parts = data.split("_", 1)
tracker.store.set_user_property("firmware_v", parts[0])
tracker.store.set_user_property("identifier", parts[1])
#tracker.store.set_user_property("firmware_v", parts[0])
#tracker.store.set_user_property("identifier", parts[1])
logger.debug(f"{client_ip}:{client_id} >>> firmware saved")
case "user_info":
json_data = json.loads(data)
for key, value in json_data.items():
tracker.store.set_user_property(key, value)
#tracker.store.set_user_property(key, value)
case "chip_id":
client["chip_id"] = data
tracker.client_id = data
tracker.store.set_session_parameter("session_id", f"{data}_{datetime.now().timestamp()}")
tracker.store.set_user_property("user_id", data)
tracker.store.set_user_property("chip_id", data)
tracker.store.set_user_property("country", country)
tracker.store.set_user_property("region", region)
tracker.store.set_user_property("city", city)
tracker.store.set_user_property("ip", client_ip)
online_event = tracker.create_new_event("status")
online_event.set_event_param("online", "true")
tracker.send(events=[online_event], date=datetime.now())
#tracker.client_id = data
#tracker.store.set_session_parameter("session_id", f"{data}_{datetime.now().timestamp()}")
#tracker.store.set_user_property("user_id", data)
#tracker.store.set_user_property("chip_id", data)
#tracker.store.set_user_property("country", country)
#tracker.store.set_user_property("region", region)
#tracker.store.set_user_property("city", city)
#tracker.store.set_user_property("ip", client_ip)
#online_event = tracker.create_new_event("status")
#online_event.set_event_param("online", "true")
#tracker.send(events=[online_event], date=datetime.now())
logger.debug(f"{client_ip}:{client_id} >>> chip_id saved")
case "pong":
ping_event = tracker.create_new_event("ping")
ping_event = #tracker.create_new_event("ping")
ping_event.set_event_param("state", "alive")
tracker.send(events=[ping_event], date=datetime.now())
#tracker.send(events=[ping_event], date=datetime.now())
logger.debug(f"{client_ip}:{client_id} >>> ping analytics sent")
case "settings":
json_data = json.loads(data)
settings_event = tracker.create_new_event("settings")
settings_event = #tracker.create_new_event("settings")
for key, value in json_data.items():
settings_event.set_event_param(key, value)
tracker.send(events=[settings_event], date=datetime.now())
#tracker.send(events=[settings_event], date=datetime.now())
logger.debug(f"{client_ip}:{client_id} >>> settings analytics sent")
case _:
logger.debug(f"{client_ip}:{client_id} !!! unknown data request")
Expand All @@ -257,9 +257,9 @@ def split_message(message):
except Exception as e:
pass
finally:
offline_event = tracker.create_new_event("status")
offline_event.set_event_param("online", "false")
tracker.send(events=[offline_event], date=datetime.now())
#offline_event = tracker.create_new_event("status")
#offline_event.set_event_param("online", "false")
#tracker.send(events=[offline_event], date=datetime.now())
data_task.cancel()
del shared_data.trackers[f"{client_ip}_{client_port}"]
del shared_data.clients[f"{client_ip}_{client_port}"]
Expand Down

0 comments on commit 56495ef

Please sign in to comment.