From cec119c5487c22c853382e551bc4171b73cf95f4 Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Tue, 17 Sep 2024 14:06:03 +0100 Subject: [PATCH] fix(backend): temporarily disable reject proxy as it is broken --- backend/aci/proxy.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/backend/aci/proxy.py b/backend/aci/proxy.py index 5168188..cc67738 100644 --- a/backend/aci/proxy.py +++ b/backend/aci/proxy.py @@ -20,28 +20,28 @@ def make_client_session(): @router.get('/reject') async def reject_proxy(date: str, time: str, activity: str, space: str): """We proxy the rejectdopamine API to maintain user pivacy (the extension does not transmit user IP addresses to third-party services)""" - async with make_client_session() as session: - async with session.get('https://rejectdopamine.com/api/app/active/yrk/cs/1') as resp: - response = await resp.json() - activities = [] - if 'sessions' not in response: - return { - 'date': date, - 'time': time, - 'space': space, - 'activity': activity, - 'codes': [], - } - for session in response['sessions']: - if reformat_reject_date(session['startDate']) == date and time == f'{session["startTime"]} - {session["endTime"]}' and session['location'] in space: - # Likely a correct result, let's return it - return { - 'date': date, - 'time': time, - 'space': space, - 'activity': activity, - 'codes': list(map(lambda c: {'code': f'{c["checkinCode"]:06}', 'score': 0}, session['codes'])) - } + # async with make_client_session() as session: + # async with session.get('https://rejectdopamine.com/api/app/active/yrk/cs/1') as resp: + # response = await resp.json() + # activities = [] + # if 'sessions' not in response: + # return { + # 'date': date, + # 'time': time, + # 'space': space, + # 'activity': activity, + # 'codes': [], + # } + # for session in response['sessions']: + # if reformat_reject_date(session['startDate']) == date and time == f'{session["startTime"]} - {session["endTime"]}' and session['location'] in space: + # # Likely a correct result, let's return it + # return { + # 'date': date, + # 'time': time, + # 'space': space, + # 'activity': activity, + # 'codes': list(map(lambda c: {'code': f'{c["checkinCode"]:06}', 'score': 0}, session['codes'])) + # } return { 'date': date, 'time': time,