(Infos) Add KitsuDev and change Speedrun.com

This commit is contained in:
Taevas 2025-02-26 23:58:49 +01:00
parent a4496117f8
commit a1827a31e9
7 changed files with 84 additions and 9 deletions

View file

@ -3,13 +3,13 @@ import {api} from "./shared/api.js";
import {type HacktheboxInfo} from "#Infos/Hacking/Hackthebox.js";
const handler: Handler = async () => {
const hackthebox: {profile: {activity: HacktheboxInfo[]}} = await api<{
const hackthebox = await api<{
profile: {
activity: HacktheboxInfo[];
};
}>("https://www.hackthebox.com/api/v4/profile/activity/1063999");
const pwn = hackthebox.profile.activity.find((a: HacktheboxInfo) => a!.object_type === "machine");
const pwn = hackthebox.profile.activity.find((a: HacktheboxInfo) => a?.object_type === "machine");
if (!pwn) {
return {
statusCode: 404,

View file

@ -0,0 +1,26 @@
import {type Handler} from "@netlify/functions";
import {api} from "./shared/api.js";
import { type KitsudevInfo } from "#Infos/Coding/KitsuDev.js";
const handler: Handler = async () => {
const kitsudev = await api<[{
repo: {
full_name: string
html_url: string
}
created: string
}]>("https://kitsunes.dev/api/v1/users/Taevas/activities/feeds?limit=1");
const info: KitsudevInfo = {
name: kitsudev[0].repo.full_name,
url: kitsudev[0].repo.html_url,
date: kitsudev[0].created
};
return {
statusCode: 200,
body: JSON.stringify(info),
};
};
export {handler};

View file

@ -84,6 +84,10 @@ const handler: Handler = async () => {
video: data.run.videos.links.at(0)?.uri,
};
while (run.time.startsWith("0") || run.time.startsWith(":")) {
run.time = run.time.substring(1);
}
return {
statusCode: 200,
body: JSON.stringify(run),