ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix checkbox margins
Chocobozzz361805c48b14
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.htmlindex dfbbfbb292..fd4d3d9c9e 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html@@ -87,15 +87,19 @@<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>@@ -110,15 +114,19 @@<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>@@ -184,13 +192,15 @@</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>@@ -199,11 +209,13 @@<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()">@@ -226,7 +238,6 @@[inputName]="getResolutionKey(resolution)" [formControlName]="getResolutionKey(resolution)"i18n-labelText labelText="Resolution {{resolution}} enabled"></my-peertube-checkbox>-</div></ng-template>diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.htmlindex 8be8a66ccb..049119fa83 100644--- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html+++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html@@ -15,15 +15,19 @@</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>diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.tsindex bcbd9be59d..79b76fa0b8 100644--- a/server/helpers/activitypub.ts+++ b/server/helpers/activitypub.ts@@ -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,buildSignedActivitydiff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.tsindex 218dbc6a7f..504263c999 100644--- a/server/lib/activitypub/actor.ts+++ b/server/lib/activitypub/actor.ts@@ -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 = falselet actor = await fetchActorByUrl(actorUrl, fetchType)diff --git a/server/lib/activitypub/process/process.ts b/server/lib/activitypub/process/process.tsindex b9b255ddfc..bcc5cac7ac 100644--- a/server/lib/activitypub/process/process.ts+++ b/server/lib/activitypub/process/process.ts@@ -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 signatureif (options.signatureActor && actorUrl !== options.signatureActor.url) {diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.tsindex d2649e2d59..5dcba778cf 100644--- a/server/lib/activitypub/share.ts+++ b/server/lib/activitypub/share.ts@@ -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}`)}diff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.tsindex 1854b44c4e..2cce67f0c8 100644--- a/server/lib/activitypub/video-rates.ts+++ b/server/lib/activitypub/video-rates.ts@@ -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}`)}diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.tsindex 6ff9baefe3..4cecf93459 100644--- a/server/lib/activitypub/videos.ts+++ b/server/lib/activitypub/videos.ts@@ -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) {