Fix some bugs (Catswords.Phantomizer)

Fix some bugs (Catswords.Phantomizer)
This commit is contained in:
Namhyeon Go 2025-12-11 17:13:31 +09:00
parent 2b3a80bf98
commit 48f1f66fa2
3 changed files with 31 additions and 2 deletions

View File

@ -551,7 +551,6 @@ namespace Catswords.Phantomizer
}
}
private static void EnsureSignedFileOrThrow(string path, string logicalName)
{
if (!File.Exists(path))
@ -602,6 +601,21 @@ namespace Catswords.Phantomizer
}
Trace.TraceError("AssemblyIntegrity: hash mismatch! SHA256={0}", sha256);
// Delete corrupted file so the next run can re-download a clean copy.
if (File.Exists(path))
{
try
{
File.Delete(path);
Trace.TraceInformation("AssemblyIntegrity: deleted corrupted file {0}", path);
}
catch (Exception ex)
{
Trace.TraceWarning("AssemblyIntegrity: failed to delete corrupted file {0}: {1}", path, ex.Message);
}
}
throw new InvalidOperationException("AssemblyIntegrity check failed for: " + path);
}

View File

@ -132,7 +132,7 @@ namespace WelsonJS.Launcher
loaderType.GetProperty("BaseUrl")?.SetValue(null, GetAppConfig("AssemblyBaseUrl"));
loaderType.GetProperty("LoaderNamespace")?.SetValue(null, typeof(Program).Namespace);
loaderType.GetProperty("AppName")?.SetValue(null, "WelsonJS");
//loaderType.GetProperty("IntegrityUrl")?.SetValue(null, GetAppConfig("AssemblyIntegrityUrl")); // In the future, we may use this to verify integrity.
loaderType.GetProperty("IntegrityUrl")?.SetValue(null, GetAppConfig("AssemblyIntegrityUrl"));
loaderType.GetMethod("Register")?.Invoke(null, null);
var loadNativeModulesMethod = loaderType.GetMethod(
@ -154,6 +154,21 @@ namespace WelsonJS.Launcher
new Version(1, 13, 0, 0),
new[] { "ChakraCore.dll" }
});
/*
// Alternative way using direct type reference
AssemblyLoader.BaseUrl = GetAppConfig("AssemblyBaseUrl"); // Configure CDN base URL
AssemblyLoader.IntegrityUrl = GetAppConfig("AssemblyIntegrityUrl"); // (Optional) Set the integrity URL
AssemblyLoader.LoaderNamespace = typeof(Program).Namespace;
AssemblyLoader.AppName = "WelsonJS";
AssemblyLoader.Register();
AssemblyLoader.LoadNativeModules(
"ChakraCore",
new Version(1, 13, 0, 0),
new[] { "ChakraCore.dll" }
);
*/
}