Fix checkbox margins
authorChocobozzz <me@florianbigard.com>
Mon, 19 Nov 2018 13:34:01 +0000 (14:34 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 19 Nov 2018 13:34:36 +0000 (14:34 +0100)
client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
server/helpers/activitypub.ts
server/lib/activitypub/actor.ts
server/lib/activitypub/process/process.ts
server/lib/activitypub/share.ts
server/lib/activitypub/video-rates.ts
server/lib/activitypub/videos.ts

index dfbbfbb292bc0a4e77b4d409fb797184d13327bc..fd4d3d9c9e4181a24f487ff1f0e46f6b61deaf2b 100644 (file)
 
         <div i18n class="inner-form-title">Signup</div>
 
-        <my-peertube-checkbox
-          inputName="signupEnabled" formControlName="signupEnabled"
-          i18n-labelText labelText="Signup enabled"
-        ></my-peertube-checkbox>
+        <div class="form-group">
+          <my-peertube-checkbox
+            inputName="signupEnabled" formControlName="signupEnabled"
+            i18n-labelText labelText="Signup enabled"
+          ></my-peertube-checkbox>
+        </div>
 
-        <my-peertube-checkbox *ngIf="isSignupEnabled()"
-          inputName="signupRequiresEmailVerification" formControlName="signupRequiresEmailVerification"
-          i18n-labelText labelText="Signup requires email verification"
-        ></my-peertube-checkbox>
+        <div class="form-group">
+          <my-peertube-checkbox *ngIf="isSignupEnabled()"
+            inputName="signupRequiresEmailVerification" formControlName="signupRequiresEmailVerification"
+            i18n-labelText labelText="Signup requires email verification"
+          ></my-peertube-checkbox>
+        </div>
 
         <div *ngIf="isSignupEnabled()" class="form-group">
           <label i18n for="signupLimit">Signup limit</label>
 
         <div i18n class="inner-form-title">Import</div>
 
-        <my-peertube-checkbox
-          inputName="importVideosHttpEnabled" formControlName="importVideosHttpEnabled"
-          i18n-labelText labelText="Video import with HTTP URL (i.e. YouTube) enabled"
-        ></my-peertube-checkbox>
+        <div class="form-group">
+          <my-peertube-checkbox
+            inputName="importVideosHttpEnabled" formControlName="importVideosHttpEnabled"
+            i18n-labelText labelText="Video import with HTTP URL (i.e. YouTube) enabled"
+          ></my-peertube-checkbox>
+        </div>
 
-        <my-peertube-checkbox
-          inputName="importVideosTorrentEnabled" formControlName="importVideosTorrentEnabled"
-          i18n-labelText labelText="Video import with a torrent file or a magnet URI enabled"
-        ></my-peertube-checkbox>
+        <div class="form-group">
+          <my-peertube-checkbox
+            inputName="importVideosTorrentEnabled" formControlName="importVideosTorrentEnabled"
+            i18n-labelText labelText="Video import with a torrent file or a magnet URI enabled"
+          ></my-peertube-checkbox>
+        </div>
 
         <div i18n class="inner-form-title">Administrator</div>
 
           </div>
         </div>
 
-        <my-peertube-checkbox
-          inputName="servicesTwitterWhitelisted" formControlName="servicesTwitterWhitelisted"
-          i18n-labelText labelText="Instance whitelisted by Twitter"
-          i18n-helpHtml helpHtml="If your instance is whitelisted by Twitter, a video player will be embedded in the Twitter feed on PeerTube video share.<br />
-  If the instance is not whitelisted, we use an image link card that will redirect on your PeerTube instance.<br /><br />
-  Check this checkbox, save the configuration and test with a video URL of your instance (https://example.com/videos/watch/blabla) on <a target='_blank' rel='noopener noreferrer' href='https://cards-dev.twitter.com/validator'>https://cards-dev.twitter.com/validator</a> to see if you instance is whitelisted."
-        ></my-peertube-checkbox>
+        <div class="form-group">
+          <my-peertube-checkbox
+            inputName="servicesTwitterWhitelisted" formControlName="servicesTwitterWhitelisted"
+            i18n-labelText labelText="Instance whitelisted by Twitter"
+            i18n-helpHtml helpHtml="If your instance is whitelisted by Twitter, a video player will be embedded in the Twitter feed on PeerTube video share.<br />
+    If the instance is not whitelisted, we use an image link card that will redirect on your PeerTube instance.<br /><br />
+    Check this checkbox, save the configuration and test with a video URL of your instance (https://example.com/videos/watch/blabla) on <a target='_blank' rel='noopener noreferrer' href='https://cards-dev.twitter.com/validator'>https://cards-dev.twitter.com/validator</a> to see if you instance is whitelisted."
+          ></my-peertube-checkbox>
+        </div>
     </ng-template>
     </ngb-tab>
 
 
         <div i18n class="inner-form-title">Transcoding</div>
 
-        <my-peertube-checkbox
-          inputName="transcodingEnabled" formControlName="transcodingEnabled"
-          i18n-labelText labelText="Transcoding enabled"
-          i18n-helpHtml helpHtml="If you disable transcoding, many videos from your users will not work!"
-        ></my-peertube-checkbox>
+        <div class="form-group">
+          <my-peertube-checkbox
+            inputName="transcodingEnabled" formControlName="transcodingEnabled"
+            i18n-labelText labelText="Transcoding enabled"
+            i18n-helpHtml helpHtml="If you disable transcoding, many videos from your users will not work!"
+          ></my-peertube-checkbox>
+        </div>
 
         <ng-template [ngIf]="isTranscodingEnabled()">
 
               [inputName]="getResolutionKey(resolution)" [formControlName]="getResolutionKey(resolution)"
               i18n-labelText labelText="Resolution {{resolution}} enabled"
             ></my-peertube-checkbox>
-
           </div>
         </ng-template>
 
index 8be8a66ccb7ba650db3b143a292fda4dd6b286ae..049119fa83f86ae9a13a37cb264a4904a8e87b82 100644 (file)
     </div>
   </div>
 
-  <my-peertube-checkbox
-    inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
-    i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
-  ></my-peertube-checkbox>
+  <div class="form-group">
+    <my-peertube-checkbox
+      inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
+      i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
+    ></my-peertube-checkbox>
+  </div>
 
-  <my-peertube-checkbox
-    inputName="autoPlayVideo" formControlName="autoPlayVideo"
-    i18n-labelText labelText="Automatically plays video"
-  ></my-peertube-checkbox>
+  <div class="form-group">
+    <my-peertube-checkbox
+      inputName="autoPlayVideo" formControlName="autoPlayVideo"
+      i18n-labelText labelText="Automatically plays video"
+    ></my-peertube-checkbox>
+  </div>
 
   <input type="submit" i18n-value value="Save" [disabled]="!form.valid">
 </form>
index bcbd9be59d52bb07bb2d19b248698ec96c98e244..79b76fa0b89e2636bf6dc177363f2f8c9ffbc1c3 100644 (file)
@@ -1,7 +1,7 @@
 import * as Bluebird from 'bluebird'
 import * as validator from 'validator'
 import { ResultList } from '../../shared/models'
-import { Activity, ActivityPubActor } from '../../shared/models/activitypub'
+import { Activity } from '../../shared/models/activitypub'
 import { ACTIVITY_PUB } from '../initializers'
 import { ActorModel } from '../models/activitypub/actor'
 import { signJsonLDObject } from './peertube-crypto'
@@ -106,10 +106,10 @@ function buildSignedActivity (byActor: ActorModel, data: Object) {
   return signJsonLDObject(byActor, activity) as Promise<Activity>
 }
 
-function getActorUrl (activityActor: string | ActivityPubActor) {
-  if (typeof activityActor === 'string') return activityActor
+function getAPUrl (activity: string | { id: string }) {
+  if (typeof activity === 'string') return activity
 
-  return activityActor.id
+  return activity.id
 }
 
 function checkUrlsSameHost (url1: string, url2: string) {
@@ -123,7 +123,7 @@ function checkUrlsSameHost (url1: string, url2: string) {
 
 export {
   checkUrlsSameHost,
-  getActorUrl,
+  getAPUrl,
   activityPubContextify,
   activityPubCollectionPagination,
   buildSignedActivity
index 218dbc6a7f9df0cd9afbd366c483e82aaab85a7d..504263c9998c8b4e3cd9314ce97cd562bfc6b3cb 100644 (file)
@@ -5,15 +5,15 @@ import * as url from 'url'
 import * as uuidv4 from 'uuid/v4'
 import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
 import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'
-import { checkUrlsSameHost, getActorUrl } from '../../helpers/activitypub'
+import { checkUrlsSameHost, getAPUrl } from '../../helpers/activitypub'
 import { isActorObjectValid, normalizeActor } from '../../helpers/custom-validators/activitypub/actor'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
 import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils'
 import { logger } from '../../helpers/logger'
 import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto'
-import { doRequest, doRequestAndSaveToFile, downloadImage } from '../../helpers/requests'
+import { doRequest, downloadImage } from '../../helpers/requests'
 import { getUrlFromWebfinger } from '../../helpers/webfinger'
-import { AVATARS_SIZE, CONFIG, IMAGE_MIMETYPE_EXT, PREVIEWS_SIZE, sequelizeTypescript } from '../../initializers'
+import { AVATARS_SIZE, CONFIG, IMAGE_MIMETYPE_EXT, sequelizeTypescript } from '../../initializers'
 import { AccountModel } from '../../models/account/account'
 import { ActorModel } from '../../models/activitypub/actor'
 import { AvatarModel } from '../../models/avatar/avatar'
@@ -43,7 +43,7 @@ async function getOrCreateActorAndServerAndModel (
   recurseIfNeeded = true,
   updateCollections = false
 ) {
-  const actorUrl = getActorUrl(activityActor)
+  const actorUrl = getAPUrl(activityActor)
   let created = false
 
   let actor = await fetchActorByUrl(actorUrl, fetchType)
index b9b255ddfcba2e95128d83b667921f873ea73be0..bcc5cac7ac23e5db390998c11b8fd5cc1e81a6f6 100644 (file)
@@ -1,5 +1,5 @@
 import { Activity, ActivityType } from '../../../../shared/models/activitypub'
-import { checkUrlsSameHost, getActorUrl } from '../../../helpers/activitypub'
+import { checkUrlsSameHost, getAPUrl } from '../../../helpers/activitypub'
 import { logger } from '../../../helpers/logger'
 import { ActorModel } from '../../../models/activitypub/actor'
 import { processAcceptActivity } from './process-accept'
@@ -40,7 +40,7 @@ async function processActivities (
       continue
     }
 
-    const actorUrl = getActorUrl(activity.actor)
+    const actorUrl = getAPUrl(activity.actor)
 
     // When we fetch remote data, we don't have signature
     if (options.signatureActor && actorUrl !== options.signatureActor.url) {
index d2649e2d5977f4a21744b976888b4260d500fdf9..5dcba778cf73a226dbb0e2200e4523e01e603d26 100644 (file)
@@ -11,7 +11,7 @@ import { doRequest } from '../../helpers/requests'
 import { getOrCreateActorAndServerAndModel } from './actor'
 import { logger } from '../../helpers/logger'
 import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers'
-import { checkUrlsSameHost, getActorUrl } from '../../helpers/activitypub'
+import { checkUrlsSameHost, getAPUrl } from '../../helpers/activitypub'
 
 async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) {
   if (video.privacy === VideoPrivacy.PRIVATE) return undefined
@@ -41,7 +41,7 @@ async function addVideoShares (shareUrls: string[], instance: VideoModel) {
       })
       if (!body || !body.actor) throw new Error('Body or body actor is invalid')
 
-      const actorUrl = getActorUrl(body.actor)
+      const actorUrl = getAPUrl(body.actor)
       if (checkUrlsSameHost(shareUrl, actorUrl) !== true) {
         throw new Error(`Actor url ${actorUrl} has not the same host than the share url ${shareUrl}`)
       }
index 1854b44c4e1b9a1553ddb2cd735ceb3e335787d2..2cce67f0c81194e1d018b0f10e298992ad3563a5 100644 (file)
@@ -9,7 +9,7 @@ import { AccountVideoRateModel } from '../../models/account/account-video-rate'
 import { logger } from '../../helpers/logger'
 import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers'
 import { doRequest } from '../../helpers/requests'
-import { checkUrlsSameHost, getActorUrl } from '../../helpers/activitypub'
+import { checkUrlsSameHost, getAPUrl } from '../../helpers/activitypub'
 import { ActorModel } from '../../models/activitypub/actor'
 import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from './url'
 
@@ -26,7 +26,7 @@ async function createRates (ratesUrl: string[], video: VideoModel, rate: VideoRa
       })
       if (!body || !body.actor) throw new Error('Body or body actor is invalid')
 
-      const actorUrl = getActorUrl(body.actor)
+      const actorUrl = getAPUrl(body.actor)
       if (checkUrlsSameHost(actorUrl, rateUrl) !== true) {
         throw new Error(`Rate url ${rateUrl} has not the same host than actor url ${actorUrl}`)
       }
index 6ff9baefe37bffaf6f94f99bff836a9c96d34ac6..4cecf9345912a6d08eb59b73d13a6de183b20036 100644 (file)
@@ -29,7 +29,7 @@ import { createRates } from './video-rates'
 import { addVideoShares, shareVideoByServerAndChannel } from './share'
 import { AccountModel } from '../../models/account/account'
 import { fetchVideoByUrl, VideoFetchByUrlType } from '../../helpers/video'
-import { checkUrlsSameHost } from '../../helpers/activitypub'
+import { checkUrlsSameHost, getAPUrl } from '../../helpers/activitypub'
 
 async function federateVideoIfNeeded (video: VideoModel, isNewVideo: boolean, transaction?: sequelize.Transaction) {
   // If the video is not private and published, we federate it
@@ -167,7 +167,7 @@ async function getOrCreateVideoAndAccountAndChannel (options: {
   const refreshViews = options.refreshViews || false
 
   // Get video url
-  const videoUrl = typeof options.videoObject === 'string' ? options.videoObject : options.videoObject.id
+  const videoUrl = getAPUrl(options.videoObject)
 
   let videoFromDatabase = await fetchVideoByUrl(videoUrl, fetchType)
   if (videoFromDatabase) {