racetimeGG / racetime-app

Application code for racetime.gg
https://racetime.gg
GNU General Public License v3.0
41 stars 20 forks source link

Pending server requirements for LiveSplit #18

Closed steto-scope closed 4 years ago

steto-scope commented 4 years ago

Things I need:

deains commented 4 years ago

@steto-scope I've updated the oauth branch.

An overview of all ongoing races (maybe racetime.gg/data?)

Done - URL is /races/data

Sending a race-data message by the server after connecting the websocket to sync the client

Done. You can also now send back {"action":"getrace"} to recieve the data whenever needed.

An endpoint to obtain user data of myself after authorizing. Currently I can authorize myself but have no idea on who I am. I'd suggest following the OpenID Connect approach and implementing o/userinfo

Done - URL is /o/userinfo - OAuth2 bearer token only. This contains the same data present in user blobs elsehwere (e.g. race.entrants.X.user) plus one additional key - active_race, which will be set to a string identifying the user's current race, if they're in a room (e.g. mmr/salty-ruto-2354).

A page with the success-message after authorization

Not sure what you mean about this? When you successfully auth normally you'd be redirected back to the app that sent you to the OAuth page. In the case of LiveSplit I guess this could be achieved with a livesplit:// URL, or would you just like a page that says "yep cool you can alt+tab now"?

Nice to have: A way to obtain the previous chat history in the chat.message format. Either as separate command or as part of the initial racedata message. I would only need it after a connect/reconnect to the socket

Gonna backburner this for the moment but will look into it later. 👍

steto-scope commented 4 years ago

Not sure what you mean about this? When you successfully auth normally you'd be redirected back to the app that sent you to the OAuth page. In the case of LiveSplit I guess this could be achieved with a livesplit:// URL, or would you just like a page that says "yep cool you can alt+tab now"?

The redirect works and the app gets back into focus itself. But this won't close the tab in the browser. I just need a destination page where to go after successful authorization. This can be just a static site displaying something like "Authorization successful, you can close this tab now" or a already existing page like the startpage. FYI, the redirect is done via HTTP status 301, so it gets immediatelly redirected after the authorization is done

deains commented 4 years ago

Alrighty, I'll add something in.

steto-scope commented 4 years ago

OperationalError at /sm (1054, "Unknown column 'racetime_race.chat_message_delay' in 'field list'")

when selecting a game

deains commented 4 years ago

You need to update your DB migrations - python manage.py migrate

deains commented 4 years ago

Success page added as /o/done. If you go to /o/done?error=access_denied you'll get a "Authorisation cancelled" page instead of "Authorisation successful".

I've tidied up the URLs a bit. Authorize is now /o/authorize and get token is /o/token (no trailing slashes). The websocket endpoints have been split, the user endpoint should no longer be used for OAuth-based authentication. Use /ws/o/race/<slug> now instead.

You can get chat history by sending a {"action":"gethistory"}. As with getrace, you don't need authorization for this.