hippofish/packages/backend/src/server/api/endpoints/latest-version.ts

30 lines
564 B
TypeScript
Raw Normal View History

2023-01-13 05:40:33 +01:00
import define from "../define.js";
2022-09-16 00:28:32 +02:00
export const meta = {
2023-01-13 05:40:33 +01:00
tags: ["meta"],
2022-09-16 00:28:32 +02:00
requireCredential: false,
requireCredentialPrivateMode: true,
} as const;
export const paramDef = {
2023-01-13 05:40:33 +01:00
type: "object",
2022-09-16 00:28:32 +02:00
properties: {},
required: [],
} as const;
export default define(meta, paramDef, async () => {
2022-09-16 00:32:25 +02:00
let tag_name;
2023-01-13 05:40:33 +01:00
await fetch(
2023-07-03 00:18:30 +02:00
"https://codeberg.org/api/v1/repos/firefish/firefish/releases?draft=false&pre-release=false&page=1&limit=1",
2023-01-13 05:40:33 +01:00
)
2022-09-16 00:23:08 +02:00
.then((response) => response.json())
2022-09-16 00:32:25 +02:00
.then((data) => {
tag_name = data[0].tag_name;
});
2022-09-16 00:28:32 +02:00
return {
tag_name,
};
});