rsshub
Version:
Make RSS Great Again!
55 lines (53 loc) • 1.88 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 { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as md5 } from "./md5-C8GRvctM.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
//#region lib/routes/github/starred-repos.ts
const route = {
path: "/starred_repos/:user",
categories: ["programming"],
example: "/github/starred_repos/DIYgod",
parameters: { user: "User name" },
features: { requireConfig: [{
name: "GITHUB_ACCESS_TOKEN",
optional: true,
description: "To get more requests"
}] },
radar: [{ source: ["github.com/:user"] }],
name: "User Starred Repositories",
maintainers: ["LanceZhu"],
handler
};
async function handler(ctx) {
const user = ctx.req.param("user");
const host = `https://github.com/${user}?tab=stars`;
const { data: response } = await got_default(`https://api.github.com/users/${user}/starred`, { headers: {
Accept: "application/vnd.github.star+json",
Authorization: config.github?.access_token ? `Bearer ${config.github.access_token}` : void 0
} });
const data = response.map(({ starred_at, repo }) => ({
title: `${user} starred ${repo.name}`,
author: user,
description: `${repo.description ?? "No Description"}<br>
Primary Language: ${repo.language ?? "Primary Language"}<br>
Stargazers: ${repo.stargazers_count}<br>
<img sytle="width:50px;" src="https://opengraph.githubassets.com/${md5(repo.updated_at)}/${repo.full_name}">`,
pubDate: parseDate(starred_at),
link: repo.html_url,
category: repo.topics
}));
return {
allowEmpty: true,
title: `${user}'s starred repositories`,
link: host,
description: `${user}'s starred repositories`,
item: data
};
}
//#endregion
export { route };