Remove Netlify, make an API server

This commit is contained in:
Taevas 2025-03-06 22:18:15 +01:00
parent 0ea59d4bd0
commit ec6cb4b355
73 changed files with 2238 additions and 334 deletions

21
api/coding_gitlab.ts Normal file
View file

@ -0,0 +1,21 @@
import { Gitlab } from "@gitbeaker/rest";
import {type GitlabInfo} from "#Infos/Coding/GitLab.tsx";
import type { Handler } from "..";
export const coding_gitlab: Handler = async () => {
const api = new Gitlab({token: process.env["API_GITLAB"]!});
const gitlab = await api.Events.all({action: "pushed"});
const created_at = gitlab.at(0)?.created_at;
if (typeof created_at !== "string") {
return new Response("Not Found", {status: 404});
}
const activity: GitlabInfo = {
date: created_at.substring(0, created_at.indexOf("T")),
};
return new Response(new Blob([JSON.stringify(activity)], {
type: "application/json",
}), {status: 200});
};