Skip to content

Commit

Permalink
fix: chat record
Browse files Browse the repository at this point in the history
  • Loading branch information
jamebal committed Jan 11, 2024
1 parent 3771a52 commit 298a4ae
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,7 @@ router.get('/chat-history', auth, async (req, res) => {
const config = await getCacheConfig()
if (config.siteConfig.loginEnabled) {
try {
const token = req.header('Authorization').replace('Bearer ', '')
const info = jwt.verify(token, config.siteConfig.loginSalt.trim())
req.headers.userId = info.userId
const user = await getUserById(info.userId)
const user = await getUserById(userId)
if (user == null || user.status !== Status.Normal || !user.roles.includes(UserRole.Admin)) {
res.send({ status: 'Fail', message: '无权限 | No permission.', data: null })
return
Expand Down

0 comments on commit 298a4ae

Please sign in to comment.