{"record":{"id":"59c64319c4586a5f","repo":"DIYgod/RSSHub","slug":"cookie-authorization","errorCode":null,"errorMessage":"未配置 Cookie 或 Authorization。请检查配置。","messagePattern":"未配置 Cookie 或 Authorization。请检查配置。","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/uestc/bbs.ts","lineNumber":54,"sourceCode":"        supportScihub: false,\n    },\n    description: `::: tip\n仅支持自建，您需要设置以下配置才能正常使用：\n\n- 河畔 cookie: \\`UESTC_BBS_COOKIE\\`\n- Header 中的授权字段: \\`UESTC_BBS_AUTH_KEY\\`\n\n:::`,\n    radar: [\n        {\n            source: ['bbs.uestc.edu.cn/*'],\n            target: '/bbs/newthread',\n        },\n    ],\n    handler: async (ctx) => {\n        const { bbsCookie, bbsAuthStr } = config.uestc;\n        if (!bbsCookie || !bbsAuthStr) {\n            throw new ConfigNotFoundError('未配置 Cookie 或 Authorization。请检查配置。');\n        }\n        const { types = 'newreply,newthread,digest,life,hotlist' } = ctx.req.param();\n        const data = await ofetch(`https://bbs.uestc.edu.cn/star/api/v1/index?top_list=${types}`, {\n            headers: {\n                Cookie: bbsCookie,\n                Referer: 'https://bbs.uestc.edu.cn/new',\n                authorization: bbsAuthStr,\n            },\n        });\n        const itemsRaw = Object.entries<Array<Record<string, any>>>(data.data.top_list).flatMap(([label, items]) => items.map((item) => ({ ...item, label }) as Record<string, any>));\n        const items = await Promise.all(\n            itemsRaw.map((item) =>\n                cache.tryGet(`https://bbs.uestc.edu.cn/forum.php?mod=viewthread&tid=${item.thread_id}`, async () => {\n                    const response = await ofetch(`https://bbs.uestc.edu.cn/forum.php?mod=viewthread&tid=${item.thread_id}`, {\n                        headers: {\n                            Cookie: bbsCookie,\n                            Referer: 'https://bbs.uestc.edu.cn',\n                            authorization: bbsAuthStr,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/uestc/bbs.ts#L36-L72","documentation":"ConfigNotFoundError thrown by the UESTC BBS (清水河畔) route when either config.uestc.bbsCookie or config.uestc.bbsAuthStr is falsy. The forum API requires both a session Cookie and an Authorization header (UESTC_BBS_AUTH_KEY) for its /star/api/v1/index endpoint; without both the request would 401, so RSSHub fails fast with a Chinese-language message pointing to the env var.","triggerScenarios":"Requesting /uestc/bbs/newthread (or other type variants) without having set the UESTC_BBS_COOKIE and UESTC_BBS_AUTH_KEY environment variables. The guard runs before any HTTP call.","commonSituations":"Admin deployed RSSHub without UESTC-specific env vars; cookie expired and was removed from config; auth key rotated by the forum; user discovered the route via the route list but the instance is not configured for it.","solutions":["Log in to https://bbs.uestc.edu.cn, copy the Cookie header value into UESTC_BBS_COOKIE.","Copy the Authorization header value into UESTC_BBS_AUTH_KEY.","Restart RSSHub.","Re-extract both values periodically, since forum sessions expire."],"exampleFix":"// before: env unset\n// after\n// UESTC_BBS_COOKIE=<full cookie string from browser>\n// UESTC_BBS_AUTH_KEY=<authorization header value>","handlingStrategy":"validation","validationCode":"function uestcBbsConfigured(cfg: any): boolean {\n  return Boolean(cfg?.uestc?.bbsCookie && cfg?.uestc?.bbsAuthStr);\n}\nif (!uestcBbsConfigured(config)) { /* do not expose /uestc/bbs */ }","typeGuard":null,"tryCatchPattern":"try { await fetchRss('/uestc/bbs/newthread'); }\ncatch (e) {\n  if (/未配置 Cookie 或 Authorization/.test(String(e))) { /* disable feed until creds are set */ }\n  else throw e;\n}","preventionTips":["Re-extract UESTC_BBS_COOKIE and UESTC_BBS_AUTH_KEY periodically; forum sessions expire.","Validate both env vars are non-empty after every deploy.","Keep the browser session used to extract credentials alive to slow expiry."],"tags":["uestc","config-not-found","cookie","auth","configuration","i18n"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}