From: Chocobozzz Date: Thu, 21 Dec 2017 09:16:20 +0000 (+0100) Subject: Fix webfinger validator X-Git-Tag: v0.0.1-alpha~93 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=604abfbef5e80d94e46658e4efa762adeab855ea;p=oweals%2Fpeertube.git Fix webfinger validator --- 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) { // 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}$`), '') } 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) { 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 } // --------------------------------------------------------------------------- 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 @@ import * as Sequelize from 'sequelize' -import { DataType } from 'sequelize-typescript' -import { createPrivateAndPublicKeys } from '../../helpers' import { CONFIG } from '../constants' async function up (utils: {