]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix webfinger validator
authorChocobozzz <me@florianbigard.com>
Thu, 21 Dec 2017 09:16:20 +0000 (10:16 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 21 Dec 2017 09:16:20 +0000 (10:16 +0100)
server/helpers/core-utils.ts
server/helpers/custom-validators/webfinger.ts
server/initializers/migrations/0140-actor-url.ts

index 0c6c36d11741e0d58fcf7c00fbb5d63751a21d27..4981bb4ecb4e64cee7566ed65673201a7f427ce2 100644 (file)
@@ -27,7 +27,7 @@ function sanitizeUrl (url: string) {
 
 // Don't import remote scheme from constants because we are in core utils
 function sanitizeHost (host: string, remoteScheme: string) {
-  let toRemove = remoteScheme === 'https' ? 443 : 80
+  const toRemove = remoteScheme === 'https' ? 443 : 80
 
   return host.replace(new RegExp(`:${toRemove}$`), '')
 }
index 46f1ac210c79bf491a591621df27e77a4b9bdb7f..d8c1232ce4cd66578a4eba17e1bd8ee39e2bbed4 100644 (file)
@@ -11,8 +11,7 @@ function isWebfingerResourceValid (value: string) {
   if (actorParts.length !== 2) return false
 
   const host = actorParts[1]
-
-  return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOSTNAME
+  return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOST
 }
 
 // ---------------------------------------------------------------------------
index 626f3c444a3e0a0381b9b84b79ecc3444ef4c63f..e64ee3487b54cbb465ec5d2511c9f928407e605c 100644 (file)
@@ -1,6 +1,4 @@
 import * as Sequelize from 'sequelize'
-import { DataType } from 'sequelize-typescript'
-import { createPrivateAndPublicKeys } from '../../helpers'
 import { CONFIG } from '../constants'
 
 async function up (utils: {