Fix checkbox margins

This commit is contained in:
Chocobozzz 2018-11-19 14:34:01 +01:00
parent a8a6322778
commit 361805c48b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
8 changed files with 69 additions and 54 deletions

View File

@ -87,15 +87,19 @@
<div i18n class="inner-form-title">Signup</div> <div i18n class="inner-form-title">Signup</div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="signupEnabled" formControlName="signupEnabled" inputName="signupEnabled" formControlName="signupEnabled"
i18n-labelText labelText="Signup enabled" i18n-labelText labelText="Signup enabled"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<div class="form-group">
<my-peertube-checkbox *ngIf="isSignupEnabled()" <my-peertube-checkbox *ngIf="isSignupEnabled()"
inputName="signupRequiresEmailVerification" formControlName="signupRequiresEmailVerification" inputName="signupRequiresEmailVerification" formControlName="signupRequiresEmailVerification"
i18n-labelText labelText="Signup requires email verification" i18n-labelText labelText="Signup requires email verification"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<div *ngIf="isSignupEnabled()" class="form-group"> <div *ngIf="isSignupEnabled()" class="form-group">
<label i18n for="signupLimit">Signup limit</label> <label i18n for="signupLimit">Signup limit</label>
@ -110,15 +114,19 @@
<div i18n class="inner-form-title">Import</div> <div i18n class="inner-form-title">Import</div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="importVideosHttpEnabled" formControlName="importVideosHttpEnabled" inputName="importVideosHttpEnabled" formControlName="importVideosHttpEnabled"
i18n-labelText labelText="Video import with HTTP URL (i.e. YouTube) enabled" i18n-labelText labelText="Video import with HTTP URL (i.e. YouTube) enabled"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="importVideosTorrentEnabled" formControlName="importVideosTorrentEnabled" inputName="importVideosTorrentEnabled" formControlName="importVideosTorrentEnabled"
i18n-labelText labelText="Video import with a torrent file or a magnet URI enabled" i18n-labelText labelText="Video import with a torrent file or a magnet URI enabled"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<div i18n class="inner-form-title">Administrator</div> <div i18n class="inner-form-title">Administrator</div>
@ -184,6 +192,7 @@
</div> </div>
</div> </div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="servicesTwitterWhitelisted" formControlName="servicesTwitterWhitelisted" inputName="servicesTwitterWhitelisted" formControlName="servicesTwitterWhitelisted"
i18n-labelText labelText="Instance whitelisted by Twitter" i18n-labelText labelText="Instance whitelisted by Twitter"
@ -191,6 +200,7 @@
If the instance is not whitelisted, we use an image link card that will redirect on your PeerTube instance.<br /><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." 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> ></my-peertube-checkbox>
</div>
</ng-template> </ng-template>
</ngb-tab> </ngb-tab>
@ -199,11 +209,13 @@
<div i18n class="inner-form-title">Transcoding</div> <div i18n class="inner-form-title">Transcoding</div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="transcodingEnabled" formControlName="transcodingEnabled" inputName="transcodingEnabled" formControlName="transcodingEnabled"
i18n-labelText labelText="Transcoding enabled" i18n-labelText labelText="Transcoding enabled"
i18n-helpHtml helpHtml="If you disable transcoding, many videos from your users will not work!" i18n-helpHtml helpHtml="If you disable transcoding, many videos from your users will not work!"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<ng-template [ngIf]="isTranscodingEnabled()"> <ng-template [ngIf]="isTranscodingEnabled()">
@ -226,7 +238,6 @@
[inputName]="getResolutionKey(resolution)" [formControlName]="getResolutionKey(resolution)" [inputName]="getResolutionKey(resolution)" [formControlName]="getResolutionKey(resolution)"
i18n-labelText labelText="Resolution {{resolution}} enabled" i18n-labelText labelText="Resolution {{resolution}} enabled"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div> </div>
</ng-template> </ng-template>

View File

@ -15,15 +15,19 @@
</div> </div>
</div> </div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="webTorrentEnabled" formControlName="webTorrentEnabled" inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others" i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<div class="form-group">
<my-peertube-checkbox <my-peertube-checkbox
inputName="autoPlayVideo" formControlName="autoPlayVideo" inputName="autoPlayVideo" formControlName="autoPlayVideo"
i18n-labelText labelText="Automatically plays video" i18n-labelText labelText="Automatically plays video"
></my-peertube-checkbox> ></my-peertube-checkbox>
</div>
<input type="submit" i18n-value value="Save" [disabled]="!form.valid"> <input type="submit" i18n-value value="Save" [disabled]="!form.valid">
</form> </form>

View File

@ -1,7 +1,7 @@
import * as Bluebird from 'bluebird' import * as Bluebird from 'bluebird'
import * as validator from 'validator' import * as validator from 'validator'
import { ResultList } from '../../shared/models' import { ResultList } from '../../shared/models'
import { Activity, ActivityPubActor } from '../../shared/models/activitypub' import { Activity } from '../../shared/models/activitypub'
import { ACTIVITY_PUB } from '../initializers' import { ACTIVITY_PUB } from '../initializers'
import { ActorModel } from '../models/activitypub/actor' import { ActorModel } from '../models/activitypub/actor'
import { signJsonLDObject } from './peertube-crypto' import { signJsonLDObject } from './peertube-crypto'
@ -106,10 +106,10 @@ function buildSignedActivity (byActor: ActorModel, data: Object) {
return signJsonLDObject(byActor, activity) as Promise<Activity> return signJsonLDObject(byActor, activity) as Promise<Activity>
} }
function getActorUrl (activityActor: string | ActivityPubActor) { function getAPUrl (activity: string | { id: string }) {
if (typeof activityActor === 'string') return activityActor if (typeof activity === 'string') return activity
return activityActor.id return activity.id
} }
function checkUrlsSameHost (url1: string, url2: string) { function checkUrlsSameHost (url1: string, url2: string) {
@ -123,7 +123,7 @@ function checkUrlsSameHost (url1: string, url2: string) {
export { export {
checkUrlsSameHost, checkUrlsSameHost,
getActorUrl, getAPUrl,
activityPubContextify, activityPubContextify,
activityPubCollectionPagination, activityPubCollectionPagination,
buildSignedActivity buildSignedActivity

View File

@ -5,15 +5,15 @@ import * as url from 'url'
import * as uuidv4 from 'uuid/v4' import * as uuidv4 from 'uuid/v4'
import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub' import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects' 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 { isActorObjectValid, normalizeActor } from '../../helpers/custom-validators/activitypub/actor'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils' import { retryTransactionWrapper, updateInstanceWithAnother } from '../../helpers/database-utils'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto' 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 { 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 { AccountModel } from '../../models/account/account'
import { ActorModel } from '../../models/activitypub/actor' import { ActorModel } from '../../models/activitypub/actor'
import { AvatarModel } from '../../models/avatar/avatar' import { AvatarModel } from '../../models/avatar/avatar'
@ -43,7 +43,7 @@ async function getOrCreateActorAndServerAndModel (
recurseIfNeeded = true, recurseIfNeeded = true,
updateCollections = false updateCollections = false
) { ) {
const actorUrl = getActorUrl(activityActor) const actorUrl = getAPUrl(activityActor)
let created = false let created = false
let actor = await fetchActorByUrl(actorUrl, fetchType) let actor = await fetchActorByUrl(actorUrl, fetchType)

View File

@ -1,5 +1,5 @@
import { Activity, ActivityType } from '../../../../shared/models/activitypub' 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 { logger } from '../../../helpers/logger'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/activitypub/actor'
import { processAcceptActivity } from './process-accept' import { processAcceptActivity } from './process-accept'
@ -40,7 +40,7 @@ async function processActivities (
continue continue
} }
const actorUrl = getActorUrl(activity.actor) const actorUrl = getAPUrl(activity.actor)
// When we fetch remote data, we don't have signature // When we fetch remote data, we don't have signature
if (options.signatureActor && actorUrl !== options.signatureActor.url) { if (options.signatureActor && actorUrl !== options.signatureActor.url) {

View File

@ -11,7 +11,7 @@ import { doRequest } from '../../helpers/requests'
import { getOrCreateActorAndServerAndModel } from './actor' import { getOrCreateActorAndServerAndModel } from './actor'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers' 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) { async function shareVideoByServerAndChannel (video: VideoModel, t: Transaction) {
if (video.privacy === VideoPrivacy.PRIVATE) return undefined 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') 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) { if (checkUrlsSameHost(shareUrl, actorUrl) !== true) {
throw new Error(`Actor url ${actorUrl} has not the same host than the share url ${shareUrl}`) throw new Error(`Actor url ${actorUrl} has not the same host than the share url ${shareUrl}`)
} }

View File

@ -9,7 +9,7 @@ import { AccountVideoRateModel } from '../../models/account/account-video-rate'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers' import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers'
import { doRequest } from '../../helpers/requests' import { doRequest } from '../../helpers/requests'
import { checkUrlsSameHost, getActorUrl } from '../../helpers/activitypub' import { checkUrlsSameHost, getAPUrl } from '../../helpers/activitypub'
import { ActorModel } from '../../models/activitypub/actor' import { ActorModel } from '../../models/activitypub/actor'
import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from './url' 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') 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) { if (checkUrlsSameHost(actorUrl, rateUrl) !== true) {
throw new Error(`Rate url ${rateUrl} has not the same host than actor url ${actorUrl}`) throw new Error(`Rate url ${rateUrl} has not the same host than actor url ${actorUrl}`)
} }

View File

@ -29,7 +29,7 @@ import { createRates } from './video-rates'
import { addVideoShares, shareVideoByServerAndChannel } from './share' import { addVideoShares, shareVideoByServerAndChannel } from './share'
import { AccountModel } from '../../models/account/account' import { AccountModel } from '../../models/account/account'
import { fetchVideoByUrl, VideoFetchByUrlType } from '../../helpers/video' 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) { async function federateVideoIfNeeded (video: VideoModel, isNewVideo: boolean, transaction?: sequelize.Transaction) {
// If the video is not private and published, we federate it // If the video is not private and published, we federate it
@ -167,7 +167,7 @@ async function getOrCreateVideoAndAccountAndChannel (options: {
const refreshViews = options.refreshViews || false const refreshViews = options.refreshViews || false
// Get video url // 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) let videoFromDatabase = await fetchVideoByUrl(videoUrl, fetchType)
if (videoFromDatabase) { if (videoFromDatabase) {