aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/config.ts5
-rw-r--r--server/initializers/constants.ts1
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-broadcast.ts2
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-unicast.ts4
-rw-r--r--server/models/activitypub/actor-follow.ts2
-rw-r--r--server/tests/api/check-params/config.ts1
-rw-r--r--server/tests/api/server/config.ts12
7 files changed, 23 insertions, 4 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index a25d7a157..62a783982 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -44,6 +44,7 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
44 const json: ServerConfig = { 44 const json: ServerConfig = {
45 instance: { 45 instance: {
46 name: CONFIG.INSTANCE.NAME, 46 name: CONFIG.INSTANCE.NAME,
47 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
47 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE, 48 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
48 customizations: { 49 customizations: {
49 javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT, 50 javascript: CONFIG.INSTANCE.CUSTOMIZATIONS.JAVASCRIPT,
@@ -85,6 +86,7 @@ function getAbout (req: express.Request, res: express.Response, next: express.Ne
85 const about: About = { 86 const about: About = {
86 instance: { 87 instance: {
87 name: CONFIG.INSTANCE.NAME, 88 name: CONFIG.INSTANCE.NAME,
89 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
88 description: CONFIG.INSTANCE.DESCRIPTION, 90 description: CONFIG.INSTANCE.DESCRIPTION,
89 terms: CONFIG.INSTANCE.TERMS 91 terms: CONFIG.INSTANCE.TERMS
90 } 92 }
@@ -116,8 +118,10 @@ async function updateCustomConfig (req: express.Request, res: express.Response,
116 const toUpdateJSON = omit(toUpdate, 'videoQuota') 118 const toUpdateJSON = omit(toUpdate, 'videoQuota')
117 toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota 119 toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
118 toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute 120 toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute
121 toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription
119 delete toUpdate.user.videoQuota 122 delete toUpdate.user.videoQuota
120 delete toUpdate.instance.defaultClientRoute 123 delete toUpdate.instance.defaultClientRoute
124 delete toUpdate.instance.shortDescription
121 125
122 await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2)) 126 await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2))
123 127
@@ -139,6 +143,7 @@ function customConfig (): CustomConfig {
139 return { 143 return {
140 instance: { 144 instance: {
141 name: CONFIG.INSTANCE.NAME, 145 name: CONFIG.INSTANCE.NAME,
146 shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
142 description: CONFIG.INSTANCE.DESCRIPTION, 147 description: CONFIG.INSTANCE.DESCRIPTION,
143 terms: CONFIG.INSTANCE.TERMS, 148 terms: CONFIG.INSTANCE.TERMS,
144 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE, 149 defaultClientRoute: CONFIG.INSTANCE.DEFAULT_CLIENT_ROUTE,
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 5946bcd11..d12d96803 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -157,6 +157,7 @@ const CONFIG = {
157 }, 157 },
158 INSTANCE: { 158 INSTANCE: {
159 get NAME () { return config.get<string>('instance.name') }, 159 get NAME () { return config.get<string>('instance.name') },
160 get SHORT_DESCRIPTION () { return config.get<string>('instance.short_description') },
160 get DESCRIPTION () { return config.get<string>('instance.description') }, 161 get DESCRIPTION () { return config.get<string>('instance.description') },
161 get TERMS () { return config.get<string>('instance.terms') }, 162 get TERMS () { return config.get<string>('instance.terms') },
162 get DEFAULT_CLIENT_ROUTE () { return config.get<string>('instance.default_client_route') }, 163 get DEFAULT_CLIENT_ROUTE () { return config.get<string>('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) {
39 } 39 }
40 } 40 }
41 41
42 return ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes(goodUrls, badUrls, undefined) 42 return ActorFollowModel.updateActorFollowsScore(goodUrls, badUrls, undefined)
43} 43}
44 44
45// --------------------------------------------------------------------------- 45// ---------------------------------------------------------------------------
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) {
28 28
29 try { 29 try {
30 await doRequest(options) 30 await doRequest(options)
31 ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) 31 ActorFollowModel.updateActorFollowsScore([ uri ], [], undefined)
32 } catch (err) { 32 } catch (err) {
33 ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) 33 ActorFollowModel.updateActorFollowsScore([], [ uri ], undefined)
34 34
35 throw err 35 throw err
36 } 36 }
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<ActorFollowModel> {
111 if (numberOfActorFollowsRemoved) logger.info('Removed bad %d actor follows.', numberOfActorFollowsRemoved) 111 if (numberOfActorFollowsRemoved) logger.info('Removed bad %d actor follows.', numberOfActorFollowsRemoved)
112 } 112 }
113 113
114 static updateActorFollowsScoreAndRemoveBadOnes (goodInboxes: string[], badInboxes: string[], t: Sequelize.Transaction) { 114 static updateActorFollowsScore (goodInboxes: string[], badInboxes: string[], t: Sequelize.Transaction) {
115 if (goodInboxes.length === 0 && badInboxes.length === 0) return 115 if (goodInboxes.length === 0 && badInboxes.length === 0) return
116 116
117 logger.info('Updating %d good actor follows and %d bad actor follows scores.', goodInboxes.length, badInboxes.length) 117 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 () {
16 const updateParams: CustomConfig = { 16 const updateParams: CustomConfig = {
17 instance: { 17 instance: {
18 name: 'PeerTube updated', 18 name: 'PeerTube updated',
19 shortDescription: 'my short description',
19 description: 'my super description', 20 description: 'my super description',
20 terms: 'my super terms', 21 terms: 'my super terms',
21 defaultClientRoute: '/videos/recently-added', 22 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 () {
52 const data = res.body as CustomConfig 52 const data = res.body as CustomConfig
53 53
54 expect(data.instance.name).to.equal('PeerTube') 54 expect(data.instance.name).to.equal('PeerTube')
55 expect(data.instance.shortDescription).to.equal(
56 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
57 'with WebTorrent and Angular.'
58 )
55 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!') 59 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
56 expect(data.instance.terms).to.equal('No terms for now.') 60 expect(data.instance.terms).to.equal('No terms for now.')
57 expect(data.instance.defaultClientRoute).to.equal('/videos/trending') 61 expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
@@ -75,6 +79,7 @@ describe('Test config', function () {
75 const newCustomConfig = { 79 const newCustomConfig = {
76 instance: { 80 instance: {
77 name: 'PeerTube updated', 81 name: 'PeerTube updated',
82 shortDescription: 'my short description',
78 description: 'my super description', 83 description: 'my super description',
79 terms: 'my super terms', 84 terms: 'my super terms',
80 defaultClientRoute: '/videos/recently-added', 85 defaultClientRoute: '/videos/recently-added',
@@ -116,6 +121,7 @@ describe('Test config', function () {
116 const data = res.body 121 const data = res.body
117 122
118 expect(data.instance.name).to.equal('PeerTube updated') 123 expect(data.instance.name).to.equal('PeerTube updated')
124 expect(data.instance.shortDescription).to.equal('my short description')
119 expect(data.instance.description).to.equal('my super description') 125 expect(data.instance.description).to.equal('my super description')
120 expect(data.instance.terms).to.equal('my super terms') 126 expect(data.instance.terms).to.equal('my super terms')
121 expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added') 127 expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
@@ -146,6 +152,7 @@ describe('Test config', function () {
146 const data = res.body 152 const data = res.body
147 153
148 expect(data.instance.name).to.equal('PeerTube updated') 154 expect(data.instance.name).to.equal('PeerTube updated')
155 expect(data.instance.shortDescription).to.equal('my short description')
149 expect(data.instance.description).to.equal('my super description') 156 expect(data.instance.description).to.equal('my super description')
150 expect(data.instance.terms).to.equal('my super terms') 157 expect(data.instance.terms).to.equal('my super terms')
151 expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added') 158 expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
@@ -170,6 +177,7 @@ describe('Test config', function () {
170 const data: About = res.body 177 const data: About = res.body
171 178
172 expect(data.instance.name).to.equal('PeerTube updated') 179 expect(data.instance.name).to.equal('PeerTube updated')
180 expect(data.instance.shortDescription).to.equal('my short description')
173 expect(data.instance.description).to.equal('my super description') 181 expect(data.instance.description).to.equal('my super description')
174 expect(data.instance.terms).to.equal('my super terms') 182 expect(data.instance.terms).to.equal('my super terms')
175 }) 183 })
@@ -183,6 +191,10 @@ describe('Test config', function () {
183 const data = res.body 191 const data = res.body
184 192
185 expect(data.instance.name).to.equal('PeerTube') 193 expect(data.instance.name).to.equal('PeerTube')
194 expect(data.instance.shortDescription).to.equal(
195 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' +
196 'with WebTorrent and Angular.'
197 )
186 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!') 198 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
187 expect(data.instance.terms).to.equal('No terms for now.') 199 expect(data.instance.terms).to.equal('No terms for now.')
188 expect(data.instance.defaultClientRoute).to.equal('/videos/trending') 200 expect(data.instance.defaultClientRoute).to.equal('/videos/trending')