route: add Docker Hub new image build (#1536)

This commit is contained in:
Henry Wang
2019-02-13 14:22:34 +08:00
committed by DIYgod
parent 4fde0e17c2
commit b074915ec8
4 changed files with 37 additions and 0 deletions
+4
View File
@@ -1253,6 +1253,10 @@ GitHub 官方也提供了一些 RSS:
<route name="Versions" author="maple3142" example="/apkpure/versions/jp/jp.co.craftegg.band" path="/apkpure/versions/:region/:pkg" :paramsDesc="['區域代號', 'package name']"/>
### Docker Hub
<route name="镜像有新 Build" author="HenryQW" example="/dockerhub/build/wangqiru/ttrss" path="/dockerhub/build/:owner/:image/:tag?" :paramsDesc="['镜像作者', '镜像名称', '镜像标签,默认 latest']"/>
## 大学通知
### 上海海事大学
+4
View File
@@ -187,6 +187,10 @@ If no matching results were found, the server returns only a HTTP status code `2
<routeEn name="Changelog" author="cielpy" example="/nvidia/webdriverupdate" path="/nvidia/webdriverupdate"/>
### Docker Hub
<routeEn name="Image New Build" author="HenryQW" example="/dockerhub/build/wangqiru/ttrss" path="/dockerhub/build/:owner/:image/:tag?" :paramsDesc="['Image owner', 'Image name', 'Image tag,default to latest']"/>
## Social Media
### pixiv
+3
View File
@@ -1020,6 +1020,9 @@ router.get('/jpmorganchase', require('./routes/jpmorganchase/research'));
// 美拍
router.get('/meipai/user/:uid', require('./routes/meipai/user'));
// Docker Hub
router.get('/dockerhub/build/:owner/:image/:tag?', require('./routes/dockerhub/build'));
// 人人都是产品经理
router.get('/woshipm/bookmarks/:id', require('./routes/woshipm/bookmarks'));
router.get('/woshipm/user_article/:id', require('./routes/woshipm/user_article'));
+26
View File
@@ -0,0 +1,26 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const { owner, image, tag = 'latest' } = ctx.params;
const namespace = `${owner}/${image}`;
const data = await axios.get(`https://hub.docker.com/v2/repositories/${namespace}/buildhistory/?page_size=5`);
const metadata = await axios.get(`https://hub.docker.com/v2/repositories/${namespace}`);
const list = data.data.results.filter((a) => a.status === 10 && a.dockertag_name === tag);
const out = list.map((item) => ({
title: `${namespace}:${tag} was built successfully`,
link: `https://hub.docker.com/r/wangqiru/ttrss/builds`,
author: owner,
pubDate: item.last_updated,
}));
ctx.state.data = {
title: `Docker image build history: ${namespace}:${tag}`,
description: metadata.description,
link: `https://hub.docker.com/r/${namespace}`,
item: out,
};
};