<div *ngIf="formErrors.instance.terms" class="form-error">{{ formErrors.instance.terms }}</div>
</div>
+ <div class="form-group">
+ <my-peertube-checkbox
+ inputName="instanceIsNSFW" formControlName="isNSFW"
+ i18n-labelText labelText="Dedicated to sensitive or NSFW content"
+ i18n-helpHtml helpHtml="Enabling it will allow other administrators to know that you are mainly federating sensitive content.<br /><br />
+ Moreover, the NSFW checkbox on video upload will be automatically checked by default."
+ ></my-peertube-checkbox>
+ </div>
+
<div class="form-group">
<label i18n for="instanceDefaultClientRoute">Default client route</label>
<div class="peertube-select-container">
description: null,
terms: null,
defaultClientRoute: null,
+ isNSFW: false,
defaultNSFWPolicy: null,
customizations: {
javascript: null,
import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
import { Observable, of, ReplaySubject } from 'rxjs'
import { getCompleteLocale, ServerConfig } from '../../../../../shared'
-import { About } from '../../../../../shared/models/server/about.model'
import { environment } from '../../../environments/environment'
import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos'
import { isDefaultLocale, peertubeTranslate } from '../../../../../shared/models/i18n'
shortDescription: 'PeerTube, a federated (ActivityPub) video streaming platform ' +
'using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.',
defaultClientRoute: '',
+ isNSFW: false,
defaultNSFWPolicy: 'do_not_list' as 'do_not_list',
customizations: {
javascript: '',
}
const privacy = this.firstStepPrivacyId.toString()
- const nsfw = false
+ const nsfw = this.serverService.getConfig().instance.isNSFW
const waitTranscoding = true
const commentsEnabled = true
const downloadEnabled = true
description: 'Welcome to this PeerTube instance!' # Support markdown
terms: 'No terms for now.' # Support markdown
default_client_route: '/videos/trending'
+ # Whether or not the instance is dedicated to NSFW content
+ # Enabling it will allow other administrators to know that you are mainly federating sensitive content
+ # Moreover, the NSFW checkbox on video upload will be automatically checked by default
+ is_nsfw: false
# By default, "do_not_list" or "blur" or "display" NSFW videos
# Could be overridden per user with a setting
default_nsfw_policy: 'do_not_list'
description: '' # Support markdown
terms: '' # Support markdown
default_client_route: '/videos/trending'
+ # Whether or not the instance is dedicated to NSFW content
+ # Enabling it will allow other administrators to know that you are mainly federating sensitive content
+ # Moreover, the NSFW checkbox on video upload will be automatically checked by default
+ is_nsfw: false
# By default, "do_not_list" or "blur" or "display" NSFW videos
# Could be overridden per user with a setting
default_nsfw_policy: 'do_not_list'
name: CONFIG.INSTANCE.NAME,
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
+ isNSFW: CONFIG.INSTANCE.IS_NSFW,
defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
customizations: {
javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT,
return res.json(json)
}
-function getAbout (req: express.Request, res: express.Response, next: express.NextFunction) {
+function getAbout (req: express.Request, res: express.Response) {
const about: About = {
instance: {
name: CONFIG.INSTANCE.NAME,
return res.json(about).end()
}
-async function getCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
+async function getCustomConfig (req: express.Request, res: express.Response) {
const data = customConfig()
return res.json(data).end()
}
-async function deleteCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
+async function deleteCustomConfig (req: express.Request, res: express.Response) {
await remove(CONFIG.CUSTOM_FILE)
auditLogger.delete(getAuditIdFromRes(res), new CustomConfigAuditView(customConfig()))
return res.json(data).end()
}
-async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
+async function updateCustomConfig (req: express.Request, res: express.Response) {
const oldCustomConfigAuditKeys = new CustomConfigAuditView(customConfig())
// camelCase to snake_case key + Force number conversion
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
description: CONFIG.INSTANCE.DESCRIPTION,
terms: CONFIG.INSTANCE.TERMS,
+ isNSFW: CONFIG.INSTANCE.IS_NSFW,
defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
defaultNSFWPolicy: CONFIG.INSTANCE.DEFAULT_NSFW_POLICY,
customizations: {
'import.videos.http.enabled', 'import.videos.torrent.enabled',
'trending.videos.interval_days',
'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
- 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt',
+ 'instance.is_nsfw', 'instance.default_nsfw_policy', 'instance.robots', 'instance.securitytxt',
'services.twitter.username', 'services.twitter.whitelisted'
]
const requiredAlternatives = [
get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') },
get DESCRIPTION () { return config.get<string>('instance.description') },
get TERMS () { return config.get<string>('instance.terms') },
+ get IS_NSFW () { return config.get<boolean>('instance.is_nsfw') },
get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') },
get DEFAULT_NSFW_POLICY () { return config.get<NSFWPolicyType>('instance.default_nsfw_policy') },
CUSTOMIZATIONS: {
shortDescription: 'my short description',
description: 'my super description',
terms: 'my super terms',
+ isNSFW: true,
defaultClientRoute: '/videos/recently-added',
defaultNSFWPolicy: 'blur',
customizations: {
expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
expect(data.instance.terms).to.equal('No terms for now.')
expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
+ expect(data.instance.isNSFW).to.be.false
expect(data.instance.defaultNSFWPolicy).to.equal('display')
expect(data.instance.customizations.css).to.be.empty
expect(data.instance.customizations.javascript).to.be.empty
expect(data.instance.description).to.equal('my super description')
expect(data.instance.terms).to.equal('my super terms')
expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
+ expect(data.instance.isNSFW).to.be.true
expect(data.instance.defaultNSFWPolicy).to.equal('blur')
expect(data.instance.customizations.javascript).to.equal('alert("coucou")')
expect(data.instance.customizations.css).to.equal('body { background-color: red; }')
description: 'my super description',
terms: 'my super terms',
defaultClientRoute: '/videos/recently-added',
+ isNSFW: true,
defaultNSFWPolicy: 'blur' as 'blur',
customizations: {
javascript: 'alert("coucou")',
shortDescription: string
description: string
terms: string
+ isNSFW: boolean
defaultClientRoute: string
defaultNSFWPolicy: NSFWPolicyType
customizations: {
name: string
shortDescription: string
defaultClientRoute: string
+ isNSFW: boolean
defaultNSFWPolicy: NSFWPolicyType
customizations: {
javascript: string
description: 'my super description',
terms: 'my super terms',
defaultClientRoute: '/videos/recently-added',
+ isNSFW: true,
defaultNSFWPolicy: 'blur',
customizations: {
javascript: 'alert("coucou")',