Skip to content

Commit

Permalink
add auth in /uplods
Browse files Browse the repository at this point in the history
  • Loading branch information
shohhei1126 committed Apr 30, 2024
1 parent cb9af06 commit d74e201
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ app.locals.enableDropBoxSave = config.isDropboxEnable
app.locals.enableGitHubGist = config.isGitHubEnable
app.locals.enableGitlabSnippets = config.isGitlabSnippetsEnable

logger.info('add auth into /uploads')
app.use('/uploads', (req, res, next) => {
if (req.session.user) next()
else response.errorNotFound(req, res)
}, express.static(path.resolve(__dirname, config.uploadsPath), { maxAge: config.staticCacheTime }))

app.use('/uploads', express.static(path.resolve(__dirname, config.uploadsPath), { maxAge: config.staticCacheTime }))
app.use(require('./lib/routes').router)

// response not found if no any route matxches
Expand Down

0 comments on commit d74e201

Please sign in to comment.