forked from phenom/healer-man
Release Healer Man 0.1.29
This commit is contained in:
1 parent
8c9809d3e0
commit
544c1bee91
120 files changed
+4363
-1036
No files matched your search
@@ -5,12 +5,19 @@ export interface ContentManifestFile {
|
||||
readonly url: string;
|
||||
readonly sha256: string;
|
||||
readonly bytes: number;
|
||||
readonly download?: {
|
||||
readonly url: string;
|
||||
readonly encoding: "gzip";
|
||||
readonly sha256: string;
|
||||
readonly bytes: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ContentManifestPack {
|
||||
readonly id: string;
|
||||
readonly label: string;
|
||||
readonly bytes: number;
|
||||
readonly downloadBytes?: number;
|
||||
readonly fileCount: number;
|
||||
readonly bundledOnAndroid: boolean;
|
||||
readonly dependencies: readonly string[];
|
||||
@@ -63,6 +70,14 @@ export function parseContentManifest(value: unknown): ContentManifest {
|
||||
|| entry.bytes < 0) {
|
||||
throw new Error(`The content catalog contains a malformed file: ${logicalPath}`);
|
||||
}
|
||||
if (entry.download !== undefined && (!isRecord(entry.download)
|
||||
|| entry.download.encoding !== "gzip"
|
||||
|| typeof entry.download.url !== "string"
|
||||
|| !/^[a-f0-9]{64}$/.test(String(entry.download.sha256))
|
||||
|| !Number.isSafeInteger(entry.download.bytes)
|
||||
|| Number(entry.download.bytes) < 0)) {
|
||||
throw new Error(`The content catalog contains a malformed compressed file: ${logicalPath}`);
|
||||
}
|
||||
return [logicalPath, entry as unknown as ContentManifestFile];
|
||||
}));
|
||||
return { ...value, packs, files } as unknown as ContentManifest;
|
||||
|
||||
Reference in new issue
Block a user