diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-19 14:21:14 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 14:21:14 +0100 |
commit | 0405ab52dc0f445b88f8de76e30d6e6719196023 (patch) | |
tree | 85bb741791296ba1ede1efccd8d22f9f71169dc7 /server/middlewares/servers.ts | |
parent | d4c6a3b985ea56f730d11fb1c5f04a4fdc86e4dc (diff) | |
download | PeerTube-0405ab52dc0f445b88f8de76e30d6e6719196023.tar.gz PeerTube-0405ab52dc0f445b88f8de76e30d6e6719196023.tar.zst PeerTube-0405ab52dc0f445b88f8de76e30d6e6719196023.zip |
Set port if not specified in webfinger
Diffstat (limited to 'server/middlewares/servers.ts')
-rw-r--r-- | server/middlewares/servers.ts | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts index 488f9c368..87bbe9fd7 100644 --- a/server/middlewares/servers.ts +++ b/server/middlewares/servers.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import 'express-validator' | 1 | import 'express-validator' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { getHostWithPort } from '../helpers' | ||
3 | 4 | ||
4 | import { REMOTE_SCHEME } from '../initializers' | 5 | import { REMOTE_SCHEME } from '../initializers' |
5 | 6 | ||
@@ -25,18 +26,3 @@ function setBodyHostsPort (req: express.Request, res: express.Response, next: ex | |||
25 | export { | 26 | export { |
26 | setBodyHostsPort | 27 | setBodyHostsPort |
27 | } | 28 | } |
28 | |||
29 | // --------------------------------------------------------------------------- | ||
30 | |||
31 | function getHostWithPort (host: string) { | ||
32 | const splitted = host.split(':') | ||
33 | |||
34 | // The port was not specified | ||
35 | if (splitted.length === 1) { | ||
36 | if (REMOTE_SCHEME.HTTP === 'https') return host + ':443' | ||
37 | |||
38 | return host + ':80' | ||
39 | } | ||
40 | |||
41 | return host | ||
42 | } | ||