]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/config.ts
Fix embed on mastodon
[github/Chocobozzz/PeerTube.git] / server / controllers / api / config.ts
index b2f23c1b00977abb39fe90b5832eb2760380666e..ae4e0024896292f6e8c33c1810e2abdb83ff4810 100644 (file)
@@ -12,7 +12,7 @@ import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '..
 import { remove, writeJSON } from 'fs-extra'
 import { getServerCommit } from '../../helpers/utils'
 import { Emailer } from '../../lib/emailer'
-import { isNumeric } from 'validator'
+import validator from 'validator'
 import { objectConverter } from '../../helpers/core-utils'
 import { CONFIG, reloadConfig } from '../../initializers/config'
 import { PluginManager } from '../../lib/plugins/plugin-manager'
@@ -50,7 +50,9 @@ let serverCommit: string
 async function getConfig (req: express.Request, res: express.Response) {
   const { allowed } = await Hooks.wrapPromiseFun(
     isSignupAllowed,
-    {},
+    {
+      ip: req.ip
+    },
     'filter:api.user.signup.allowed.result'
   )
 
@@ -155,6 +157,14 @@ async function getConfig (req: express.Request, res: express.Response) {
     },
     tracker: {
       enabled: CONFIG.TRACKER.ENABLED
+    },
+
+    followings: {
+      instance: {
+        autoFollowIndex: {
+          indexUrl: CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_INDEX.INDEX_URL
+        }
+      }
     }
   }
 
@@ -393,7 +403,7 @@ function convertCustomConfigBody (body: CustomConfig) {
   }
 
   function valueConverter (v: any) {
-    if (isNumeric(v + '')) return parseInt('' + v, 10)
+    if (validator.isNumeric(v + '')) return parseInt('' + v, 10)
 
     return v
   }