Allow to auto follow a specific URL
authorChocobozzz <me@florianbigard.com>
Mon, 11 May 2020 08:48:58 +0000 (10:48 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 11 May 2020 08:53:06 +0000 (10:53 +0200)
client/e2e/protractor.conf.js
config/default.yaml
config/production.yaml.example
server/lib/schedulers/auto-follow-index-instances.ts
server/tests/api/server/auto-follows.ts

index 0dd1f6ee5c29f96a101b31bc68598008d8517fb4..5531707e6b01b78475b4a2c4c0bac539cfbd05e9 100644 (file)
@@ -61,7 +61,7 @@ exports.config = {
     }
   ],
 
-  maxSessions: 1,
+  // maxSessions: 1,
   // BrowserStack compatible ports: https://www.browserstack.com/question/664
   baseUrl: 'http://localhost:3333/',
   framework: 'jasmine',
index c4ea3c42c0eba2d8635e5e18befba05ffec07688..a0f2eb3a177b004666ea1473b88e57fef45fcf39 100644 (file)
@@ -367,7 +367,8 @@ followings:
     # /!\ Don't enable this if you don't have a reactive moderation team /!\
     auto_follow_index:
       enabled: false
-      index_url: 'https://instances.joinpeertube.org'
+      # Host your own using https://framagit.org/framasoft/peertube/instances-peertube#peertube-auto-follow
+      index_url: ''
 
 theme:
   default: 'default'
index bd867be53a4e24481309c59872267fe5853d0d3a..8b8c98f8c1e9cdff8467c7766d492db7b7b6f3f6 100644 (file)
@@ -381,7 +381,8 @@ followings:
     # /!\ Don't enable this if you don't have a reactive moderation team /!\
     auto_follow_index:
       enabled: false
-      index_url: 'https://instances.joinpeertube.org'
+      # Host your own using https://framagit.org/framasoft/peertube/instances-peertube#peertube-auto-follow
+      index_url: ''
 
 theme:
   default: 'default'
index e852c7fc6889f2340ea11ccf88e33b2122de7c72..a57436a4566d79fb9f77051f3d617b4d13a6a170 100644 (file)
@@ -42,6 +42,10 @@ export class AutoFollowIndexInstances extends AbstractScheduler {
       this.lastCheck = new Date()
 
       const { body } = await doRequest<any>({ uri, qs, json: true })
+      if (!body.data || Array.isArray(body.data) === false) {
+        logger.error('Cannot auto follow instances of index %s: bad URL format. Please check the auto follow URL.', indexUrl)
+        return
+      }
 
       const hosts: string[] = body.data.map(o => o.host)
       const chunks = chunk(hosts, 20)
index 5f48dc0ebf2c9fee5effed01d4b88d4ab7aa5ab7..7efccc3e20d2e274958f8c80b64643cbf6bd5eca 100644 (file)
@@ -177,7 +177,7 @@ describe('Test auto follows', function () {
         followings: {
           instance: {
             autoFollowIndex: {
-              indexUrl: 'http://localhost:42100',
+              indexUrl: 'http://localhost:42100/api/v1/instances/hosts',
               enabled: true
             }
           }