Files
admin aa59132330 Rewrite Update module and update client/server sources
Update: drop Qt dependency, rewrite as pure Win32 using v142 toolset. Replace Update.ui/qrc and miniz-based Zip with Api/Crypto/Http/Json/Unzip/UpdateWindow modules.

CrownClient/CrownServer: update Verify and main sources, retarget x64 configs to v142 (VS2019) with SDK 10.0.19041.0, fix VMProtect SDK paths.
2026-10-17 16:31:54 +08:00

64 lines
1.9 KiB
C++

#pragma once
#include <string>
#include <vector>
namespace updater {
// check-update 返回的版本信息
struct UpdateInfo {
bool hasUpdate = false;
std::wstring appName;
std::wstring currentVersion;
std::wstring latestVersion;
// 主下载地址:补丁模式下为补丁包,全量模式下为完整包
std::wstring downloadUrl;
unsigned long long downloadSize = 0;
std::wstring downloadHash;
std::wstring entryFile;
std::vector<std::wstring> entryFiles;
std::vector<std::wstring> desktopShortcutFiles;
std::wstring updateNotes; // Description,简短说明
std::wstring changelog; // 详细变更记录
std::wstring updateStrategy; // optional / forced
std::wstring updateType; // full / patch
std::wstring updateMethod; // auto / manual / silent
bool isPatch = false;
std::wstring patchUrl;
unsigned long long patchSize = 0;
std::wstring patchHash;
std::wstring fullPackageUrl;
unsigned long long fullPackageSize = 0;
std::wstring fullPackageHash;
};
class Api {
public:
struct Result {
bool ok = false;
std::wstring error; // 失败原因(已本地化)
long httpStatus = 0; // HTTP 状态码
int code = 0; // 业务 code
std::wstring message; // 服务端 message
UpdateInfo info;
};
// clientVersion 为空时按“安装器模式”请求,服务端优先返回全量包
static Result CheckUpdate(const std::wstring& appKey,
const std::wstring& clientVersion);
static std::wstring BuildCheckUpdateUrl(const std::wstring& appKey,
const std::wstring& clientVersion);
// 把服务端返回的相对路径补全为绝对地址
static std::wstring ResolveUrl(const std::wstring& url);
};
}