diff --git a/lib/routes/nga/forum.js b/lib/routes/nga/forum.js index 6282964b0..c8b7542b6 100644 --- a/lib/routes/nga/forum.js +++ b/lib/routes/nga/forum.js @@ -1,7 +1,13 @@ const got = require('@/utils/got'); +const config = require('@/config').value; module.exports = async (ctx) => { const { fid, recommend } = ctx.params; + const timestamp = Math.floor(Date.now() / 1000); + let cookieString = `guestJs=${timestamp};`; + if (config.nga.uid && config.nga.cid) { + cookieString = `ngaPassportUid=${config.nga.uid}; ngaPassportCid=${config.nga.cid};`; + } const formatContent = (content) => content .replace(/\[img\](.+?)\[\/img\]/g, (match, p1) => { @@ -14,6 +20,7 @@ module.exports = async (ctx) => { url: 'https://ngabbs.com/app_api.php?__lib=subject&__act=list', headers: { 'X-User-Agent': 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)', + Cookie: cookieString, }, form: { fid, @@ -41,6 +48,7 @@ module.exports = async (ctx) => { url: 'https://ngabbs.com/app_api.php?__lib=post&__act=list', headers: { 'X-User-Agent': 'NGA_skull/6.0.5(iPhone10,3;iOS 12.0.1)', + Cookie: cookieString, }, form: { tid,