mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 09:01:06 +03:00
modify whitelistURLs
This commit is contained in:
@@ -93,7 +93,13 @@ export class App {
|
|||||||
const basicAuthMiddleware = basicAuth({
|
const basicAuthMiddleware = basicAuth({
|
||||||
users: { [username]: password }
|
users: { [username]: password }
|
||||||
})
|
})
|
||||||
const whitelistURLs = ['/api/v1/prediction/', '/api/v1/node-icon/', '/api/v1/chatflows-streaming']
|
const whitelistURLs = [
|
||||||
|
'/api/v1/verify/apikey/',
|
||||||
|
'/api/v1/chatflows/apikey/',
|
||||||
|
'/api/v1/prediction/',
|
||||||
|
'/api/v1/node-icon/',
|
||||||
|
'/api/v1/chatflows-streaming'
|
||||||
|
]
|
||||||
this.app.use((req, res, next) => {
|
this.app.use((req, res, next) => {
|
||||||
if (req.url.includes('/api/v1/')) {
|
if (req.url.includes('/api/v1/')) {
|
||||||
whitelistURLs.some((url) => req.url.includes(url)) ? next() : basicAuthMiddleware(req, res, next)
|
whitelistURLs.some((url) => req.url.includes(url)) ? next() : basicAuthMiddleware(req, res, next)
|
||||||
@@ -492,7 +498,7 @@ export class App {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Verify api key
|
// Verify api key
|
||||||
this.app.get('/api/v1/apikey/:apiKey', async (req: Request, res: Response) => {
|
this.app.get('/api/v1/verify/apikey/:apiKey', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const apiKey = await getApiKey(req.params.apiKey)
|
const apiKey = await getApiKey(req.params.apiKey)
|
||||||
if (!apiKey) return res.status(401).send('Unauthorized')
|
if (!apiKey) return res.status(401).send('Unauthorized')
|
||||||
|
|||||||
Reference in New Issue
Block a user