Achievements: Enable HTTPS on UWP, retry failed icon downloads

UWP compiled naett with the WinHTTP backend but never reported
SYSPROP_SUPPORTS_HTTPS, so achievement traffic and badge icons went over
plain http. When the media server redirected to https, icons failed.

A failed icon download also left the URL marked pending, so it was never
retried for the rest of the session. Mark it failed instead, and let
IconCache retry it after 30 seconds.

The set-completed badge also skipped RemoveHttpsIfNeeded.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-01 10:26:00 -06:00
1 parent 6f82ae1c0c
commit 00208d3d80
4 files changed
+35 -5

No files matched your search

+20
View File
@@ -14,6 +14,9 @@
#define MAX_RUNTIME_CACHE_SIZE (1024 * 1024 * 4)
#define MAX_SAVED_CACHE_SIZE (1024 * 1024 * 1)
// Seconds before MarkPending accepts a key whose download failed.
constexpr double FAILED_RETRY_DELAY = 30.0;
constexpr uint32_t ICON_CACHE_MAGIC = MK_FOURCC("pICN");
IconCache g_iconCache;
@@ -127,6 +130,7 @@ void IconCache::ClearData() {
ClearTextures();
std::unique_lock<std::mutex> lock(lock_);
cache_.clear();
failed_.clear();
}
void IconCache::FrameUpdate() {
@@ -231,10 +235,26 @@ bool IconCache::MarkPending(std::string_view key) {
if (pending_.find(key) != pending_.end()) {
return false;
}
auto failedIter = failed_.find(key);
if (failedIter != failed_.end()) {
if (time_now_d() < failedIter->second + FAILED_RETRY_DELAY) {
return false;
}
failed_.erase(failedIter);
}
pending_.emplace(key);
return true;
}
void IconCache::MarkFailed(std::string_view key) {
std::unique_lock<std::mutex> lock(lock_);
auto iter = pending_.find(key);
if (iter != pending_.end()) {
pending_.erase(iter);
}
failed_[std::string(key)] = time_now_d();
}
void IconCache::CancelPending(std::string_view key) {
std::unique_lock<std::mutex> lock(lock_);
auto iter = pending_.find(key);