Add description for sensitive configuration options, reword others
authorRigel Kent <sendmemail@rigelk.eu>
Wed, 15 Jan 2020 11:15:31 +0000 (12:15 +0100)
committerRigel Kent <sendmemail@rigelk.eu>
Wed, 15 Jan 2020 11:15:31 +0000 (12:15 +0100)
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
client/src/app/search/search.component.html
client/src/app/shared/forms/peertube-checkbox.component.html
client/src/app/shared/forms/peertube-checkbox.component.scss
config/default.yaml
config/production.yaml.example

index ac0447d257d2c069aa21e0b26d98d30c1b08272f..f6159367771ee9b7bb752756cbdb5491b4deca12 100644 (file)
 
           <div class="form-group">
             <label i18n for="instanceBusinessModel">How will you finance the PeerTube server?</label>
-            <div class="label-small-info">With you own funds? With users donations? Advertising?</div>
+            <div class="label-small-info">With your own funds? With users donations? Advertising?</div>
 
             <textarea
               id="instanceBusinessModel" formControlName="businessModel" class="small"
             <my-peertube-checkbox
               inputName="signupEnabled" formControlName="enabled"
               i18n-labelText labelText="Signup enabled"
-            ></my-peertube-checkbox>
-          </div>
-
-          <div class="form-group">
-            <my-peertube-checkbox *ngIf="isSignupEnabled()"
-              inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification"
-              i18n-labelText labelText="Signup requires email verification"
-            ></my-peertube-checkbox>
-          </div>
-
-          <div *ngIf="isSignupEnabled()" class="form-group">
-            <label i18n for="signupLimit">Signup limit</label>
-            <input
-              type="text" id="signupLimit"
-              formControlName="limit" [ngClass]="{ 'input-error': formErrors['signup.limit'] }"
             >
-            <div *ngIf="formErrors.signup.limit" class="form-error">{{ formErrors.signup.limit }}</div>
+              <ng-container ngProjectAs="extra">
+                <my-peertube-checkbox [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }"
+                  inputName="signupRequiresEmailVerification" formControlName="requiresEmailVerification"
+                  i18n-labelText labelText="Signup requires email verification"
+                ></my-peertube-checkbox>
+      
+                <div [ngClass]="{ 'disabled-checkbox-extra': !isSignupEnabled() }" class="mt-3">
+                  <label i18n for="signupLimit">Signup limit</label>
+                  <input
+                    type="text" id="signupLimit"
+                    formControlName="limit" [ngClass]="{ 'input-error': formErrors['signup.limit'] }"
+                  >
+                  <div *ngIf="formErrors.signup.limit" class="form-error">{{ formErrors.signup.limit }}</div>
+                </div>
+              </ng-container>
+            </my-peertube-checkbox>
           </div>
         </ng-container>
 
             <div class="form-group" formGroupName="http">
               <my-peertube-checkbox
                 inputName="importVideosHttpEnabled" formControlName="enabled"
-                i18n-labelText labelText="Video import with HTTP URL (i.e. YouTube) enabled"
+                i18n-labelText labelText="Allow import with HTTP URL (i.e. YouTube)"
               ></my-peertube-checkbox>
             </div>
 
             <div class="form-group" formGroupName="torrent">
               <my-peertube-checkbox
                 inputName="importVideosTorrentEnabled" formControlName="enabled"
-                i18n-labelText labelText="Video import with a torrent file or a magnet URI enabled"
+                i18n-labelText labelText="Allow import with a torrent file or a magnet URI"
               ></my-peertube-checkbox>
             </div>
 
               <div class="form-group">
                 <my-peertube-checkbox
                   inputName="autoBlacklistVideosOfUsersEnabled" formControlName="enabled"
-                  i18n-labelText labelText="New videos of users automatically blacklisted enabled"
-                ></my-peertube-checkbox>
+                  i18n-labelText labelText="Blacklist new videos automatically"
+                >
+                <ng-container ngProjectAs="description">
+                  <span i18n>Videos of regular users will stay private until a moderator reviews them. Can be overriden per user.</span>
+                </ng-container>
+              </my-peertube-checkbox>
               </div>
 
             </ng-container>
             <div class="form-group">
               <my-peertube-checkbox
                 inputName="followersInstanceManualApproval" formControlName="manualApproval"
-                i18n-labelText labelText="Manually approve new instance follower"
+                i18n-labelText labelText="Manually approve new instance followers"
               ></my-peertube-checkbox>
             </div>
           </ng-container>
                 <my-peertube-checkbox
                   inputName="followingsInstanceAutoFollowBackEnabled" formControlName="enabled"
                   i18n-labelText labelText="Automatically follow other instances that follow you"
-                ></my-peertube-checkbox>
+                >
+                  <ng-container ngProjectAs="description">
+                    <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
+                  </ng-container>
+                </my-peertube-checkbox>
               </div>
             </ng-container>
 
               <div class="form-group">
                 <my-peertube-checkbox
                   inputName="followingsInstanceAutoFollowIndexEnabled" formControlName="enabled"
-                  i18n-labelText labelText="Automatically follow instance of the public index (below)"
-                ></my-peertube-checkbox>
-              </div>
-
-              <div class="form-group">
-                <label i18n for="followingsInstanceAutoFollowIndexUrl">Index URL</label>
-                <input
-                  type="text" id="followingsInstanceAutoFollowIndexUrl"
-                  formControlName="indexUrl" [ngClass]="{ 'input-error': formErrors['followings.instance.autoFollowIndex.indexUrl'] }"
+                  i18n-labelText labelText="Automatically follow instances of the public index"
+                  [(ngModel)]="isAutoFollowIndexEnabled"
                 >
-                <div *ngIf="formErrors.followings.instance.autoFollowIndex.indexUrl" class="form-error">{{ formErrors.followings.instance.autoFollowIndex.indexUrl }}</div>
+                  <ng-container ngProjectAs="description">
+                    <span i18n>⚠️ This functionality requires a lot of attention and extra moderation.</span>
+                  </ng-container>
+
+                  <ng-container ngProjectAs="extra">
+                    <div [ngClass]="{ 'disabled-checkbox-extra': !isAutoFollowIndexEnabled }">
+                      <label i18n for="followingsInstanceAutoFollowIndexUrl">Index URL</label>
+                      <input
+                        type="text" id="followingsInstanceAutoFollowIndexUrl"
+                        formControlName="indexUrl" [ngClass]="{ 'input-error': formErrors['followings.instance.autoFollowIndex.indexUrl'] }"
+                      >
+                      <div *ngIf="formErrors.followings.instance.autoFollowIndex.indexUrl" class="form-error">{{ formErrors.followings.instance.autoFollowIndex.indexUrl }}</div>
+                    </div>
+                  </ng-container>
+                </my-peertube-checkbox>
               </div>
 
             </ng-container>
index 2b4d0da2cc9e83996f00c54af0515e37f8920061..60d608028c3a1c72c3ff51fc8e9aa46b56322e72 100644 (file)
@@ -53,3 +53,8 @@ textarea {
   font-style: italic;
   margin-bottom: 10px;
 }
+
+.disabled-checkbox-extra {
+  opacity: .5;
+  pointer-events: none;
+}
index 49bb4db0e10f04eff0aadf321798da0e0ea3682f..1bc907b7311e6fca6804d8401789b1e0856fe2f3 100644 (file)
@@ -24,6 +24,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
   languageItems: SelectItem[] = []
   categoryItems: SelectItem[] = []
 
+  isAutoFollowIndexEnabled = false
+
   private serverConfig: ServerConfig
 
   constructor (
index 496ee970ab076d03ddda523d9c749da4ece45b71..a4a1d41b3d89e429231e708c99f83e2206009ac1 100644 (file)
@@ -2,7 +2,7 @@
   <div class="results-header">
     <div class="first-line">
       <div class="results-counter" *ngIf="pagination.totalItems">
-        <span i18n>{{ pagination.totalItems | myNumberFormatter }} results</span>
+        <span i18n>{{ pagination.totalItems | myNumberFormatter }} {pagination.totalItems, plural, =1 {result} other {results}}</span>
         <span *ngIf="currentSearch" i18n>
           for <span class="search-value">{{ currentSearch }}</span>
         </span>
index 1c0114d970e757f85a025867825c4c7d142d7acc..c740d852c73644a67d81377f0851bbf4a5d0db6d 100644 (file)
@@ -1,18 +1,43 @@
-<div class="root">
-  <label class="form-group-checkbox">
-    <input type="checkbox" [(ngModel)]="checked" (ngModelChange)="onModelChange()" [id]="inputName" [disabled]="disabled" />
-    <span role="checkbox" [attr.aria-checked]="checked"></span>
-    <span *ngIf="labelText">{{ labelText }}</span>
-    <span *ngIf="!labelText && labelInnerHTML" [innerHTML]="labelInnerHTML"></span>
+<div class="root flex-column">
+  <div class="d-flex">
+    <label class="form-group-checkbox">
+      <input
+        type="checkbox"
+        [(ngModel)]="checked"
+        (ngModelChange)="onModelChange()"
+        [id]="inputName"
+        [disabled]="disabled"
+      />
+      <span role="checkbox" [attr.aria-checked]="checked"></span>
+      <span *ngIf="labelText">{{ labelText }}</span>
+      <span
+        *ngIf="!labelText && labelInnerHTML"
+        [innerHTML]="labelInnerHTML"
+      ></span>
 
-    <span *ngIf="labelTemplate">
-      <ng-container *ngTemplateOutlet="labelTemplate"></ng-container>
-    </span>
-  </label>
+      <span *ngIf="labelTemplate">
+        <ng-container *ngTemplateOutlet="labelTemplate"></ng-container>
+      </span>
+    </label>
+
+    <my-help
+      *ngIf="helpTemplate"
+      [tooltipPlacement]="helpPlacement"
+      helpType="custom"
+    >
+      <ng-template ptTemplate="customHtml">
+        <ng-template *ngTemplateOutlet="helpTemplate"></ng-template>
+      </ng-template>
+    </my-help>
+  </div>
 
-  <my-help *ngIf="helpTemplate" [tooltipPlacement]="helpPlacement" helpType="custom">
-    <ng-template ptTemplate="customHtml">
-      <ng-template *ngTemplateOutlet="helpTemplate"></ng-template>
-    </ng-template>
-  </my-help>
+  <div class="ml-4 d-flex flex-column">
+    <small class="wrapper mt-2 text-muted">
+      <ng-content select="description"></ng-content>
+    </small>
+
+    <span class="wrapper mt-3">
+      <ng-content select="extra"></ng-content>
+    </span>
+  </div>
 </div>
index 3b467d49d35570456c3e6279e403010f4cae3656..3120509b3b46a9d78b752ac01de59c691090a436 100644 (file)
     position: relative;
     top: 2px;
   }
-}
+
+  small {
+    font-size: 90%;
+  }
+
+  .wrapper:empty {
+    display: none;
+  }
+}
\ No newline at end of file
index 8e866c1264029ac9683514b33d914e13e44bceb2..ce2b20c75a8a698c0f0f3d075e0eb5f5424df3af 100644 (file)
@@ -262,7 +262,7 @@ instance:
   # 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?
+  # How will you pay the PeerTube instance server? With your own funds? With users donations? Advertising?
   business_model: ''
 
   # If you want to explain on what type of hardware your PeerTube instance runs
index 68d29d26faf85a301588aacb5580d12c379d7d60..52892acfb4e82ac92caa75990602dfb4f9c3ae22 100644 (file)
@@ -277,7 +277,7 @@ instance:
   # 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?
+  # How will you pay the PeerTube instance server? With your own funds? With users donations? Advertising?
   business_model: ''
 
   # If you want to explain on what type of hardware your PeerTube instance runs