From 6b467fd54e58edb77dade400380581485a484434 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Jan 2018 14:15:32 +0100 Subject: [PATCH] Fix tls and account bug --- server.ts | 3 ++ server/initializers/constants.ts | 2 +- .../migrations/0160-account-route.ts | 42 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 server/initializers/migrations/0160-account-route.ts diff --git a/server.ts b/server.ts index 05fc39acb..a52c47083 100644 --- a/server.ts +++ b/server.ts @@ -1,3 +1,6 @@ +// FIXME: https://github.com/nodejs/node/pull/16853 +require('tls').DEFAULT_ECDH_CURVE = 'auto' + import { isTestInstance } from './server/helpers/core-utils' if (isTestInstance()) { diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 1f18b4401..f8e6b52d7 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -9,7 +9,7 @@ import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 155 +const LAST_MIGRATION_VERSION = 160 // --------------------------------------------------------------------------- diff --git a/server/initializers/migrations/0160-account-route.ts b/server/initializers/migrations/0160-account-route.ts new file mode 100644 index 000000000..cab4c72f1 --- /dev/null +++ b/server/initializers/migrations/0160-account-route.ts @@ -0,0 +1,42 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + { + const toReplace = ':443' + const by = '' + const replacer = column => `replace("${column}", '${toReplace}', '${by}')` + + const query = ` + UPDATE actor SET url = ${replacer('url')}, "inboxUrl" = ${replacer('inboxUrl')}, "outboxUrl" = ${replacer('outboxUrl')}, + "sharedInboxUrl" = ${replacer('sharedInboxUrl')}, "followersUrl" = ${replacer('followersUrl')}, + "followingUrl" = ${replacer('followingUrl')} + ` + await utils.sequelize.query(query) + } + + { + const toReplace = '/account/' + const by = '/accounts/' + const replacer = column => `replace("${column}", '${toReplace}', '${by}')` + + const query = ` + UPDATE actor SET url = ${replacer('url')}, "inboxUrl" = ${replacer('inboxUrl')}, "outboxUrl" = ${replacer('outboxUrl')}, + "sharedInboxUrl" = ${replacer('sharedInboxUrl')}, "followersUrl" = ${replacer('followersUrl')}, + "followingUrl" = ${replacer('followingUrl')} + ` + await utils.sequelize.query(query) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- 2.25.1