mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 14:07:54 +08:00
feat: add linux patchwork comments (#1327)
This commit is contained in:
17
lib/routes/patchwork.kernel.org/cache.js
Normal file
17
lib/routes/patchwork.kernel.org/cache.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = {
|
||||
getPatchnameFromID: async (ctx, id) => {
|
||||
const key = 'patchwork-kernel-org-patchname-from-id-' + id;
|
||||
let name = await ctx.cache.get(key);
|
||||
if (!name) {
|
||||
const patchDetail = await axios({
|
||||
method: 'get',
|
||||
url: `https://patchwork.kernel.org/api/patches/${id}/`,
|
||||
});
|
||||
name = patchDetail.data.name;
|
||||
ctx.cache.set(key, name, 24 * 60 * 60);
|
||||
}
|
||||
return name;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user