Add short description in config
This commit is contained in:
parent
44a9a76e29
commit
2e3a0215d0
|
@ -15,6 +15,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="instanceShortDescription">Short description</label>
|
||||||
|
<textarea
|
||||||
|
id="instanceShortDescription" formControlName="instanceShortDescription"
|
||||||
|
[ngClass]="{ 'input-error': formErrors['instanceShortDescription'] }"
|
||||||
|
></textarea>
|
||||||
|
<div *ngIf="formErrors.instanceShortDescription" class="form-error">
|
||||||
|
{{ formErrors.instanceShortDescription }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help>
|
<label for="instanceDescription">Description</label><my-help helpType="markdownText"></my-help>
|
||||||
<my-markdown-textarea
|
<my-markdown-textarea
|
||||||
|
|
|
@ -34,4 +34,8 @@ textarea {
|
||||||
@include peertube-textarea(500px, 150px);
|
@include peertube-textarea(500px, 150px);
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
|
&#instanceShortDescription {
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared'
|
||||||
import {
|
import {
|
||||||
ADMIN_EMAIL,
|
ADMIN_EMAIL,
|
||||||
CACHE_PREVIEWS_SIZE,
|
CACHE_PREVIEWS_SIZE,
|
||||||
INSTANCE_NAME,
|
INSTANCE_NAME, INSTANCE_SHORT_DESCRIPTION,
|
||||||
SIGNUP_LIMIT,
|
SIGNUP_LIMIT,
|
||||||
TRANSCODING_THREADS
|
TRANSCODING_THREADS
|
||||||
} from '@app/shared/forms/form-validators/custom-config'
|
} from '@app/shared/forms/form-validators/custom-config'
|
||||||
|
@ -44,6 +44,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
form: FormGroup
|
form: FormGroup
|
||||||
formErrors = {
|
formErrors = {
|
||||||
instanceName: '',
|
instanceName: '',
|
||||||
|
instanceShortDescription: '',
|
||||||
instanceDescription: '',
|
instanceDescription: '',
|
||||||
instanceTerms: '',
|
instanceTerms: '',
|
||||||
instanceDefaultClientRoute: '',
|
instanceDefaultClientRoute: '',
|
||||||
|
@ -56,6 +57,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
customizationCSS: ''
|
customizationCSS: ''
|
||||||
}
|
}
|
||||||
validationMessages = {
|
validationMessages = {
|
||||||
|
instanceShortDescription: INSTANCE_SHORT_DESCRIPTION.MESSAGES,
|
||||||
instanceName: INSTANCE_NAME.MESSAGES,
|
instanceName: INSTANCE_NAME.MESSAGES,
|
||||||
cachePreviewsSize: CACHE_PREVIEWS_SIZE.MESSAGES,
|
cachePreviewsSize: CACHE_PREVIEWS_SIZE.MESSAGES,
|
||||||
signupLimit: SIGNUP_LIMIT.MESSAGES,
|
signupLimit: SIGNUP_LIMIT.MESSAGES,
|
||||||
|
@ -84,6 +86,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
buildForm () {
|
buildForm () {
|
||||||
const formGroupData = {
|
const formGroupData = {
|
||||||
instanceName: [ '', INSTANCE_NAME.VALIDATORS ],
|
instanceName: [ '', INSTANCE_NAME.VALIDATORS ],
|
||||||
|
instanceShortDescription: [ '', INSTANCE_SHORT_DESCRIPTION.VALIDATORS ],
|
||||||
instanceDescription: [ '' ],
|
instanceDescription: [ '' ],
|
||||||
instanceTerms: [ '' ],
|
instanceTerms: [ '' ],
|
||||||
instanceDefaultClientRoute: [ '' ],
|
instanceDefaultClientRoute: [ '' ],
|
||||||
|
@ -158,6 +161,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
const data: CustomConfig = {
|
const data: CustomConfig = {
|
||||||
instance: {
|
instance: {
|
||||||
name: this.form.value['instanceName'],
|
name: this.form.value['instanceName'],
|
||||||
|
shortDescription: this.form.value['instanceShortDescription'],
|
||||||
description: this.form.value['instanceDescription'],
|
description: this.form.value['instanceDescription'],
|
||||||
terms: this.form.value['instanceTerms'],
|
terms: this.form.value['instanceTerms'],
|
||||||
defaultClientRoute: this.form.value['instanceDefaultClientRoute'],
|
defaultClientRoute: this.form.value['instanceDefaultClientRoute'],
|
||||||
|
@ -214,6 +218,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
private updateForm () {
|
private updateForm () {
|
||||||
const data = {
|
const data = {
|
||||||
instanceName: this.customConfig.instance.name,
|
instanceName: this.customConfig.instance.name,
|
||||||
|
instanceShortDescription: this.customConfig.instance.shortDescription,
|
||||||
instanceDescription: this.customConfig.instance.description,
|
instanceDescription: this.customConfig.instance.description,
|
||||||
instanceTerms: this.customConfig.instance.terms,
|
instanceTerms: this.customConfig.instance.terms,
|
||||||
instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute,
|
instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute,
|
||||||
|
|
|
@ -21,6 +21,7 @@ export class ServerService {
|
||||||
private config: ServerConfig = {
|
private config: ServerConfig = {
|
||||||
instance: {
|
instance: {
|
||||||
name: 'PeerTube',
|
name: 'PeerTube',
|
||||||
|
shortDescription: '',
|
||||||
defaultClientRoute: '',
|
defaultClientRoute: '',
|
||||||
customizations: {
|
customizations: {
|
||||||
javascript: '',
|
javascript: '',
|
||||||
|
|
|
@ -7,6 +7,13 @@ export const INSTANCE_NAME = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const INSTANCE_SHORT_DESCRIPTION = {
|
||||||
|
VALIDATORS: [ Validators.max(250) ],
|
||||||
|
MESSAGES: {
|
||||||
|
'max': 'Short description should not be longer than 250 characters.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const CACHE_PREVIEWS_SIZE = {
|
export const CACHE_PREVIEWS_SIZE = {
|
||||||
VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
|
VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
|
||||||
MESSAGES: {
|
MESSAGES: {
|
||||||
|
|
|
@ -72,6 +72,7 @@ transcoding:
|
||||||
|
|
||||||
instance:
|
instance:
|
||||||
name: 'PeerTube'
|
name: 'PeerTube'
|
||||||
|
short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.'
|
||||||
description: 'Welcome to this PeerTube instance!' # Support markdown
|
description: 'Welcome to this PeerTube instance!' # Support markdown
|
||||||
terms: 'No terms for now.' # Support markdown
|
terms: 'No terms for now.' # Support markdown
|
||||||
default_client_route: '/videos/trending'
|
default_client_route: '/videos/trending'
|
||||||
|
|
|
@ -85,6 +85,7 @@ transcoding:
|
||||||
|
|
||||||
instance:
|
instance:
|
||||||
name: 'PeerTube'
|
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
|
description: '' # Support markdown
|
||||||
terms: '' # Support markdown
|
terms: '' # Support markdown
|
||||||
default_client_route: '/videos/trending'
|
default_client_route: '/videos/trending'
|
||||||
|
|
|
@ -44,6 +44,7 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
|
||||||
const json: ServerConfig = {
|
const json: ServerConfig = {
|
||||||
instance: {
|
instance: {
|
||||||
name: CONFIG.INSTANCE.NAME,
|
name: CONFIG.INSTANCE.NAME,
|
||||||
|
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
|
||||||
defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
|
defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
|
||||||
customizations: {
|
customizations: {
|
||||||
javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT,
|
javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT,
|
||||||
|
@ -85,6 +86,7 @@ function getAbout (req: express.Request, res: express.Response, next: express.Ne
|
||||||
const about: About = {
|
const about: About = {
|
||||||
instance: {
|
instance: {
|
||||||
name: CONFIG.INSTANCE.NAME,
|
name: CONFIG.INSTANCE.NAME,
|
||||||
|
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
|
||||||
description: CONFIG.INSTANCE.DESCRIPTION,
|
description: CONFIG.INSTANCE.DESCRIPTION,
|
||||||
terms: CONFIG.INSTANCE.TERMS
|
terms: CONFIG.INSTANCE.TERMS
|
||||||
}
|
}
|
||||||
|
@ -116,8 +118,10 @@ async function updateCustomConfig (req: express.Request, res: express.Response,
|
||||||
const toUpdateJSON = omit(toUpdate, 'videoQuota')
|
const toUpdateJSON = omit(toUpdate, 'videoQuota')
|
||||||
toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
|
toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
|
||||||
toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute
|
toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute
|
||||||
|
toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription
|
||||||
delete toUpdate.user.videoQuota
|
delete toUpdate.user.videoQuota
|
||||||
delete toUpdate.instance.defaultClientRoute
|
delete toUpdate.instance.defaultClientRoute
|
||||||
|
delete toUpdate.instance.shortDescription
|
||||||
|
|
||||||
await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2))
|
await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2))
|
||||||
|
|
||||||
|
@ -139,6 +143,7 @@ function customConfig (): CustomConfig {
|
||||||
return {
|
return {
|
||||||
instance: {
|
instance: {
|
||||||
name: CONFIG.INSTANCE.NAME,
|
name: CONFIG.INSTANCE.NAME,
|
||||||
|
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
|
||||||
description: CONFIG.INSTANCE.DESCRIPTION,
|
description: CONFIG.INSTANCE.DESCRIPTION,
|
||||||
terms: CONFIG.INSTANCE.TERMS,
|
terms: CONFIG.INSTANCE.TERMS,
|
||||||
defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
|
defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
|
||||||
|
|
|
@ -157,6 +157,7 @@ const CONFIG = {
|
||||||
},
|
},
|
||||||
INSTANCE: {
|
INSTANCE: {
|
||||||
get NAME () { return config.get<string>('instance.name') },
|
get NAME () { return config.get<string>('instance.name') },
|
||||||
|
get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') },
|
||||||
get DESCRIPTION () { return config.get<string>('instance.description') },
|
get DESCRIPTION () { return config.get<string>('instance.description') },
|
||||||
get TERMS () { return config.get<string>('instance.terms') },
|
get TERMS () { return config.get<string>('instance.terms') },
|
||||||
get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') },
|
get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') },
|
||||||
|
|
|
@ -39,7 +39,7 @@ async function processActivityPubHttpBroadcast (job: kue.Job) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes(goodUrls, badUrls, undefined)
|
return ActorFollowModel.updateActorFollowsScore(goodUrls, badUrls, undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -28,9 +28,9 @@ async function processActivityPubHttpUnicast (job: kue.Job) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await doRequest(options)
|
await doRequest(options)
|
||||||
ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined)
|
ActorFollowModel.updateActorFollowsScore([ uri ], [], undefined)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined)
|
ActorFollowModel.updateActorFollowsScore([], [ uri ], undefined)
|
||||||
|
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
|
||||||
if (numberOfActorFollowsRemoved) logger.info('Removed bad %d actor follows.', numberOfActorFollowsRemoved)
|
if (numberOfActorFollowsRemoved) logger.info('Removed bad %d actor follows.', numberOfActorFollowsRemoved)
|
||||||
}
|
}
|
||||||
|
|
||||||
static updateActorFollowsScoreAndRemoveBadOnes (goodInboxes: string[], badInboxes: string[], t: Sequelize.Transaction) {
|
static updateActorFollowsScore (goodInboxes: string[], badInboxes: string[], t: Sequelize.Transaction) {
|
||||||
if (goodInboxes.length === 0 && badInboxes.length === 0) return
|
if (goodInboxes.length === 0 && badInboxes.length === 0) return
|
||||||
|
|
||||||
logger.info('Updating %d good actor follows and %d bad actor follows scores.', goodInboxes.length, badInboxes.length)
|
logger.info('Updating %d good actor follows and %d bad actor follows scores.', goodInboxes.length, badInboxes.length)
|
||||||
|
|
|
@ -16,6 +16,7 @@ describe('Test config API validators', function () {
|
||||||
const updateParams: CustomConfig = {
|
const updateParams: CustomConfig = {
|
||||||
instance: {
|
instance: {
|
||||||
name: 'PeerTube updated',
|
name: 'PeerTube updated',
|
||||||
|
shortDescription: 'my short description',
|
||||||
description: 'my super description',
|
description: 'my super description',
|
||||||
terms: 'my super terms',
|
terms: 'my super terms',
|
||||||
defaultClientRoute: '/videos/recently-added',
|
defaultClientRoute: '/videos/recently-added',
|
||||||
|
|
|
@ -52,6 +52,10 @@ describe('Test config', function () {
|
||||||
const data = res.body as CustomConfig
|
const data = res.body as CustomConfig
|
||||||
|
|
||||||
expect(data.instance.name).to.equal('PeerTube')
|
expect(data.instance.name).to.equal('PeerTube')
|
||||||
|
expect(data.instance.shortDescription).to.equal(
|
||||||
|
'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
|
||||||
|
'with WebTorrent and Angular.'
|
||||||
|
)
|
||||||
expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
|
expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
|
||||||
expect(data.instance.terms).to.equal('No terms for now.')
|
expect(data.instance.terms).to.equal('No terms for now.')
|
||||||
expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
|
expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
|
||||||
|
@ -75,6 +79,7 @@ describe('Test config', function () {
|
||||||
const newCustomConfig = {
|
const newCustomConfig = {
|
||||||
instance: {
|
instance: {
|
||||||
name: 'PeerTube updated',
|
name: 'PeerTube updated',
|
||||||
|
shortDescription: 'my short description',
|
||||||
description: 'my super description',
|
description: 'my super description',
|
||||||
terms: 'my super terms',
|
terms: 'my super terms',
|
||||||
defaultClientRoute: '/videos/recently-added',
|
defaultClientRoute: '/videos/recently-added',
|
||||||
|
@ -116,6 +121,7 @@ describe('Test config', function () {
|
||||||
const data = res.body
|
const data = res.body
|
||||||
|
|
||||||
expect(data.instance.name).to.equal('PeerTube updated')
|
expect(data.instance.name).to.equal('PeerTube updated')
|
||||||
|
expect(data.instance.shortDescription).to.equal('my short description')
|
||||||
expect(data.instance.description).to.equal('my super description')
|
expect(data.instance.description).to.equal('my super description')
|
||||||
expect(data.instance.terms).to.equal('my super terms')
|
expect(data.instance.terms).to.equal('my super terms')
|
||||||
expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
|
expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
|
||||||
|
@ -146,6 +152,7 @@ describe('Test config', function () {
|
||||||
const data = res.body
|
const data = res.body
|
||||||
|
|
||||||
expect(data.instance.name).to.equal('PeerTube updated')
|
expect(data.instance.name).to.equal('PeerTube updated')
|
||||||
|
expect(data.instance.shortDescription).to.equal('my short description')
|
||||||
expect(data.instance.description).to.equal('my super description')
|
expect(data.instance.description).to.equal('my super description')
|
||||||
expect(data.instance.terms).to.equal('my super terms')
|
expect(data.instance.terms).to.equal('my super terms')
|
||||||
expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
|
expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
|
||||||
|
@ -170,6 +177,7 @@ describe('Test config', function () {
|
||||||
const data: About = res.body
|
const data: About = res.body
|
||||||
|
|
||||||
expect(data.instance.name).to.equal('PeerTube updated')
|
expect(data.instance.name).to.equal('PeerTube updated')
|
||||||
|
expect(data.instance.shortDescription).to.equal('my short description')
|
||||||
expect(data.instance.description).to.equal('my super description')
|
expect(data.instance.description).to.equal('my super description')
|
||||||
expect(data.instance.terms).to.equal('my super terms')
|
expect(data.instance.terms).to.equal('my super terms')
|
||||||
})
|
})
|
||||||
|
@ -183,6 +191,10 @@ describe('Test config', function () {
|
||||||
const data = res.body
|
const data = res.body
|
||||||
|
|
||||||
expect(data.instance.name).to.equal('PeerTube')
|
expect(data.instance.name).to.equal('PeerTube')
|
||||||
|
expect(data.instance.shortDescription).to.equal(
|
||||||
|
'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
|
||||||
|
'with WebTorrent and Angular.'
|
||||||
|
)
|
||||||
expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
|
expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
|
||||||
expect(data.instance.terms).to.equal('No terms for now.')
|
expect(data.instance.terms).to.equal('No terms for now.')
|
||||||
expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
|
expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export interface About {
|
export interface About {
|
||||||
instance: {
|
instance: {
|
||||||
name: string
|
name: string
|
||||||
|
shortDescription: string
|
||||||
description: string
|
description: string
|
||||||
terms: string
|
terms: string
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
export interface CustomConfig {
|
export interface CustomConfig {
|
||||||
instance: {
|
instance: {
|
||||||
name: string
|
name: string
|
||||||
|
shortDescription: string
|
||||||
description: string
|
description: string
|
||||||
terms: string
|
terms: string
|
||||||
defaultClientRoute: string
|
defaultClientRoute: string
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
export interface Customization {
|
|
||||||
instance: {
|
|
||||||
customization: {
|
|
||||||
javascript: string
|
|
||||||
css: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ export interface ServerConfig {
|
||||||
|
|
||||||
instance: {
|
instance: {
|
||||||
name: string
|
name: string
|
||||||
|
shortDescription: string
|
||||||
defaultClientRoute: string
|
defaultClientRoute: string
|
||||||
customizations: {
|
customizations: {
|
||||||
javascript: string
|
javascript: string
|
||||||
|
|
|
@ -152,6 +152,8 @@ logs. You can set another password with:
|
||||||
$ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root
|
$ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Now you can subscribe to the mailing list for PeerTube administrators: https://framalistes.org/sympa/subscribe/peertube-admin
|
||||||
|
|
||||||
## Upgrade
|
## Upgrade
|
||||||
|
|
||||||
#### Auto (minor versions only)
|
#### Auto (minor versions only)
|
||||||
|
|
Loading…
Reference in New Issue