From 6b467fd54e58edb77dade400380581485a484434 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Jan 2018 14:15:32 +0100 Subject: Fix tls and account bug --- server/initializers/constants.ts | 2 +- .../initializers/migrations/0160-account-route.ts | 42 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 server/initializers/migrations/0160-account-route.ts (limited to 'server') 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 +} -- cgit v1.2.3