Add NSFW info in about page
This commit is contained in:
parent
e359e88b08
commit
c8000975d3
9 changed files with 53 additions and 4 deletions
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
<div class="short-description">
|
<div class="short-description">
|
||||||
<div>{{ shortDescription }}</div>
|
<div>{{ shortDescription }}</div>
|
||||||
|
|
||||||
|
<div *ngIf="isNSFW" class="dedicated-to-nsfw">This instance is dedicated to sensitive/NSFW content.</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="description">
|
<div class="description">
|
||||||
|
|
|
@ -26,3 +26,8 @@
|
||||||
.short-description, .description, .terms, .signup {
|
.short-description, .description, .terms, .signup {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.short-description .dedicated-to-nsfw {
|
||||||
|
margin-top: 20px;
|
||||||
|
font-weight: $font-semibold;
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,10 @@ export class AboutInstanceComponent implements OnInit {
|
||||||
return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
|
return this.serverService.getConfig().email.enabled && this.serverService.getConfig().contactForm.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isNSFW () {
|
||||||
|
return this.serverService.getConfig().instance.isNSFW
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.instanceService.getAbout()
|
this.instanceService.getAbout()
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<div class="feature-table">
|
<div class="feature-table">
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<td i18n class="label">Default NSFW/sensitive videos policy (can be redefined by the users)</td>
|
||||||
|
|
||||||
|
<td class="value">{{ buildNSFWLabel() }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr *ngFor="let feature of features">
|
<tr *ngFor="let feature of features">
|
||||||
<td class="label">{{ feature.label }}</td>
|
<td class="label">{{ feature.label }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnInit } from '@angular/core'
|
||||||
import { ServerService } from '@app/core'
|
import { ServerService } from '@app/core'
|
||||||
import { I18n } from '@ngx-translate/i18n-polyfill'
|
import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
|
import { ServerConfig } from '../../../../../shared'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-instance-features-table',
|
selector: 'my-instance-features-table',
|
||||||
|
@ -33,6 +34,14 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildNSFWLabel () {
|
||||||
|
const policy = this.serverService.getConfig().instance.defaultNSFWPolicy
|
||||||
|
|
||||||
|
if (policy === 'do_not_list') return this.i18n('Hidden')
|
||||||
|
if (policy === 'blur') return this.i18n('Blurred with confirmation request')
|
||||||
|
if (policy === 'display') return this.i18n('Displayed')
|
||||||
|
}
|
||||||
|
|
||||||
private buildFeatures () {
|
private buildFeatures () {
|
||||||
const config = this.serverService.getConfig()
|
const config = this.serverService.getConfig()
|
||||||
|
|
||||||
|
@ -87,5 +96,4 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
||||||
|
|
||||||
this.quotaHelpIndication = lines.join('<br />')
|
this.quotaHelpIndication = lines.join('<br />')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
closeAllSequelize,
|
||||||
createUser,
|
createUser,
|
||||||
doubleFollow,
|
doubleFollow,
|
||||||
flushAndRunMultipleServers,
|
flushAndRunMultipleServers,
|
||||||
|
@ -79,6 +80,8 @@ describe('Test ActivityPub fetcher', function () {
|
||||||
after(async function () {
|
after(async function () {
|
||||||
killallServers(servers)
|
killallServers(servers)
|
||||||
|
|
||||||
|
await closeAllSequelize(servers)
|
||||||
|
|
||||||
// Keep the logs if the test failed
|
// Keep the logs if the test failed
|
||||||
if (this['ok']) {
|
if (this['ok']) {
|
||||||
await flushTests()
|
await flushTests()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import './client'
|
import './client'
|
||||||
import './fetch'
|
import './fetch'
|
||||||
import './helpers'
|
|
||||||
import './refresher'
|
import './refresher'
|
||||||
|
import './helpers'
|
||||||
import './security'
|
import './security'
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
closeAllSequelize,
|
||||||
flushAndRunMultipleServers,
|
flushAndRunMultipleServers,
|
||||||
flushTests,
|
flushTests,
|
||||||
killallServers,
|
killallServers,
|
||||||
|
@ -179,6 +180,8 @@ describe('Test ActivityPub security', function () {
|
||||||
after(async function () {
|
after(async function () {
|
||||||
killallServers(servers)
|
killallServers(servers)
|
||||||
|
|
||||||
|
await closeAllSequelize(servers)
|
||||||
|
|
||||||
// Keep the logs if the test failed
|
// Keep the logs if the test failed
|
||||||
if (this['ok']) {
|
if (this['ok']) {
|
||||||
await flushTests()
|
await flushTests()
|
||||||
|
|
|
@ -1,19 +1,27 @@
|
||||||
import * as Sequelize from 'sequelize'
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
|
let sequelizes: { [ id: number ]: Sequelize.Sequelize } = {}
|
||||||
|
|
||||||
function getSequelize (serverNumber: number) {
|
function getSequelize (serverNumber: number) {
|
||||||
|
if (sequelizes[serverNumber]) return sequelizes[serverNumber]
|
||||||
|
|
||||||
const dbname = 'peertube_test' + serverNumber
|
const dbname = 'peertube_test' + serverNumber
|
||||||
const username = 'peertube'
|
const username = 'peertube'
|
||||||
const password = 'peertube'
|
const password = 'peertube'
|
||||||
const host = 'localhost'
|
const host = 'localhost'
|
||||||
const port = 5432
|
const port = 5432
|
||||||
|
|
||||||
return new Sequelize(dbname, username, password, {
|
const seq = new Sequelize(dbname, username, password, {
|
||||||
dialect: 'postgres',
|
dialect: 'postgres',
|
||||||
host,
|
host,
|
||||||
port,
|
port,
|
||||||
operatorsAliases: false,
|
operatorsAliases: false,
|
||||||
logging: false
|
logging: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
sequelizes[serverNumber] = seq
|
||||||
|
|
||||||
|
return seq
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActorField (serverNumber: number, to: string, field: string, value: string) {
|
function setActorField (serverNumber: number, to: string, field: string, value: string) {
|
||||||
|
@ -32,7 +40,17 @@ function setVideoField (serverNumber: number, uuid: string, field: string, value
|
||||||
return seq.query(`UPDATE video SET "${field}" = '${value}' WHERE uuid = '${uuid}'`, options)
|
return seq.query(`UPDATE video SET "${field}" = '${value}' WHERE uuid = '${uuid}'`, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function closeAllSequelize (servers: any[]) {
|
||||||
|
for (let i = 1; i <= servers.length; i++) {
|
||||||
|
if (sequelizes[ i ]) {
|
||||||
|
await sequelizes[ i ].close()
|
||||||
|
delete sequelizes[ i ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
setVideoField,
|
setVideoField,
|
||||||
setActorField
|
setActorField,
|
||||||
|
closeAllSequelize
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue