Skip to content

Commit

Permalink
fix(route/dockerhub): new tag route
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Nov 26, 2024
1 parent 771f9fc commit b8e63d6
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lib/routes/dockerhub/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const route: Route = {
supportScihub: false,
},
name: 'Image New Tag',
maintainers: [],
maintainers: ['pseudoyu'],
handler,
description: `:::warning
Use \`library\` as the \`owner\` for official images, such as [https://rsshub.app/dockerhub/tag/library/mysql](https://rsshub.app/dockerhub/tag/library/mysql)
Expand All @@ -42,14 +42,20 @@ async function handler(ctx) {
description: metadata.data.description,
link,
language: 'en',
item: tags.map((item) => ({
title: `${namespace}:${item.name} was updated`,
description: `${namespace}:${item.name} was updated, supporting the architectures of ${item.images.map((img) => `${img.os}/${img.architecture}`).join(', ')}`,
link: `https://hub.docker.com/layers/${owner === 'library' ? `${image}/` : ''}${namespace}/${item.name}/images/${item.images[0].digest.replace(':', '-')}`,
author: owner,
pubDate: parseDate(item.tag_last_pushed),
// check for (1) different tag names and (2) different image hashes, considering varients of all arches
guid: `${namespace}:${item.name}@${hash(item.images)}`,
})),
item: tags.map((item) => {
const architectures = item.images?.length ? item.images.map((img) => `${img.os}/${img.architecture}`).join(', ') : 'unknown architectures';

const imageDigest = item.digest?.replace(':', '-') || '';
const layerLink = `https://hub.docker.com/layers/${owner === 'library' ? `${image}/` : ''}${namespace}/${item.name}/images/${imageDigest}`;

return {
title: `${namespace}:${item.name} was updated`,
description: `${namespace}:${item.name} was updated, supporting the ${architectures}`,
link: layerLink,
author: owner,
pubDate: parseDate(item.tag_last_pushed),
guid: `${namespace}:${item.name}@${hash(item.images || [])}`,
};
}),
};
}

0 comments on commit b8e63d6

Please sign in to comment.