Files
InstanceBrick--nightcap/include/update/apkpure_provider.h
T
LightZirconite 9da2c02836 Resolve APK providers through a replaceable chain
The coordinator constructed ApkPureProvider directly in three places and
rejected every other configuration with "native updater supports only the
direct APKPure provider". A single unreachable host therefore failed the
whole update with no way to try anything else, and the reported error named
neither the provider nor the host: on 2026-08-18 api.pureapk.com answered
503 to every request, including metadata for unrelated packages, and a
first launch could only say "Roblox update preflight failed".

Introduce an ApkProvider interface and a ProviderChain that consults
providers in order, returns the first answer, and reports every failure
with the provider that produced it when none answer. Each provider
downloads into its own directory, so a failed attempt cannot block the
next. Adding a source is now one line in BuildProviderChain instead of a
change spread across the coordinator.

The chain currently holds APKPure alone. The repository already ships a
pinned Uptodown provider as a build script, but it no longer works against
Uptodown's current pages, so wiring it in would add a second way to fail
rather than a fallback; that is reported separately.

Payload receipts now record which provider produced an archive, and
updates.source accepts auto alongside apk-pure so existing configuration
files keep working.
2026-08-19 10:41:11 +02:00

33 lines
878 B
C++

#ifndef MOCKTAIL_UPDATE_APKPURE_PROVIDER_H_
#define MOCKTAIL_UPDATE_APKPURE_PROVIDER_H_
#include <filesystem>
#include <string>
#include <string_view>
#include <vector>
#include "update/apk_provider.h"
namespace mocktail::update {
ProviderVersion ParseApkPureLatestMetadata(std::string_view metadata);
std::vector<std::string> ParseApkPureExactDownloadUrls(
std::string_view metadata, std::string_view version,
std::string* error = nullptr);
class ApkPureProvider final : public ApkProvider {
public:
std::string_view name() const override { return "apk-pure"; }
ProviderVersion CheckLatest() const override;
ProviderDownloadResult DownloadExact(
std::string_view version, const std::filesystem::path& output_directory,
int progress_fd = -1) const override;
};
} // namespace mocktail::update
#endif // MOCKTAIL_UPDATE_APKPURE_PROVIDER_H_