Add creation reason
authorChocobozzz <me@florianbigard.com>
Tue, 3 Sep 2019 07:49:04 +0000 (09:49 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Thu, 5 Sep 2019 08:17:02 +0000 (10:17 +0200)
14 files changed:
client/src/app/+about/about-instance/about-instance.component.html
client/src/app/+about/about-instance/about-instance.component.ts
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
config/default.yaml
config/production.yaml.example
server/controllers/api/config.ts
server/initializers/config.ts
server/tests/api/check-params/config.ts
server/tests/api/server/config.ts
shared/extra-utils/server/config.ts
shared/models/server/about.model.ts
shared/models/server/custom-config.model.ts

index 80acfcce02d4b05b2ad2b9e81da59b069b308f55..8b21137af63c0f98d9f06fef3b13097a7d7f0ee9 100644 (file)
     </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>
index e2c4485017d9471b8fd3284ac6c1c498c378de5a..b6cade4fe12e37a672f78bf57355db31da30d166 100644 (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
 
index 5aa6fda3cea39cbadc06065bb92215d6e0499263..ef24e5b24687d74034be7655d325a1250b63a080 100644 (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>
           <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>
 
+            <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="instanceAdministrator" formControlName="administrator"
-              [ngClass]="{ 'input-error': formErrors['instance.administrator'] }"
+              id="instanceCreationReason" formControlName="creationReason" class="small"
+              [ngClass]="{ 'input-error': formErrors['instance.creationReason'] }"
             ></textarea>
-            <div *ngIf="formErrors.instance.administrator" class="form-error">{{ formErrors.instance.administrator }}</div>
+            <div *ngIf="formErrors.instance.creationReason" class="form-error">{{ formErrors.instance.creationReason }}</div>
           </div>
 
           <div class="form-group">
             <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>
             <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>
index 68f1b01b7eff659c913881c0c073d42550e0c65c..2b4d0da2cc9e83996f00c54af0515e37f8920061 100644 (file)
@@ -44,8 +44,8 @@ textarea {
 
   display: block;
 
-  &#instanceShortDescription {
-    height: 100px;
+  &.small {
+    height: 75px;
   }
 }
 
index 3119ab0408fb569c353f53024cfdbe481f8a0e0f..e6f56bc97448f32cfffa9f85242e1ce4c97edb8b 100644 (file)
@@ -100,6 +100,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
 
         terms: null,
         codeOfConduct: null,
+
+        creationReason: null,
         moderationInformation: null,
         administrator: null,
         maintenanceLifetime: null,
index f84ecfcf9719344a91d87f53e8f0c7d673cef08a..7ed096dcd031cdb3cbd381c03dfa0318885e0a5c 100644 (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: ''
 
index 397e52740b4c9851a4f74fde1b2807cc43374234..b86068bde0eb2f8cac5e2cf08fb25aa5e6f8e9d6 100644 (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
index b5244756df34bc1e426e149cf972f1a6b916e512..909907ad60c72274560644d7fe7c0bfc6f683aeb 100644 (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,
index 4e2b07e64462add98c2a9fbe455704feefbd072e..8df411ca5e6f4f242856268335f9ca4c86220114 100644 (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') },
index f716dc673ce277063a0a6eec73fe995e73d091b9..9b902a1cd5a511e5ba370862041f3ed4ac06accf 100644 (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',
index da75495a566fc2a4c98abe204c402ae876febe85..85d0f970215198fb8ccab404f3988cf8de1e46fb 100644 (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',
index 785421c98d48ce068ae6054b34bd14d8095511b8..66e0a008ec656cc0b89343fecc0f1b7b7b41de0d 100644 (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',
index e32ed26ee267e75258f411618d613c1961238501..bde4e0b5033af15f516bb1f03aaff40f8a0be81b 100644 (file)
@@ -7,6 +7,7 @@ export interface About {
 
     codeOfConduct: string
 
+    creationReason: string
     moderationInformation: string
     administrator: string
     maintenanceLifetime: string
index 0c331a820601068f06c4a5b6128cf5cac900b018..a7c2a3bab16a77ba7dd014747fe4a8ed7b4f7e72 100644 (file)
@@ -8,6 +8,7 @@ export interface CustomConfig {
     terms: string
     codeOfConduct: string
 
+    creationReason: string
     moderationInformation: string
     administrator: string
     maintenanceLifetime: string