Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve skin downloading: load from
downloadedskins
if possible
Previously, skins not found in the `skins` folder were downloaded from the configured URL and saved to the `downloadedskins` folder, but the saved files were never used, leading to wasted downloads and write operations. Now, if a skin to be downloaded already exists in the `downloadedskins` folder, the modified time of the skin file is determined and a HTTP HEAD request is sent to the skin download URL to determine when the skin to be downloaded was last modified. The times are compared with each other and if the local file is already up-to-date, it will be loaded directly. The skin will be downloaded with a HTTP GET request, if the response to the HEAD request does not contain a modified time, if the local file is older than the modified time, or if the local file is more recent but failed to be loaded. If a skin could not be downloaded when it should but a file already exists in the `downloadedskins` folder then that file will be loaded as well. Instead of checking whether the number of skins is different to determine whether to reload the list of skins in the settings menus, the last time that the list of skins was refreshed is now saved and compared, which is more robust. The additional check to refresh the skin list while skins are being downloaded is unnecessary, as any updates to the skin list are now covered by checking the last refresh time.
- Loading branch information