Fix tls and account bug
authorChocobozzz <me@florianbigard.com>
Fri, 5 Jan 2018 13:15:32 +0000 (14:15 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 5 Jan 2018 13:15:32 +0000 (14:15 +0100)
server.ts
server/initializers/constants.ts
server/initializers/migrations/0160-account-route.ts [new file with mode: 0644]

index 05fc39acbb5a808cfeccf5e4384ce440ee912884..a52c47083ed2a4e090eff74b4226c4da62c51fae 100644 (file)
--- 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()) {
index 1f18b44012717ca005b975d8cda4ba7c8704b5aa..f8e6b52d7a77adacbdd7356047cb2f7157310279 100644 (file)
@@ -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 (file)
index 0000000..cab4c72
--- /dev/null
@@ -0,0 +1,42 @@
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+  transaction: Sequelize.Transaction,
+  queryInterface: Sequelize.QueryInterface,
+  sequelize: Sequelize.Sequelize
+}): Promise<void> {
+  {
+    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
+}