From 41a8572c55473653c88d3f08bb4b1449f97dfbbf Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Tue, 28 Apr 2026 22:04:30 +0800 Subject: [PATCH] feat: update tempfile creation to use SHA-256 hash in filename for JuiceAgent-API --- src/libloader/common/Loader.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/libloader/common/Loader.cpp b/src/libloader/common/Loader.cpp index 364cc75..d5dabfc 100644 --- a/src/libloader/common/Loader.cpp +++ b/src/libloader/common/Loader.cpp @@ -71,11 +71,20 @@ void entrypoint(const char* runtime_dir) { JuiceAgent::Config::Utils::print_loader_config(config); // Save bytes to file - std::string juiceagent_api_path = JuiceAgent::Utils::File::write_to_tempfile( - JuiceAgent::Resource::juiceagent_api_bytes, - JuiceAgent::Resource::juiceagent_api_bytes_len, - JuiceAgent::Resource::juiceagent_api_bytes_name - ); + std::string hash = + JuiceAgent::Resource::juiceagent_api_bytes_sha256; + + std::string file_name = + hash.substr(0, 8) + "_" + + JuiceAgent::Resource::juiceagent_api_bytes_name; + + std::string juiceagent_api_path = + JuiceAgent::Utils::File::write_to_tempfile( + JuiceAgent::Resource::juiceagent_api_bytes, + JuiceAgent::Resource::juiceagent_api_bytes_len, + file_name + ); + PLOGD << "Saved JuiceAgent-API to: " << juiceagent_api_path; PLOGD << "JuiceAgent-API size: " << JuiceAgent::Resource::juiceagent_api_bytes_len; PLOGD << "JuiceAgent-API SHA256: " << JuiceAgent::Resource::juiceagent_api_bytes_sha256;