This turns issues like creating two shared ptrs from a single raw ptr
from popping up at runtime, instead making them a compile error.
Signed-off-by: flow <flowlnlnln@gmail.com>
Firstly, this abstract away behavior in the mod download models that can
also be applied to other types of resources into a superclass, allowing
other resource types to be implemented without so much code duplication.
For that, this also generalizes the APIs used (currently, ModrinthAPI
and FlameAPI) to be able to make requests to other types of resources.
It also does a general cleanup of both of those. In particular, this
makes use of std::optional instead of invalid values for errors and,
well, optional values :p
This is a squash of some commits that were becoming too interlaced
together to be cleanly separated.
Signed-off-by: flow <flowlnlnln@gmail.com>
This uses the 'Age', 'Cache-Control' and 'Expires' HTTP headers to more
accurately set up the cache lifetime, falling back to a static 1-week
time if they're not present in the response.
Signed-off-by: flow <flowlnlnln@gmail.com>
This is to prevent problems where the cache entry would still be used
way after the remote resource got updated. The limit is hardcoded for 1
week, which I think is a reasonable time, but this could be further
tweaked.
Signed-off-by: flow <flowlnlnln@gmail.com>
* Use the bulk endpoint on mod resolution for faster download
* Search on modrinth for api blocked mods
* Display a dialog for manually downloading blocked mods
- There's now a notice reminding people to change the base URL if they
had a custom base URL and change the paste type (that was something I
personally had problems with when I was testing, so a reminder was
helpful for me).
- Broke down some of the long lines on APIPage.cpp to be more readable.
- Added copyright headers where they were missing.
- Changed the paste service display names to the names they are more
commonly known by.
- Changed the default hastebin base URL to https://hst.sh due to the
acquisition of https://hastebin.com by Toptal.
This runs clang-tidy on some other files in launcher/net/.
This also makes use of some JSON wrappers in HttpMetaCache, instead of
using the Qt stuff directly.
Lastly, this removes useless null checks (crashes don't occur because of
this, but because of concurrent usage / free of the QByteArray pointer),
and fix a fixme in Download.h