rsshub
Version:
Make RSS Great Again!
55 lines (53 loc) • 1.48 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import { t as config } from "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
//#region lib/routes/github/branches.ts
const route = {
path: "/branches/:user/:repo",
categories: ["programming"],
example: "/github/branches/DIYgod/RSSHub",
parameters: {
user: "User name",
repo: "Repo name"
},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["github.com/:user/:repo/branches", "github.com/:user/:repo"] }],
name: "Repo Branches",
maintainers: ["max-arnold"],
handler
};
async function handler(ctx) {
const user = ctx.req.param("user");
const repo = ctx.req.param("repo");
const host = `https://github.com/${user}/${repo}`;
const url = `https://api.github.com/repos/${user}/${repo}/branches`;
const headers = {};
if (config.github && config.github.access_token) headers.Authorization = `token ${config.github.access_token}`;
const data = (await got_default({
method: "get",
url,
headers
})).data;
return {
title: `${user}/${repo} Branches`,
link: `${host}/branches/all`,
item: data.map((item) => ({
title: item.name,
description: item.name,
link: `${host}/commits/${item.name}`
}))
};
}
//#endregion
export { route };