mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
/!\ Use a dedicated config file for development
It means you have to replace NODE_ENV=test to NODE_ENV=dev if you use it npm run dev:* commands are already updated
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import express from 'express'
|
||||
import { isTestOrDevInstance } from '@server/helpers/core-utils'
|
||||
import { OAuthClientModel } from '@server/models/oauth/oauth-client'
|
||||
import { HttpStatusCode, OAuthClientLocal } from '@shared/models'
|
||||
import { logger } from '../../helpers/logger'
|
||||
@@ -22,7 +23,7 @@ async function getLocalClient (req: express.Request, res: express.Response, next
|
||||
}
|
||||
|
||||
// Don't make this check if this is a test instance
|
||||
if (process.env.NODE_ENV !== 'test' && req.get('host') !== headerHostShouldBe) {
|
||||
if (!isTestOrDevInstance() && req.get('host') !== headerHostShouldBe) {
|
||||
logger.info('Getting client tokens for host %s is forbidden (expected %s).', req.get('host'), headerHostShouldBe)
|
||||
return res.fail({
|
||||
status: HttpStatusCode.FORBIDDEN_403,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { optionalAuthenticate } from '@server/middlewares/auth'
|
||||
import { getCompleteLocale, is18nLocale } from '../../shared/core-utils/i18n'
|
||||
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
|
||||
import { PluginType } from '../../shared/models/plugins/plugin.type'
|
||||
import { isTestInstance } from '../helpers/core-utils'
|
||||
import { isProdInstance } from '../helpers/core-utils'
|
||||
import { PLUGIN_GLOBAL_CSS_PATH } from '../initializers/constants'
|
||||
import { PluginManager, RegisteredPlugin } from '../lib/plugins/plugin-manager'
|
||||
import { getExternalAuthValidator, getPluginValidator, pluginStaticDirectoryValidator } from '../middlewares/validators/plugins'
|
||||
@@ -13,7 +13,7 @@ import { serveThemeCSSValidator } from '../middlewares/validators/themes'
|
||||
|
||||
const sendFileOptions = {
|
||||
maxAge: '30 days',
|
||||
immutable: !isTestInstance()
|
||||
immutable: isProdInstance()
|
||||
}
|
||||
|
||||
const pluginsRouter = express.Router()
|
||||
|
||||
Reference in New Issue
Block a user