mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-30 07:21:32 -07:00
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
export async function runSupportAssetUpdatesForLauncherResult<
|
|
TLauncherResult,
|
|
TSupportResult extends { status: string; command?: string; message?: string },
|
|
>(options: {
|
|
launcherResult: TLauncherResult;
|
|
assetDescription?: string;
|
|
updateSupportAssets: () => Promise<TSupportResult[]>;
|
|
logWarn: (message: string, details?: unknown) => void;
|
|
}): Promise<TLauncherResult> {
|
|
const assetDescription = options.assetDescription ?? 'Support asset update';
|
|
try {
|
|
const supportResults = await options.updateSupportAssets();
|
|
for (const result of supportResults) {
|
|
if (result.status === 'protected' && result.command) {
|
|
options.logWarn(`${assetDescription} requires manual command: ${result.command}`);
|
|
} else if (result.status === 'hash-mismatch' || result.status === 'missing-asset') {
|
|
options.logWarn(`${assetDescription} skipped: ${result.message ?? result.status}`);
|
|
}
|
|
}
|
|
} catch (error) {
|
|
options.logWarn('Support asset update failed after launcher update', error);
|
|
}
|
|
return options.launcherResult;
|
|
}
|