Add creation reason

pull/2131/head
Chocobozzz 2019-09-03 09:49:04 +02:00 committed by Chocobozzz
parent 589d9f55f6
commit 8ae03c3718
14 changed files with 101 additions and 15 deletions

View File

@ -24,19 +24,25 @@
</div>
<div class="block administrator" *ngIf="html.administrator">
<div i18n class="section-title">Who are we?</div>
<div i18n class="section-title">Who we are</div>
<div [innerHTML]="html.administrator"></div>
</div>
<div class="block creation-reason" *ngIf="creationReason">
<div i18n class="section-title">Why we created this instance</div>
<p>{{ creationReason }}</p>
</div>
<div class="block maintenance-lifetime" *ngIf="maintenanceLifetime">
<div i18n class="section-title">How long do we plan to maintain this instance?</div>
<div i18n class="section-title">How long we plan to maintain this instance</div>
<p>{{ maintenanceLifetime }}</p>
</div>
<div class="block business-model" *ngIf="businessModel">
<div i18n class="section-title">How will we pay this instance?</div>
<div i18n class="section-title">How we will pay this instance</div>
<p>{{ businessModel }}</p>
</div>

View File

@ -25,6 +25,7 @@ export class AboutInstanceComponent implements OnInit {
administrator: ''
}
creationReason = ''
maintenanceLifetime = ''
businessModel = ''
@ -61,6 +62,7 @@ export class AboutInstanceComponent implements OnInit {
async ([ about, translations ]) => {
this.shortDescription = about.instance.shortDescription
this.creationReason = about.instance.creationReason
this.maintenanceLifetime = about.instance.maintenanceLifetime
this.businessModel = about.instance.businessModel

View File

@ -21,7 +21,7 @@
<div class="form-group">
<label i18n for="instanceShortDescription">Short description</label>
<textarea
id="instanceShortDescription" formControlName="shortDescription"
id="instanceShortDescription" formControlName="shortDescription" class="small"
[ngClass]="{ 'input-error': formErrors['instance.shortDescription'] }"
></textarea>
<div *ngIf="formErrors.instance.shortDescription" class="form-error">{{ formErrors.instance.shortDescription }}</div>
@ -130,22 +130,34 @@
<div i18n class="inner-form-title">You and your instance</div>
<div class="form-group">
<label i18n for="instanceAdministrator">Who is behind the instance? </label>
<label i18n for="instanceAdministrator">Who is behind the instance?</label>
<div class="label-small-info">A single person? A non profit? A company?</div>
<textarea
id="instanceAdministrator" formControlName="administrator"
[ngClass]="{ 'input-error': formErrors['instance.administrator'] }"
></textarea>
<my-markdown-textarea
id="instanceAdministrator" formControlName="administrator" textareaWidth="500px" textareaHeight="75px" [previewColumn]="true"
[classes]="{ 'input-error': formErrors['instance.administrator'] }"
></my-markdown-textarea>
<div *ngIf="formErrors.instance.administrator" class="form-error">{{ formErrors.instance.administrator }}</div>
</div>
<div class="form-group">
<label i18n for="instanceCreationReason">Why did you create this instance?</label>
<div class="label-small-info">To share your personal videos? To open registrations and allow people to upload what they want?</div>
<textarea
id="instanceCreationReason" formControlName="creationReason" class="small"
[ngClass]="{ 'input-error': formErrors['instance.creationReason'] }"
></textarea>
<div *ngIf="formErrors.instance.creationReason" class="form-error">{{ formErrors.instance.creationReason }}</div>
</div>
<div class="form-group">
<label i18n for="instanceMaintenanceLifetime">How long do you plan to maintain this instance?</label>
<div class="label-small-info">It's important to know for users who want to register on your instance</div>
<textarea
id="instanceMaintenanceLifetime" formControlName="maintenanceLifetime"
id="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" class="small"
[ngClass]="{ 'input-error': formErrors['instance.maintenanceLifetime'] }"
></textarea>
<div *ngIf="formErrors.instance.maintenanceLifetime" class="form-error">{{ formErrors.instance.maintenanceLifetime }}</div>
@ -156,7 +168,7 @@
<div class="label-small-info">With you own funds? With users donations? Advertising?</div>
<textarea
id="instanceBusinessModel" formControlName="businessModel"
id="instanceBusinessModel" formControlName="businessModel" class="small"
[ngClass]="{ 'input-error': formErrors['instance.businessModel'] }"
></textarea>
<div *ngIf="formErrors.instance.businessModel" class="form-error">{{ formErrors.instance.businessModel }}</div>

View File

@ -44,8 +44,8 @@ textarea {
display: block;
&#instanceShortDescription {
height: 100px;
&.small {
height: 75px;
}
}

View File

@ -100,6 +100,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
terms: null,
codeOfConduct: null,
creationReason: null,
moderationInformation: null,
administrator: null,
maintenanceLifetime: null,

View File

@ -243,6 +243,9 @@ instance:
# Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
moderation_information: '' # Supports markdown
# Why did you create this instance?
creation_reason: ''
# Who is behind the instance? A single person? A non profit?
administrator: ''

View File

@ -251,9 +251,58 @@ auto_blacklist:
instance:
name: 'PeerTube'
short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.'
description: '' # Support markdown
terms: '' # Support markdown
description: 'Welcome to this PeerTube instance!' # Support markdown
terms: 'No terms for now.' # Support markdown
code_of_conduct: '' # Supports markdown
# Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc
moderation_information: '' # Supports markdown
# Why did you create this instance?
creation_reason: ''
# Who is behind the instance? A single person? A non profit?
administrator: ''
# How long do you plan to maintain this instance?
maintenance_lifetime: ''
# How will you pay the PeerTube instance server? With you own funds? With users donations? Advertising?
business_model: ''
# What are the main languages of your instance? To interact with your users for example
# Uncomment or add the languages you want
# List of supported languages: https://peertube.cpy.re/api/v1/videos/languages
languages:
# - en
# - es
# - fr
# You can specify the main categories of your instance (dedicated to music, gaming or politics etc)
# Uncomment or add the category ids you want
# List of supported categories: https://peertube.cpy.re/api/v1/videos/categories
categories:
# - 1 # Music
# - 2 # Films
# - 3 # Vehicles
# - 4 # Art
# - 5 # Sports
# - 6 # Travels
# - 7 # Gaming
# - 8 # People
# - 9 # Comedy
# - 10 # Entertainment
# - 11 # News & Politics
# - 12 # How To
# - 13 # Education
# - 14 # Activism
# - 15 # Science & Technology
# - 16 # Animals
# - 17 # Kids
# - 18 # Food
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
@ -261,6 +310,7 @@ instance:
# 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'
customizations:
javascript: '' # Directly your JavaScript code (without <script> tags). Will be eval at runtime
css: '' # Directly your CSS code (without <style> tags). Will be injected at runtime

View File

@ -161,6 +161,7 @@ function getAbout (req: express.Request, res: express.Response) {
terms: CONFIG.INSTANCE.TERMS,
codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT,
creationReason: CONFIG.INSTANCE.CREATION_REASON,
moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION,
administrator: CONFIG.INSTANCE.ADMINISTRATOR,
maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME,
@ -232,6 +233,7 @@ function customConfig (): CustomConfig {
terms: CONFIG.INSTANCE.TERMS,
codeOfConduct: CONFIG.INSTANCE.CODE_OF_CONDUCT,
creationReason: CONFIG.INSTANCE.CREATION_REASON,
moderationInformation: CONFIG.INSTANCE.MODERATION_INFORMATION,
administrator: CONFIG.INSTANCE.ADMINISTRATOR,
maintenanceLifetime: CONFIG.INSTANCE.MAINTENANCE_LIFETIME,

View File

@ -211,6 +211,8 @@ const CONFIG = {
get TERMS () { return config.get<string>('instance.terms') },
get CODE_OF_CONDUCT () { return config.get<string>('instance.code_of_conduct') },
get CREATION_REASON () { return config.get<string>('instance.creation_reason') },
get MODERATION_INFORMATION () { return config.get<string>('instance.moderation_information') },
get ADMINISTRATOR () { return config.get<string>('instance.administrator') },
get MAINTENANCE_LIFETIME () { return config.get<string>('instance.maintenance_lifetime') },

View File

@ -29,6 +29,7 @@ describe('Test config API validators', function () {
terms: 'my super terms',
codeOfConduct: 'my super coc',
creationReason: 'my super reason',
moderationInformation: 'my super moderation information',
administrator: 'Kuja',
maintenanceLifetime: 'forever',

View File

@ -30,6 +30,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
expect(data.instance.terms).to.equal('No terms for now.')
expect(data.instance.creationReason).to.be.empty
expect(data.instance.codeOfConduct).to.be.empty
expect(data.instance.moderationInformation).to.be.empty
expect(data.instance.administrator).to.be.empty
@ -90,6 +91,7 @@ function checkUpdatedConfig (data: CustomConfig) {
expect(data.instance.description).to.equal('my super description')
expect(data.instance.terms).to.equal('my super terms')
expect(data.instance.creationReason).to.equal('my super creation reason')
expect(data.instance.codeOfConduct).to.equal('my super coc')
expect(data.instance.moderationInformation).to.equal('my super moderation information')
expect(data.instance.administrator).to.equal('Kuja')
@ -212,6 +214,7 @@ describe('Test config', function () {
terms: 'my super terms',
codeOfConduct: 'my super coc',
creationReason: 'my super creation reason',
moderationInformation: 'my super moderation information',
administrator: 'Kuja',
maintenanceLifetime: 'forever',

View File

@ -55,6 +55,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
terms: 'my super terms',
codeOfConduct: 'my super coc',
creationReason: 'my super creation reason',
moderationInformation: 'my super moderation information',
administrator: 'Kuja',
maintenanceLifetime: 'forever',

View File

@ -7,6 +7,7 @@ export interface About {
codeOfConduct: string
creationReason: string
moderationInformation: string
administrator: string
maintenanceLifetime: string

View File

@ -8,6 +8,7 @@ export interface CustomConfig {
terms: string
codeOfConduct: string
creationReason: string
moderationInformation: string
administrator: string
maintenanceLifetime: string