import define from "../define.js";
import config from "../../../config/index.js";
export const meta = {
    tags: [
        "meta"
    ],
    requireCredential: false,
    requireCredentialPrivateMode: true
};
export const paramDef = {
    type: "object",
    properties: {},
    required: []
};
const LATEST_VERSION_TIMEOUT = 3000;
export default define(meta, paramDef, async ()=>{
    let tag_name = null;
    try {
        const response = await fetch(`https://iceshrimp.dev/api/v1/repos/iceshrimp/iceshrimp/releases?draft=false&pre-release=${config.version.includes("-pre")}&page=1&limit=1`, {
            signal: AbortSignal.timeout(LATEST_VERSION_TIMEOUT)
        });
        if (response.ok) {
            const data = await response.json();
            tag_name = Array.isArray(data) ? data[0]?.tag_name ?? null : null;
        }
    } catch  {}
    return {
        tag_name
    };
});
