UNPKG

rsshub

Version:
23 lines (21 loc) 671 B
import "./dist-Bog6z_OM.mjs"; import { t as config } from "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import { t as ofetch_default } from "./ofetch-DKl_Ma9g.mjs"; //#region lib/routes/zhihu/check-cookie.ts const apiRoute = { path: "/check-cookie", description: "检查 zhihu cookie 是否有效", maintainers: ["DIYgod"], handler }; async function handler() { const cookie = config.zhihu.cookies; if (!cookie) return { code: -1 }; return { code: (await ofetch_default(`https://www.zhihu.com/api/v4/me?include=is_realname`, { headers: { Referer: `https://www.zhihu.com/`, Cookie: cookie } })).name ? 0 : -1 }; } //#endregion export { apiRoute };