Files
Sukka d82847f541 style/chore(eslint): enforce new rules (#8040)
* style: prefer object shorthand syntax
* refactor: prefer Array#map over Array#forEach
* style: prefer arrow callback
* chore(eslint): update rules
* style: auto fix by eslint
2021-08-17 22:23:23 +08:00

32 lines
870 B
JavaScript

const got = require('@/utils/got');
module.exports = async (ctx) => {
const id = ctx.params.id;
const APIUrl = `https://download.fir.im/${id}`;
const webUrl = `https://fir.im/${id}`;
const res = await got({
method: 'get',
url: APIUrl,
headers: {
Referer: webUrl,
},
});
const data = res.data;
const title = data.app.name + ' 更新';
const item = {};
item.title = data.app.name + ' ' + data.app.releases.master.version + '(' + data.app.releases.master.build + ')';
item.description = data.app.releases.master.changelog;
item.link = `https://fir.im/x9zu?release_id=${data.app.releases.master.id}`;
item.pubDate = new Date(data.app.releases.master.created_at * 1000).toUTCString();
ctx.state.data = {
title,
link: webUrl,
item: [item],
};
};