ghamry03 / ft_transcendence

0 stars 0 forks source link

Major Changes All Around #20

Closed karimomino closed 7 months ago

karimomino commented 7 months ago

this has been tested on dev only after the changes ghamry03 did. Will retest on prod soon.

MehrinFirdousi commented 7 months ago

I noticed that localhost:3000/ or 127.0.0.1:3000/ is still being used in some files.

  1. This is the old port
  2. This hardcodes the HTTP and won't work in prod Please change them to use MEDIA_SERVICE_URL from constants.py
MehrinFirdousi commented 7 months ago

@ghamry03 Error with renewing the token:

Internal Server Error: /renew_token/
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/main_app/login/views.py", line 68, in renew_token
    'refresh_token': (None, request.session['refresh_token']),
                            ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/contrib/sessions/backends/base.py", line 53, in __getitem__
    return self._session[key]
           ~~~~~~~~~~~~~^^^^^
KeyError: 'refresh_token'
[18/Mar/2024 12:36:31] "GET /renew_token/ HTTP/1.1" 500 145
[18/Mar/2024 12:36:31] "GET /login/ HTTP/1.1" 200 635
MehrinFirdousi commented 7 months ago

Friends list issues -

MehrinFirdousi commented 7 months ago

Minor UI issues that can be fixed in a future PR -

MehrinFirdousi commented 7 months ago

Protect all API calls, currently if any of the services fail, mainapp also fails

    friendsList = requests.get(
        'http://friendsapp:8002/' + "api/friends/",
        headers=headers,
        json={
            "uid": f"{uid}",
            "ownerUID": f"{uid}",
            "access_token": request.session['access_token']
            },
    ).json()

    tournamentHistory = requests.get(
        TOURNAMENT_HISOTRY_URL + "api/tourhistory/" + f'{uid}'
    ).json()