Merge pull request #366 from gnh1201/dev
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
Deploy Jekyll with GitHub Pages dependencies preinstalled / build (push) Has been cancelled
Deploy Jekyll with GitHub Pages dependencies preinstalled / deploy (push) Has been cancelled

Fix some bugs (Catswords.Phantomizer)
This commit is contained in:
Namhyeon Go 2025-12-11 17:43:28 +09:00 committed by GitHub
commit 8d4a90c0e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 4 deletions

View File

@ -551,7 +551,6 @@ namespace Catswords.Phantomizer
} }
} }
private static void EnsureSignedFileOrThrow(string path, string logicalName) private static void EnsureSignedFileOrThrow(string path, string logicalName)
{ {
if (!File.Exists(path)) if (!File.Exists(path))
@ -602,6 +601,21 @@ namespace Catswords.Phantomizer
} }
Trace.TraceError("AssemblyIntegrity: hash mismatch! SHA256={0}", sha256); 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); throw new InvalidOperationException("AssemblyIntegrity check failed for: " + path);
} }

View File

@ -10,6 +10,7 @@
<PackageTags>loader</PackageTags> <PackageTags>loader</PackageTags>
<Description>Catswords.Phantomizer is an HTTP-based dynamic-link library (DLL) loader designed for .NET applications. It allows your application to fetch and load assemblies directly from your CDN (Azure Blob, S3, Cloudflare R2, etc.) at runtime, with optional GZip compression support.</Description> <Description>Catswords.Phantomizer is an HTTP-based dynamic-link library (DLL) loader designed for .NET applications. It allows your application to fetch and load assemblies directly from your CDN (Azure Blob, S3, Cloudflare R2, etc.) at runtime, with optional GZip compression support.</Description>
<Copyright>Namhyeon Go, 2025 Catswords OSS and WelsonJS Contributors</Copyright> <Copyright>Namhyeon Go, 2025 Catswords OSS and WelsonJS Contributors</Copyright>
<Version>1.0.0.1</Version>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -101,7 +101,7 @@ using Catswords.Phantomizer;
static void Main(string[] args) static void Main(string[] args)
{ {
AssemblyLoader.BaseUrl = GetAppConfig("AssemblyBaseUrl"); // Configure CDN base URL AssemblyLoader.BaseUrl = GetAppConfig("AssemblyBaseUrl"); // Configure CDN base URL
//AssemblyLoader.IntegrityUrl // (Optional) Set the integrity URL //AssemblyLoader.IntegrityUrl = GetAppConfig("AssemblyIntegrityUrl"); // (Optional) Set the integrity URL
AssemblyLoader.LoaderNamespace = typeof(Program).Namespace; AssemblyLoader.LoaderNamespace = typeof(Program).Namespace;
AssemblyLoader.AppName = "WelsonJS"; AssemblyLoader.AppName = "WelsonJS";
AssemblyLoader.Register(); AssemblyLoader.Register();
@ -178,7 +178,7 @@ Once uploaded and pinned, the file cannot be silently modified without changing
## 📥 Download the pre-compiled file ## 📥 Download the pre-compiled file
* [Download Catswords.Phantomizer.dll.gz (catswords.blob.core.windows.net)](https://catswords.blob.core.windows.net/welsonjs/packages/managed/Catswords.Phantomizer/1.0.0.0/Catswords.Phantomizer.dll.gz) * [Download Catswords.Phantomizer.dll.gz (catswords.blob.core.windows.net)](https://catswords.blob.core.windows.net/welsonjs/packages/managed/Catswords.Phantomizer/1.0.0.1/Catswords.Phantomizer.dll.gz)
--- ---

View File

@ -132,7 +132,7 @@ namespace WelsonJS.Launcher
loaderType.GetProperty("BaseUrl")?.SetValue(null, GetAppConfig("AssemblyBaseUrl")); loaderType.GetProperty("BaseUrl")?.SetValue(null, GetAppConfig("AssemblyBaseUrl"));
loaderType.GetProperty("LoaderNamespace")?.SetValue(null, typeof(Program).Namespace); loaderType.GetProperty("LoaderNamespace")?.SetValue(null, typeof(Program).Namespace);
loaderType.GetProperty("AppName")?.SetValue(null, "WelsonJS"); 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); loaderType.GetMethod("Register")?.Invoke(null, null);
var loadNativeModulesMethod = loaderType.GetMethod( var loadNativeModulesMethod = loaderType.GetMethod(
@ -154,6 +154,21 @@ namespace WelsonJS.Launcher
new Version(1, 13, 0, 0), new Version(1, 13, 0, 0),
new[] { "ChakraCore.dll" } 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" }
);
*/
} }