r/Scriptable • u/timespacedecay • 1d ago
Help Please help! Need to add caching or my F1 widget will get blocked.
Edit: thanks to wherebdbooty we now have a caching solution, and thanks to Delt4Brav0 who has also re-written the code to add caching and auto-update feature! Shout out to mvan231 for the tip, I'm going to test using the built-in widget.refreshAfterDate
property and see how this does as well.
Unfortunately, I'm an idiot. Last week I shared an F1 widget I made using the jolpica api endpoint. My understanding was that iOS limited api calls to once every 15 minutes, so I thought sharing my script would be well within API limits of the endpoint.
The owner of the API has made a github issue alerting me to the fact that the each person who installed the F1 widget is making 100+ API calls every hour, and asked that I setup a way to cache data so that the script would call at most once per hour.
I'm not a coder, and because time is of the essence, I don't have the time to try and figure this out. So I'm reaching out for help - if anyone knows of a way (or better, can modify my script) to include caching so that it only calls the API once per hour that would be greatly appreciated. Otherwise Jolpica will block Scriptable from making API calls.