40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { type KitsudevInfo } from "#Infos/Website/KitsuDev.tsx";
|
|
import type { Handler } from "../..";
|
|
|
|
const username = "Taevas";
|
|
const repository = "taevas.xyz";
|
|
|
|
export const kitsudev: Handler = async () => {
|
|
/** https://kitsunes.dev/api/swagger#/repository/repoGetAllCommits */
|
|
const kitsudev = await (await fetch(`https://kitsunes.dev/api/v1/repos/${username}/${repository}/commits?limit=1`)).json() as [{
|
|
html_url: string
|
|
commit: {
|
|
author: {
|
|
name: string
|
|
date: string
|
|
}
|
|
message: string
|
|
}
|
|
files: {
|
|
filename: string
|
|
status: string
|
|
}[]
|
|
stats: {
|
|
total: number
|
|
additions: number
|
|
deletions: number
|
|
}
|
|
}];
|
|
|
|
const info: KitsudevInfo = {
|
|
url: kitsudev[0].html_url,
|
|
message: kitsudev[0].commit.message.substring(0, kitsudev[0].commit.message.indexOf("\n")),
|
|
author: kitsudev[0].commit.author.name,
|
|
date: kitsudev[0].commit.author.date,
|
|
files_modified: kitsudev[0].files.length,
|
|
lines_added: kitsudev[0].stats.additions,
|
|
lines_removed: kitsudev[0].stats.deletions,
|
|
};
|
|
|
|
return Response.json(info, {status: 200});
|
|
};
|