Files and updates
Downloading a file
Section titled “Downloading a file”Upload the file in the panel’s Files page and copy its ID (file_…).
eonauth::DownloadFileAsync("file_0123456789abcdef0123456789abcdef", [](const eonauth::Result& r, const eonauth::FileInfo& info, const std::vector<std::uint8_t>& data) { if (r) SaveFile(info.name, data); // size and SHA-256 already checked else if (r.status == eonauth::Status::FileNotFound) ShowUpgradePrompt(); else ShowError(eonauth::UserMessage(r), eonauth::UserHint(r)); });- The server checks the user’s tiers and sends the file’s size, SHA-256 and a download link that expires after 2 minutes.
- The SDK downloads it over the same pinned connection and checks the size and hash before your callback runs.
Files are up to 25 MB. An unknown ID and a file locked to other tiers both give FileNotFound.
Your app’s version
Section titled “Your app’s version”Set Config::appVersion (for example "1.4.2"). It is sent with every sign-in, redeem and
heartbeat.
Forced updates
Section titled “Forced updates”If the version is below the minimum version in App settings, the server answers
UpdateRequired. Result::details then has min_version, latest_version and download_url
(and, when a build is hosted, download_sha256, download_size and download_name).
if (r.status == eonauth::Status::UpdateRequired) { const std::string url = r.details["download_url"]; if (AskYesNo("An update is required. Download it now?") && !url.empty()) ShellExecuteW(nullptr, L"open", eonauth::ToWide(url).c_str(), nullptr, nullptr, SW_SHOWNORMAL);}UserHint(r) already contains the download link, so a plain message box works too. A running app
gets SessionLost with UpdateRequired at its next heartbeat after you raise the minimum.
Optional updates
Section titled “Optional updates”After sign-in and on every heartbeat:
if (!eonauth::LatestVersion().empty() && eonauth::LatestVersion() != kMyVersion) ShowUpdateHint(eonauth::DownloadUrl());When you host an update build, the download link is a signed link to it, valid for at least an hour.
Leave appVersion empty to skip the version check altogether.