flutter_hooks
flutter_hooks copied to clipboard
Expanding the documentation
I've been doing things with Hooks a lot over the past few months, and it's been really fun to learn about the inner mechanisms of flutter_hooks.
The goal of this PR is to flesh out a few of the API descriptions and to tweak the wording in a few places for better accuracy.
Summary by CodeRabbit
- Documentation
- Updated comments for the
Hookclass to clarify its functionality and usage. - Revised descriptions for the
createStateandshouldRebuildmethods to enhance understanding. - Clarified the role of
HookStateandHookElementin managing hook states. - Adjusted documentation for
HookWidgetandStatefulHookWidgetto highlight their similarities to standard widgets. - Improved clarity on the
useContextfunction's behavior and error handling.
- Updated comments for the
I had heard that this might happen. And it might include that the new SignalrCore endpoints at least partially require authentication. I haven't looked at this yet, so I'm not sure if this is actually the case now.
I will try to look into this, but this is somewhat complicated by the fact that, at least partially, I need to do debugging and development while a session is running.
I would assume that live timing is not the most important feature, given that the data after each race is readily accessible. If someone has a use case were they really need live timing, please let me know.
Yeah, I wondered when it would stop too. But like I said it is partially in use, at least the old method still works in practice sessions. It may stop working entirely soon.
From my brief investigation at the live timing app a connection id can be acquired relatively easily, however I am not sure how the auth token was generated. The session finished before I could look closer. Personally, and this has been the case since I started using your app a few years back, the live timing functionality has been the standout feature.
Authentication will most likely require login with an F1 TV Access subscription.
But using the live timing recording does not really give you any advantage except that you have the data available a few minutes earlier. Is this the advantage for you or do you have another use case where you need to get the data live?
Yep, that's the advantage in our case. Real time updating.
FYI, I have had a superficial look at this and I think I know how to properly authenticate the SignalR client. But I'll be unable to work on this this weekend. Please let me know if you observe any changes.
Oh wow, thanks for looking into this. I'll check myself on sunday.
Small update on this. I'll need at least one session where I have time to investigate this while the session is running. Chances are decent that I can look into this on the upcoming race weekend.
Authentication will likely require a companion browser addon and manual sign in. I have a very rough proof of concept for that working. Unsurprisingly, there's decent bot detection for the login, so the human in the loop will likely be necessary. This will make headless operation more complicated, but we'll need to live with that.
I have finally managed to get a prototype released for testing that allows signing in with your F1 TV account. I'd be very grateful if some people can already test the sign-in flow before the next race weekend.
Installing
To test this, first upgrade to the latest release of FastF1 and then install the pre-release version.
pip install --upgrade fastf1
pip install fastf1==3.7.0a0
Usage
When you now run the live timing client, FastF1 will ask you to sign in with your F1 Account.
There is also a new command line interface to manage signing in and out.
python -m fastf1 f1auth --authenticatewill start the sign-in flowpython -m fastf1 f1auth --clearwill delete the locally stored authentication tokenpython -m fastf1 f1auth --statuswill show some information about the current authentication token
The authentication flow will ask you to open a link in your browser to sign in. A FastF1 companion browser extension is required for the sign in (only Firefox, Chrome coming soon). If you don't have the extension installed, you will be directed to a page that links to the browser's extension marketplace.
Important Info
- The sign-in token is stored globally for all instances of FastF1/virtual environments/....
- Sign-in requires a browser extension to grab the authentication token for your account after sign-in. There is no possibility for a headless sign-in. F1 use very strict anti bot measures that require a proper rendered web view with JavaScript support for the sign-in.
- The companion extension is only available for Firefox right now. Chrome and Chromium based browsers will be supported soon. This is my first time developing a browser extension, and I got caught up in some incompatibilities between these browsers. But I decided I'll just share what I have for now.
- The sign-in flow will likely change a bit still, to accommodate restrictions that Chrome imposes on extensions.
- The command line interface is still subject to change.
- You may need to start recording 1 HOUR BEFORE THE RACE to get all necessary data. This still needs to be tested. Starting very early with a long timeout is likely the preferred way to go for now.
Please leave feedback/comments/suggestions, even if everything works.
@theOehrly Authentication flow worked well for me.
- I downloaded and installed Firefox
- Installed the FastF1 Companion extension
- Pip upgraded to FastF1 v3.7
- Initiated the CLI flow with
python -m fastf1 f1auth --authenticate - Logged into my F1 Live Timing account
- Got confirmation from the FastF1 extension that I was logged in
- Validated the log in via the CLI
Looking forward to testing live timing this weekend. Thanks!
I was able to get data from all the topics I wanted during FP3: RaceControlMessages, SessionInfo, ArchiveStatus, SessionStatus, TimingAppData, TimingData, WeatherData. I didn't try unauthenticated and removing my token to see if it would break it because I was too busy debugging my own scripts, but I didn't get anything unexpected so far.
@hburgoyne awesome, thanks for the feedback. How early did you start recording?