To test emails with PeerTube:
* Run [mailslurper](http://mailslurper.com/)
- * Run PeerTube using mailslurper SMTP port: `NODE_CONFIG='{ "smtp": { "hostname": "localhost", "port": 2500, "tls": false } }' NODE_ENV=test npm start`
+ * Run PeerTube using mailslurper SMTP port: `NODE_CONFIG='{ "smtp": { "hostname": "localhost", "port": 2500, "tls": false } }' NODE_ENV=dev node dist/server`
## Plugins & Themes
--- /dev/null
+listen:
+ hostname: '::'
+ port: 9000
+
+webserver:
+ https: false
+
+database:
+ hostname: 'localhost'
+ port: 5432
+
+redis:
+ hostname: 'localhost'
+
+smtp:
+ hostname: null
+ port: 1025
+ tls: false
+ disable_starttls: true
+ from_address: 'test-admin@localhost'
+ username: null
+ password: null
+
+log:
+ level: 'debug'
+
+contact_form:
+ enabled: true
+
+peertube:
+ check_latest_version:
+ enabled: false
+
+redundancy:
+ videos:
+ check_interval: '5 minutes'
+ strategies:
+ -
+ size: '1000MB'
+ min_lifetime: '10 minutes'
+ strategy: 'most-views'
+ -
+ size: '1000MB'
+ min_lifetime: '10 minutes'
+ strategy: 'trending'
+ -
+ size: '1000MB'
+ min_lifetime: '10 minutes'
+ strategy: 'recently-added'
+ min_views: 1
+
+cache:
+ previews:
+ size: 10
+ captions:
+ size: 10
+ torrents:
+ size: 10
+
+signup:
+ enabled: true
+ requires_email_verification: false
+
+live:
+ enabled: true
+
+ allow_replay: true
+
+ transcoding:
+ enabled: true
+ threads: 2
+
+ resolutions:
+ 360p: true
+ 720p: true
+
+import:
+ videos:
+ concurrency: 2
+ http:
+ enabled: true
+ torrent:
+ enabled: true
+
+instance:
+ default_nsfw_policy: 'display'
+
+plugins:
+ index:
+ check_latest_versions_interval: '10 minutes'
+
+federation:
+ videos:
+ cleanup_remote_interactions: false
+
+views:
+ videos:
+ remote:
+ max_age: -1
+
+geo_ip:
+ enabled: true
+
+video_studio:
+ enabled: true
index:
check_latest_versions_interval: '10 minutes'
-search:
- # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance
- # If enabled, the associated group will be able to "escape" from the instance follows
- # That means they will be able to follow channels, watch videos, list videos of non followed instances
- remote_uri:
- users: true
- anonymous: false
-
- # Use a third party index instead of your local index, only for search results
- # Useful to discover content outside of your instance
- search_index:
- enabled: false
- # URL of the search index, that should use the same search API and routes
- # than PeerTube: https://docs.joinpeertube.org/api-rest-reference.html
- # You should deploy your own with https://framagit.org/framasoft/peertube/search-index,
- # and can use https://search.joinpeertube.org/ for tests, but keep in mind the latter is an unmoderated search index
- url: 'http://localhost:3234'
- # You can disable local search, so users only use the search index
- disable_local_search: false
- # If you did not disable local search, you can decide to use the search index by default
- is_default_search: true
-
federation:
videos:
federate_unlisted: true
fi
clientCommand="cd client && node --max_old_space_size=4096 node_modules/.bin/ng serve --proxy-config proxy.config.json --hmr --configuration $clientConfiguration --host 0.0.0.0 --disable-host-check --port 3000"
-serverCommand="npm run build:server && NODE_ENV=test node dist/server"
+serverCommand="npm run build:server && NODE_ENV=dev node dist/server"
if [ ! -z ${1+x} ] && [ "$1" = "--skip-server" ]; then
- NODE_ENV=test eval $clientCommand
+ eval $clientCommand
else
- NODE_ENV=test node node_modules/.bin/concurrently -k \
+ node node_modules/.bin/concurrently -k \
"$clientCommand" \
"$serverCommand"
fi
set -eu
-NODE_ENV=test npm run concurrently -- -k \
+npm run concurrently -- -k \
"cd client && npm run webpack -- --config webpack/webpack.video-embed.js --mode development --watch" \
- "npm run build:server && NODE_ENV=test npm start"
+ "npm run build:server && NODE_ENV=dev npm start"
set -eu
-NODE_ENV=test npm run concurrently -- -k \
+npm run concurrently -- -k \
"sh scripts/dev/client.sh --skip-server ${1:-}" \
"sh scripts/dev/server.sh --skip-client"
cp -r ./server/static ./server/assets ./dist/server
cp -r "./server/lib/emails" "./dist/server/lib"
-./node_modules/.bin/tsc-watch --build --preserveWatchOutput --verbose --onSuccess 'sh -c "npm run resolve-tspaths:server && NODE_ENV=test node dist/server"'
+./node_modules/.bin/tsc-watch --build --preserveWatchOutput --verbose --onSuccess 'sh -c "npm run resolve-tspaths:server && NODE_ENV=dev node dist/server"'
import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache'
import { ServerConfigManager } from '@server/lib/server-config-manager'
import { VideoViewsManager } from '@server/lib/views/video-views-manager'
-import { isTestInstance } from './server/helpers/core-utils'
+import { isTestOrDevInstance } from './server/helpers/core-utils'
import { OpenTelemetryMetrics } from '@server/lib/opentelemetry/metrics'
// ----------- Command line -----------
// ----------- App -----------
// Enable CORS for develop
-if (isTestInstance()) {
+if (isTestOrDevInstance()) {
app.use(cors({
origin: '*',
exposedHeaders: 'Retry-After',
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'
}
// 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,
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'
const sendFileOptions = {
maxAge: '30 days',
- immutable: !isTestInstance()
+ immutable: isProdInstance()
}
const pluginsRouter = express.Router()
return process.env.NODE_ENV === 'test'
}
+function isDevInstance () {
+ return process.env.NODE_ENV === 'dev'
+}
+
+function isTestOrDevInstance () {
+ return isTestInstance() || isDevInstance()
+}
+
function isProdInstance () {
return process.env.NODE_ENV === 'production'
}
export {
isTestInstance,
+ isTestOrDevInstance,
isProdInstance,
getAppNumber,
import validator from 'validator'
import { CONSTRAINTS_FIELDS } from '../../../initializers/constants'
-import { isTestInstance } from '../../core-utils'
+import { isTestOrDevInstance } from '../../core-utils'
import { exists } from '../misc'
function isUrlValid (url: string) {
}
// We validate 'localhost', so we don't have the top level domain
- if (isTestInstance()) {
+ if (isTestOrDevInstance()) {
isURLOptions.require_tld = false
}
import validator from 'validator'
-import { exists, isArray } from './misc'
-import { isTestInstance } from '../core-utils'
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
+import { isTestOrDevInstance } from '../core-utils'
+import { exists, isArray } from './misc'
function isHostValid (host: string) {
const isURLOptions = {
}
// We validate 'localhost', so we don't have the top level domain
- if (isTestInstance()) {
+ if (isTestOrDevInstance()) {
isURLOptions.require_tld = false
}
import { getFFmpegVersion } from '@server/helpers/ffmpeg'
import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-redundancy-config-filter.type'
import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
-import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils'
+import { isProdInstance, parseSemVersion } from '../helpers/core-utils'
import { isArray } from '../helpers/custom-validators/misc'
import { logger } from '../helpers/logger'
import { ApplicationModel, getServerActor } from '../models/application/application'
// Some checks on configuration files or throw if there is an error
function checkConfig () {
+ const configFiles = config.util.getConfigSources().map(s => s.name).join(' -> ')
+ logger.info('Using following configuration file hierarchy: %s.', configFiles)
+
// Moved configuration keys
if (config.has('services.csp-logger')) {
logger.warn('services.csp-logger configuration has been renamed to csp.report_uri. Please update your configuration file.')
}
// Lifetime should not be < 10 hours
- if (!isTestInstance() && r.minLifetime < 1000 * 3600 * 10) {
+ if (isProdInstance() && r.minLifetime < 1000 * 3600 * 10) {
throw new Error('Video redundancy minimum lifetime should be >= 10 hours for strategy ' + r.strategy)
}
}
import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
// Do not use barrels, remain constants as independent as possible
-import { isTestInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
+import { isTestInstance, isTestOrDevInstance, parseDurationToMs, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Special constants for a test instance
-if (isTestInstance() === true && process.env.PRODUCTION_CONSTANTS !== 'true') {
- PRIVATE_RSA_KEY_SIZE = 1024
+if (process.env.PRODUCTION_CONSTANTS !== 'true') {
+ if (isTestOrDevInstance()) {
+ PRIVATE_RSA_KEY_SIZE = 1024
- ACTOR_FOLLOW_SCORE.BASE = 20
+ ACTOR_FOLLOW_SCORE.BASE = 20
- REMOTE_SCHEME.HTTP = 'http'
- REMOTE_SCHEME.WS = 'ws'
+ REMOTE_SCHEME.HTTP = 'http'
+ REMOTE_SCHEME.WS = 'ws'
- STATIC_MAX_AGE.SERVER = '0'
+ STATIC_MAX_AGE.SERVER = '0'
- ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2
- ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
- ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
- ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
+ SCHEDULER_INTERVALS_MS.ACTOR_FOLLOW_SCORES = 1000
+ SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS = 10000
+ SCHEDULER_INTERVALS_MS.REMOVE_OLD_HISTORY = 5000
+ SCHEDULER_INTERVALS_MS.REMOVE_OLD_VIEWS = 5000
+ SCHEDULER_INTERVALS_MS.UPDATE_VIDEOS = 5000
+ SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES = 5000
+ SCHEDULER_INTERVALS_MS.UPDATE_INBOX_STATS = 5000
+ SCHEDULER_INTERVALS_MS.CHECK_PEERTUBE_VERSION = 2000
- CONSTRAINTS_FIELDS.ACTORS.IMAGE.FILE_SIZE.max = 100 * 1024 // 100KB
- CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max = 400 * 1024 // 400KB
+ REPEAT_JOBS['videos-views-stats'] = { every: 5000 }
- SCHEDULER_INTERVALS_MS.ACTOR_FOLLOW_SCORES = 1000
- SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS = 10000
- SCHEDULER_INTERVALS_MS.REMOVE_OLD_HISTORY = 5000
- SCHEDULER_INTERVALS_MS.REMOVE_OLD_VIEWS = 5000
- SCHEDULER_INTERVALS_MS.UPDATE_VIDEOS = 5000
- SCHEDULER_INTERVALS_MS.AUTO_FOLLOW_INDEX_INSTANCES = 5000
- SCHEDULER_INTERVALS_MS.UPDATE_INBOX_STATS = 5000
- SCHEDULER_INTERVALS_MS.CHECK_PEERTUBE_VERSION = 2000
+ REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 }
+ AP_CLEANER.PERIOD = 5000
- REPEAT_JOBS['videos-views-stats'] = { every: 5000 }
+ REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
- REPEAT_JOBS['activitypub-cleaner'] = { every: 5000 }
- AP_CLEANER.PERIOD = 5000
+ CONTACT_FORM_LIFETIME = 1000 // 1 second
- REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
+ JOB_ATTEMPTS['email'] = 1
- VIEW_LIFETIME.VIEWER_COUNTER = 1000 * 5 // 5 second
- VIEW_LIFETIME.VIEWER_STATS = 1000 * 5 // 5 second
- CONTACT_FORM_LIFETIME = 1000 // 1 second
+ FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
+ MEMOIZE_TTL.OVERVIEWS_SAMPLE = 3000
+ MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD = 3000
+ OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD = 2
- JOB_ATTEMPTS['email'] = 1
+ PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000
+ }
+
+ if (isTestInstance()) {
+ ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE = 2
+ ACTIVITY_PUB.ACTOR_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
+ ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
+ ACTIVITY_PUB.VIDEO_PLAYLIST_REFRESH_INTERVAL = 10 * 1000 // 10 seconds
- FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
- MEMOIZE_TTL.OVERVIEWS_SAMPLE = 3000
- MEMOIZE_TTL.LIVE_ABLE_TO_UPLOAD = 3000
- OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD = 2
+ CONSTRAINTS_FIELDS.ACTORS.IMAGE.FILE_SIZE.max = 100 * 1024 // 100KB
+ CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max = 400 * 1024 // 400KB
- PLUGIN_EXTERNAL_AUTH_TOKEN_LIFETIME = 5000
+ VIEW_LIFETIME.VIEWER_COUNTER = 1000 * 5 // 5 second
+ VIEW_LIFETIME.VIEWER_STATS = 1000 * 5 // 5 second
- VIDEO_LIVE.CLEANUP_DELAY = getIntEnv('PEERTUBE_TEST_CONSTANTS_VIDEO_LIVE_CLEANUP_DELAY') ?? 5000
- VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY = 2
- VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY = 1
- VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1
+ VIDEO_LIVE.CLEANUP_DELAY = getIntEnv('PEERTUBE_TEST_CONSTANTS_VIDEO_LIVE_CLEANUP_DELAY') ?? 5000
+ VIDEO_LIVE.SEGMENT_TIME_SECONDS.DEFAULT_LATENCY = 2
+ VIDEO_LIVE.SEGMENT_TIME_SECONDS.SMALL_LATENCY = 1
+ VIDEO_LIVE.EDGE_LIVE_DELAY_SEGMENTS_NOTIFICATION = 1
+ }
}
updateWebserverUrls()
import { UserVideoHistoryModel } from '@server/models/user/user-video-history'
import { VideoJobInfoModel } from '@server/models/video/video-job-info'
import { VideoLiveSessionModel } from '@server/models/video/video-live-session'
+import { VideoSourceModel } from '@server/models/video/video-source'
import { LocalVideoViewerModel } from '@server/models/view/local-video-viewer'
import { LocalVideoViewerWatchSectionModel } from '@server/models/view/local-video-viewer-watch-section'
-import { isTestInstance } from '../helpers/core-utils'
+import { isTestOrDevInstance } from '../helpers/core-utils'
import { logger } from '../helpers/logger'
import { AbuseModel } from '../models/abuse/abuse'
import { AbuseMessageModel } from '../models/abuse/abuse-message'
import { VideoTagModel } from '../models/video/video-tag'
import { VideoViewModel } from '../models/view/video-view'
import { CONFIG } from './config'
-import { VideoSourceModel } from '@server/models/video/video-source'
require('pg').defaults.parseInt8 = true // Avoid BIGINT to be converted to string
pool: {
max: poolMax
},
- benchmark: isTestInstance(),
+ benchmark: isTestOrDevInstance(),
isolationLevel: Transaction.ISOLATION_LEVELS.SERIALIZABLE,
logging: (message: string, benchmark: number) => {
if (process.env.NODE_DB_LOG === 'false') return
let newMessage = 'Executed SQL request'
- if (isTestInstance() === true && benchmark !== undefined) {
+ if (isTestOrDevInstance() === true && benchmark !== undefined) {
newMessage += ' in ' + benchmark + 'ms'
}
import { readFile } from 'fs-extra'
import { join } from 'path'
import validator from 'validator'
+import { isTestOrDevInstance } from '@server/helpers/core-utils'
import { toCompleteUUID } from '@server/helpers/custom-validators/misc'
import { mdToOneLinePlainText } from '@server/helpers/markdown'
import { ActorImageModel } from '@server/models/actor/actor-image'
import { getActivityStreamDuration } from './activitypub/activity'
import { getBiggestActorImage } from './actor-image'
import { ServerConfigManager } from './server-config-manager'
-import { isTestInstance } from '@server/helpers/core-utils'
type Tags = {
ogType: string
const path = ClientHtml.getEmbedPath()
// Disable HTML cache in dev mode because webpack can regenerate JS files
- if (!isTestInstance() && ClientHtml.htmlCache[path]) {
+ if (!isTestOrDevInstance() && ClientHtml.htmlCache[path]) {
return ClientHtml.htmlCache[path]
}
import { isArray, merge } from 'lodash'
import { createTransport, Transporter } from 'nodemailer'
import { join } from 'path'
+import { root } from '@shared/core-utils'
import { EmailPayload } from '@shared/models'
import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model'
-import { isTestInstance } from '../helpers/core-utils'
-import { root } from '@shared/core-utils'
+import { isTestOrDevInstance } from '../helpers/core-utils'
import { bunyanLogger, logger } from '../helpers/logger'
import { CONFIG, isEmailEnabled } from '../initializers/config'
import { WEBSERVER } from '../initializers/constants'
this.initialized = true
if (!isEmailEnabled()) {
- if (!isTestInstance()) {
+ if (!isTestOrDevInstance()) {
logger.error('Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!')
}
import { VideoViewModel } from '@server/models/view/video-view'
-import { isTestInstance } from '../../../helpers/core-utils'
+import { isTestOrDevInstance } from '../../../helpers/core-utils'
import { logger } from '../../../helpers/logger'
import { VideoModel } from '../../../models/video/video'
import { Redis } from '../../redis'
const lastHour = new Date()
// In test mode, we run this function multiple times per hour, so we don't want the values of the previous hour
- if (!isTestInstance()) lastHour.setHours(lastHour.getHours() - 1)
+ if (!isTestOrDevInstance()) lastHour.setHours(lastHour.getHours() - 1)
const hour = lastHour.getHours()
const startDate = lastHour.setMinutes(0, 0, 0)
-import { isTestInstance } from '../../helpers/core-utils'
+import { isTestOrDevInstance } from '../../helpers/core-utils'
import { logger } from '../../helpers/logger'
import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
import { ActorFollowModel } from '../../models/actor/actor-follow'
}
private async removeBadActorFollows () {
- if (!isTestInstance()) logger.info('Removing bad actor follows (scheduler).')
+ if (!isTestOrDevInstance()) logger.info('Removing bad actor follows (scheduler).')
try {
await ActorFollowModel.removeBadActorFollows()
-import { isTestInstance } from '../../helpers/core-utils'
+import { isTestOrDevInstance } from '../../helpers/core-utils'
import { logger } from '../../helpers/logger'
+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
import { JobQueue } from '../job-queue'
import { AbstractScheduler } from './abstract-scheduler'
-import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
export class RemoveOldJobsScheduler extends AbstractScheduler {
}
protected internalExecute () {
- if (!isTestInstance()) logger.info('Removing old jobs in scheduler.')
+ if (!isTestOrDevInstance()) logger.info('Removing old jobs in scheduler.')
return JobQueue.Instance.removeOldJobs()
}
-import { isTestInstance } from '@server/helpers/core-utils'
+import { isTestOrDevInstance } from '@server/helpers/core-utils'
import { logger, loggerTagsFactory } from '@server/helpers/logger'
import { VIEW_LIFETIME } from '@server/initializers/constants'
import { sendView } from '@server/lib/activitypub/send/send-view'
if (this.processingViewerCounters) return
this.processingViewerCounters = true
- if (!isTestInstance()) logger.info('Cleaning video viewers.', lTags())
+ if (!isTestOrDevInstance()) logger.info('Cleaning video viewers.', lTags())
try {
for (const videoId of this.viewersPerVideo.keys()) {
import { Transaction } from 'sequelize/types'
-import { isTestInstance } from '@server/helpers/core-utils'
+import { isTestOrDevInstance } from '@server/helpers/core-utils'
import { GeoIP } from '@server/helpers/geo-ip'
import { logger, loggerTagsFactory } from '@server/helpers/logger'
import { MAX_LOCAL_VIEWER_WATCH_SECTIONS, VIEW_LIFETIME } from '@server/initializers/constants'
if (this.processingViewersStats) return
this.processingViewersStats = true
- if (!isTestInstance()) logger.info('Processing viewer statistics.', lTags())
+ if (!isTestOrDevInstance()) logger.info('Processing viewer statistics.', lTags())
const now = new Date().getTime()
import express from 'express'
import { body, param, query } from 'express-validator'
+import { isProdInstance } from '@server/helpers/core-utils'
import { isEachUniqueHandleValid, isFollowStateValid, isRemoteHandleValid } from '@server/helpers/custom-validators/follows'
import { loadActorUrlOrGetFromWebfinger } from '@server/lib/activitypub/actors'
import { getRemoteNameAndHost } from '@server/lib/activitypub/follow'
import { getServerActor } from '@server/models/application/application'
import { MActorFollowActorsDefault } from '@server/types/models'
+import { ServerFollowCreate } from '@shared/models'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
-import { isTestInstance } from '../../helpers/core-utils'
import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
import { logger } from '../../helpers/logger'
import { ActorModel } from '../../models/actor/actor'
import { ActorFollowModel } from '../../models/actor/actor-follow'
import { areValidationErrors } from './shared'
-import { ServerFollowCreate } from '@shared/models'
const listFollowsValidator = [
query('state')
(req: express.Request, res: express.Response, next: express.NextFunction) => {
// Force https if the administrator wants to follow remote actors
- if (isTestInstance() === false && WEBSERVER.SCHEME === 'http') {
+ if (isProdInstance() && WEBSERVER.SCHEME === 'http') {
return res
.status(HttpStatusCode.INTERNAL_SERVER_ERROR_500)
.json({
import { VideoPlaylistModel } from '@server/models/video/video-playlist'
import { VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
-import { isTestInstance } from '../../helpers/core-utils'
+import { isTestOrDevInstance } from '../../helpers/core-utils'
import { isIdOrUUIDValid, isUUIDValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
import { logger } from '../../helpers/logger'
import { WEBSERVER } from '../../initializers/constants'
}
// We validate 'localhost', so we don't have the top level domain
-if (isTestInstance()) {
+if (isTestOrDevInstance()) {
isURLOptions.require_tld = false
}
* Run PeerTube (you can access to your instance on http://localhost:9000):
```
-$ NODE_ENV=test npm start
+$ NODE_ENV=dev npm start
```
* Register the instance via the CLI: