Update Healer Man server
This commit is contained in:
1 parent
3e30af4c98
commit
97ee0c13f9
25 files changed
+576
-179
No files matched your search
@@ -2,6 +2,7 @@ import { Capacitor } from "@capacitor/core";
|
||||
import {
|
||||
appVersionMeetsMinimum,
|
||||
changedFilesForPack,
|
||||
contentPackIdsForLogicalUrls,
|
||||
filesForContentPack,
|
||||
parseContentManifest,
|
||||
type ContentManifest,
|
||||
@@ -636,6 +637,26 @@ export async function installContentPack(packId: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/** Installs only the packs owning the selected run's logical model URLs. */
|
||||
export async function installContentForLogicalUrls(logicalUrls: readonly string[]): Promise<void> {
|
||||
await validateInstalledContentStorage();
|
||||
const logicalPaths = logicalUrls.map((logicalUrl) => {
|
||||
try { return new URL(logicalUrl, "https://healer-man.invalid").pathname; } catch { return logicalUrl; }
|
||||
});
|
||||
const alreadyAvailable = logicalPaths.every((logicalPath) => (
|
||||
Boolean(snapshot.bundledManifest?.files[logicalPath])
|
||||
|| Boolean(installedState.files[logicalPath] && validatedInstalledFiles.has(logicalPath))
|
||||
));
|
||||
if (alreadyAvailable) return;
|
||||
const manifest = snapshot.manifest ?? await checkForContentUpdates();
|
||||
if (!manifest) throw new Error(snapshot.error || "Content server is unavailable.");
|
||||
for (const packId of contentPackIdsForLogicalUrls(manifest, logicalUrls)) {
|
||||
if (!contentPackIsUsable(packId) || contentPackHasUpdate(packId)) {
|
||||
await installContentPack(packId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function removeContentPack(packId: string): Promise<void> {
|
||||
if (contentPackIsBundled(packId)) return;
|
||||
const remainingFiles = { ...installedState.files };
|
||||
|
||||
Reference in new issue
Block a user