From 2e3a0215d051dca1f7c8ef423564c8d37a255f77 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Mar 2018 14:31:08 +0100 Subject: [PATCH] Add short description in config --- .../edit-custom-config.component.html | 11 +++++++++++ .../edit-custom-config.component.scss | 4 ++++ .../edit-custom-config.component.ts | 7 ++++++- client/src/app/core/server/server.service.ts | 1 + .../shared/forms/form-validators/custom-config.ts | 7 +++++++ config/default.yaml | 1 + config/production.yaml.example | 1 + server/controllers/api/config.ts | 5 +++++ server/initializers/constants.ts | 1 + .../job-queue/handlers/activitypub-http-broadcast.ts | 2 +- .../job-queue/handlers/activitypub-http-unicast.ts | 4 ++-- server/models/activitypub/actor-follow.ts | 2 +- server/tests/api/check-params/config.ts | 1 + server/tests/api/server/config.ts | 12 ++++++++++++ shared/models/server/about.model.ts | 1 + shared/models/server/custom-config.model.ts | 1 + shared/models/server/customization.model.ts | 8 -------- shared/models/server/server-config.model.ts | 1 + support/doc/production.md | 2 ++ 19 files changed, 59 insertions(+), 13 deletions(-) delete mode 100644 shared/models/server/customization.model.ts 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.html index c7ddaaf01..6658a095d 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 @@ -15,6 +15,17 @@ +
+ + +
+ {{ formErrors.instanceShortDescription }} +
+
+
('instance.name') }, + get SHORT_DESCRIPTION () { return config.get('instance.short_description') }, get DESCRIPTION () { return config.get('instance.description') }, get TERMS () { return config.get('instance.terms') }, get DEFAULT_CLIENT_ROUTE () { return config.get('instance.default_client_route') }, diff --git a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts index 159856cda..78878fc01 100644 --- a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts +++ b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts @@ -39,7 +39,7 @@ async function processActivityPubHttpBroadcast (job: kue.Job) { } } - return ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes(goodUrls, badUrls, undefined) + return ActorFollowModel.updateActorFollowsScore(goodUrls, badUrls, undefined) } // --------------------------------------------------------------------------- diff --git a/server/lib/job-queue/handlers/activitypub-http-unicast.ts b/server/lib/job-queue/handlers/activitypub-http-unicast.ts index 9b4188c50..e1e1824e5 100644 --- a/server/lib/job-queue/handlers/activitypub-http-unicast.ts +++ b/server/lib/job-queue/handlers/activitypub-http-unicast.ts @@ -28,9 +28,9 @@ async function processActivityPubHttpUnicast (job: kue.Job) { try { await doRequest(options) - ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) + ActorFollowModel.updateActorFollowsScore([ uri ], [], undefined) } catch (err) { - ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) + ActorFollowModel.updateActorFollowsScore([], [ uri ], undefined) throw err } diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 3c11d1b67..d3c438626 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts @@ -111,7 +111,7 @@ export class ActorFollowModel extends Model { 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 logger.info('Updating %d good actor follows and %d bad actor follows scores.', goodInboxes.length, badInboxes.length) diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index ca8239270..3fe517fad 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -16,6 +16,7 @@ describe('Test config API validators', function () { const updateParams: CustomConfig = { instance: { name: 'PeerTube updated', + shortDescription: 'my short description', description: 'my super description', terms: 'my super terms', defaultClientRoute: '/videos/recently-added', diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 271a57275..e17588142 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -52,6 +52,10 @@ describe('Test config', function () { const data = res.body as CustomConfig 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.terms).to.equal('No terms for now.') expect(data.instance.defaultClientRoute).to.equal('/videos/trending') @@ -75,6 +79,7 @@ describe('Test config', function () { const newCustomConfig = { instance: { name: 'PeerTube updated', + shortDescription: 'my short description', description: 'my super description', terms: 'my super terms', defaultClientRoute: '/videos/recently-added', @@ -116,6 +121,7 @@ describe('Test config', function () { const data = res.body 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.terms).to.equal('my super terms') expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added') @@ -146,6 +152,7 @@ describe('Test config', function () { const data = res.body 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.terms).to.equal('my super terms') expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added') @@ -170,6 +177,7 @@ describe('Test config', function () { const data: About = res.body 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.terms).to.equal('my super terms') }) @@ -183,6 +191,10 @@ describe('Test config', function () { const data = res.body 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.terms).to.equal('No terms for now.') expect(data.instance.defaultClientRoute).to.equal('/videos/trending') diff --git a/shared/models/server/about.model.ts b/shared/models/server/about.model.ts index 7d11da850..10dff8b8f 100644 --- a/shared/models/server/about.model.ts +++ b/shared/models/server/about.model.ts @@ -1,6 +1,7 @@ export interface About { instance: { name: string + shortDescription: string description: string terms: string } diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 7f3e2df02..b4d24cfbe 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts @@ -1,6 +1,7 @@ export interface CustomConfig { instance: { name: string + shortDescription: string description: string terms: string defaultClientRoute: string diff --git a/shared/models/server/customization.model.ts b/shared/models/server/customization.model.ts deleted file mode 100644 index 4e4d0d193..000000000 --- a/shared/models/server/customization.model.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface Customization { - instance: { - customization: { - javascript: string - css: string - } - } -} diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index a30c24eb9..c6fa651a8 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts @@ -3,6 +3,7 @@ export interface ServerConfig { instance: { name: string + shortDescription: string defaultClientRoute: string customizations: { javascript: string diff --git a/support/doc/production.md b/support/doc/production.md index 14042cddf..db0c8d99f 100644 --- a/support/doc/production.md +++ b/support/doc/production.md @@ -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 ``` +Now you can subscribe to the mailing list for PeerTube administrators: https://framalistes.org/sympa/subscribe/peertube-admin + ## Upgrade #### Auto (minor versions only) -- 2.41.0