]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/servers.ts
Set port if not specified in webfinger
[github/Chocobozzz/PeerTube.git] / server / middlewares / servers.ts
index 488f9c36848dab2c6c97925a7da525032ecacfd8..87bbe9fd79f1b6c8b29babd97f31a373f347d5f3 100644 (file)
@@ -1,5 +1,6 @@
 import 'express-validator'
 import * as express from 'express'
+import { getHostWithPort } from '../helpers'
 
 import { REMOTE_SCHEME } from '../initializers'
 
@@ -25,18 +26,3 @@ function setBodyHostsPort (req: express.Request, res: express.Response, next: ex
 export {
   setBodyHostsPort
 }
-
-// ---------------------------------------------------------------------------
-
-function getHostWithPort (host: string) {
-  const splitted = host.split(':')
-
-  // The port was not specified
-  if (splitted.length === 1) {
-    if (REMOTE_SCHEME.HTTP === 'https') return host + ':443'
-
-    return host + ':80'
-  }
-
-  return host
-}