aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-11 10:48:58 +0200
committerChocobozzz <me@florianbigard.com>2020-05-11 10:53:06 +0200
commit95cd31f1fe3311c873bee8185e6b07398a775a47 (patch)
tree0be01dcca9f29309cf74ab575a9efec34b689471
parent3a1a00a4af866caa96355c6702bbf805685d0973 (diff)
downloadPeerTube-95cd31f1fe3311c873bee8185e6b07398a775a47.tar.gz
PeerTube-95cd31f1fe3311c873bee8185e6b07398a775a47.tar.zst
PeerTube-95cd31f1fe3311c873bee8185e6b07398a775a47.zip
Allow to auto follow a specific URL
-rw-r--r--client/e2e/protractor.conf.js2
-rw-r--r--config/default.yaml3
-rw-r--r--config/production.yaml.example3
-rw-r--r--server/lib/schedulers/auto-follow-index-instances.ts4
-rw-r--r--server/tests/api/server/auto-follows.ts2
5 files changed, 10 insertions, 4 deletions
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js
index 0dd1f6ee5..5531707e6 100644
--- a/client/e2e/protractor.conf.js
+++ b/client/e2e/protractor.conf.js
@@ -61,7 +61,7 @@ exports.config = {
61 } 61 }
62 ], 62 ],
63 63
64 maxSessions: 1, 64 // maxSessions: 1,
65 // BrowserStack compatible ports: https://www.browserstack.com/question/664 65 // BrowserStack compatible ports: https://www.browserstack.com/question/664
66 baseUrl: 'http://localhost:3333/', 66 baseUrl: 'http://localhost:3333/',
67 framework: 'jasmine', 67 framework: 'jasmine',
diff --git a/config/default.yaml b/config/default.yaml
index c4ea3c42c..a0f2eb3a1 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -367,7 +367,8 @@ followings:
367 # /!\ Don't enable this if you don't have a reactive moderation team /!\ 367 # /!\ Don't enable this if you don't have a reactive moderation team /!\
368 auto_follow_index: 368 auto_follow_index:
369 enabled: false 369 enabled: false
370 index_url: 'https://instances.joinpeertube.org' 370 # Host your own using https://framagit.org/framasoft/peertube/instances-peertube#peertube-auto-follow
371 index_url: ''
371 372
372theme: 373theme:
373 default: 'default' 374 default: 'default'
diff --git a/config/production.yaml.example b/config/production.yaml.example
index bd867be53..8b8c98f8c 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -381,7 +381,8 @@ followings:
381 # /!\ Don't enable this if you don't have a reactive moderation team /!\ 381 # /!\ Don't enable this if you don't have a reactive moderation team /!\
382 auto_follow_index: 382 auto_follow_index:
383 enabled: false 383 enabled: false
384 index_url: 'https://instances.joinpeertube.org' 384 # Host your own using https://framagit.org/framasoft/peertube/instances-peertube#peertube-auto-follow
385 index_url: ''
385 386
386theme: 387theme:
387 default: 'default' 388 default: 'default'
diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/lib/schedulers/auto-follow-index-instances.ts
index e852c7fc6..a57436a45 100644
--- a/server/lib/schedulers/auto-follow-index-instances.ts
+++ b/server/lib/schedulers/auto-follow-index-instances.ts
@@ -42,6 +42,10 @@ export class AutoFollowIndexInstances extends AbstractScheduler {
42 this.lastCheck = new Date() 42 this.lastCheck = new Date()
43 43
44 const { body } = await doRequest<any>({ uri, qs, json: true }) 44 const { body } = await doRequest<any>({ uri, qs, json: true })
45 if (!body.data || Array.isArray(body.data) === false) {
46 logger.error('Cannot auto follow instances of index %s: bad URL format. Please check the auto follow URL.', indexUrl)
47 return
48 }
45 49
46 const hosts: string[] = body.data.map(o => o.host) 50 const hosts: string[] = body.data.map(o => o.host)
47 const chunks = chunk(hosts, 20) 51 const chunks = chunk(hosts, 20)
diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts
index 5f48dc0eb..7efccc3e2 100644
--- a/server/tests/api/server/auto-follows.ts
+++ b/server/tests/api/server/auto-follows.ts
@@ -177,7 +177,7 @@ describe('Test auto follows', function () {
177 followings: { 177 followings: {
178 instance: { 178 instance: {
179 autoFollowIndex: { 179 autoFollowIndex: {
180 indexUrl: 'http://localhost:42100', 180 indexUrl: 'http://localhost:42100/api/v1/instances/hosts',
181 enabled: true 181 enabled: true
182 } 182 }
183 } 183 }