mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: 修复手动解除oauth2授权后token缓存无法刷新 (#4156)
This commit is contained in:
@@ -8,6 +8,16 @@ module.exports = async (ctx) => {
|
||||
|
||||
if (token) {
|
||||
const response = await got.get(`https://api.weibo.com/2/statuses/home_timeline.json?access_token=${token}&count=100&feature=${feature}`);
|
||||
// 检查token失效
|
||||
if (response.data.error !== undefined) {
|
||||
const { app_key = '', redirect_url = ctx.request.origin + '/weibo/timeline/0' } = config.weibo;
|
||||
|
||||
ctx.status = 302;
|
||||
ctx.set({
|
||||
'Cache-Control': 'no-cache',
|
||||
});
|
||||
ctx.redirect(`https://api.weibo.com/oauth2/authorize?client_id=${app_key}&redirect_uri=${redirect_url}`);
|
||||
}
|
||||
// 获取所有表情
|
||||
const weiboEmotion = await ctx.cache.tryGet('weiboEmotion', async () => {
|
||||
const tmpEmotionList = {};
|
||||
|
||||
Reference in New Issue
Block a user