aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-21 10:16:20 +0100
committerChocobozzz <me@florianbigard.com>2017-12-21 10:16:20 +0100
commit604abfbef5e80d94e46658e4efa762adeab855ea (patch)
tree7b1522812841064376713ea717614a95d3fd95a7
parent225a89c2afbbe53cf39ffa7ea0cd485095a1d5f5 (diff)
downloadPeerTube-604abfbef5e80d94e46658e4efa762adeab855ea.tar.gz
PeerTube-604abfbef5e80d94e46658e4efa762adeab855ea.tar.zst
PeerTube-604abfbef5e80d94e46658e4efa762adeab855ea.zip
Fix webfinger validator
-rw-r--r--server/helpers/core-utils.ts2
-rw-r--r--server/helpers/custom-validators/webfinger.ts3
-rw-r--r--server/initializers/migrations/0140-actor-url.ts2
3 files changed, 2 insertions, 5 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts
index 0c6c36d11..4981bb4ec 100644
--- a/server/helpers/core-utils.ts
+++ b/server/helpers/core-utils.ts
@@ -27,7 +27,7 @@ function sanitizeUrl (url: string) {
27 27
28// Don't import remote scheme from constants because we are in core utils 28// Don't import remote scheme from constants because we are in core utils
29function sanitizeHost (host: string, remoteScheme: string) { 29function sanitizeHost (host: string, remoteScheme: string) {
30 let toRemove = remoteScheme === 'https' ? 443 : 80 30 const toRemove = remoteScheme === 'https' ? 443 : 80
31 31
32 return host.replace(new RegExp(`:${toRemove}$`), '') 32 return host.replace(new RegExp(`:${toRemove}$`), '')
33} 33}
diff --git a/server/helpers/custom-validators/webfinger.ts b/server/helpers/custom-validators/webfinger.ts
index 46f1ac210..d8c1232ce 100644
--- a/server/helpers/custom-validators/webfinger.ts
+++ b/server/helpers/custom-validators/webfinger.ts
@@ -11,8 +11,7 @@ function isWebfingerResourceValid (value: string) {
11 if (actorParts.length !== 2) return false 11 if (actorParts.length !== 2) return false
12 12
13 const host = actorParts[1] 13 const host = actorParts[1]
14 14 return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOST
15 return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOSTNAME
16} 15}
17 16
18// --------------------------------------------------------------------------- 17// ---------------------------------------------------------------------------
diff --git a/server/initializers/migrations/0140-actor-url.ts b/server/initializers/migrations/0140-actor-url.ts
index 626f3c444..e64ee3487 100644
--- a/server/initializers/migrations/0140-actor-url.ts
+++ b/server/initializers/migrations/0140-actor-url.ts
@@ -1,6 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { DataType } from 'sequelize-typescript'
3import { createPrivateAndPublicKeys } from '../../helpers'
4import { CONFIG } from '../constants' 2import { CONFIG } from '../constants'
5 3
6async function up (utils: { 4async function up (utils: {