hypha: implement console support

This commit is contained in:
Alex Zenla
2024-01-21 04:49:31 -08:00
parent ece88e16cc
commit d9629f46d0
5 changed files with 103 additions and 21 deletions

View File

@ -52,16 +52,19 @@ impl RegistryClient {
.url
.join(&format!("/v2/{}/manifests/{}", name, reference))?;
let accept = format!(
"{}, {}, {}",
"{}, {}, {}, {}",
MediaType::ImageManifest.to_docker_v2s2()?,
MediaType::ImageManifest,
MediaType::ImageIndex,
MediaType::ImageIndex.to_docker_v2s2()?,
);
let response = self.call(self.agent.get(url.as_str()).set("Accept", &accept))?;
let content_type = response.header("Content-Type").ok_or_else(|| {
HyphaError::new("registry response did not have a Content-Type header")
})?;
if content_type == MediaType::ImageIndex.to_string() {
if content_type == MediaType::ImageIndex.to_string()
|| content_type == MediaType::ImageIndex.to_docker_v2s2()?
{
let index = ImageIndex::from_reader(response.into_reader())?;
let descriptor = self
.pick_manifest(index)