@Bauke can you give it a try before I merge it back into develop?
Seems fine to me to be honest. The logic is simple enough.
On options, the first time this will be released, it will check for the customCss feature. If it's enabled it will add a new field "lastPull" in the settings that is a timestamp in ms.
From that moment and on, when the feature is enabled, the lastPull is updated with the timestamp of when it was enabled.
In the script that apply the custom CSS, everytime it loads (so effectively when it's needed), before applying the script we check for:
the feature is enabled
there are external URL to potentially update
The lastPull is older than 24h
If all these conditions are truthy, I ran an asynchronous request for every external URL I get, once completed, update the localstorage with the new source and apply it to the page. Also updating the lastPull with the new timestamp.
@Bauke can you give it a try before I merge it back into develop?
Seems fine to me to be honest. The logic is simple enough.
On options, the first time this will be released, it will check for the customCss feature. If it's enabled it will add a new field "lastPull" in the settings that is a timestamp in ms.
From that moment and on, when the feature is enabled, the lastPull is updated with the timestamp of when it was enabled.
In the script that apply the custom CSS, everytime it loads (so effectively when it's needed), before applying the script we check for:
If all these conditions are truthy, I ran an asynchronous request for every external URL I get, once completed, update the localstorage with the new source and apply it to the page. Also updating the lastPull with the new timestamp.