diff --git a/migrations/0047__test.sql b/migrations/0047__test.sql new file mode 100644 index 000000000..027b7d63f --- /dev/null +++ b/migrations/0047__test.sql @@ -0,0 +1 @@ +SELECT 1; \ No newline at end of file diff --git a/public/javascripts/init.js b/public/javascripts/init.js index 1f3ddccc7..05fe68495 100644 --- a/public/javascripts/init.js +++ b/public/javascripts/init.js @@ -106,10 +106,6 @@ $(document).tooltip({ } }); -function isElectron() { - return window && window.process && window.process.type; -} - let appShown = false; function showAppIfHidden() { diff --git a/public/javascripts/migration.js b/public/javascripts/migration.js index 0d2456248..10b315ea7 100644 --- a/public/javascripts/migration.js +++ b/public/javascripts/migration.js @@ -1,7 +1,7 @@ "use strict"; $(document).ready(() => { - $.get(baseApiUrl + 'migration').then(result => { + server.get('migration').then(result => { const appDbVersion = result.app_db_version; const dbVersion = result.db_version; @@ -22,11 +22,7 @@ $("#run-migration").click(async () => { $("#migration-result").show(); - const result = await $.ajax({ - url: baseApiUrl + 'migration', - type: 'POST', - error: () => showError("Migration failed with unknown error") - }); + const result = await server.post('migration'); for (const migration of result.migrations) { const row = $('') diff --git a/public/javascripts/server.js b/public/javascripts/server.js index e04ca2595..ee8d47bfd 100644 --- a/public/javascripts/server.js +++ b/public/javascripts/server.js @@ -1,7 +1,14 @@ const server = (function() { function getHeaders() { + let protectedSessionId = null; + + try { // this is because protected session might not be declared in some cases - like when it's included in migration page + protectedSessionId = protected_session.getProtectedSessionId(); + } + catch(e) {} + return { - 'x-protected-session-id': protected_session.getProtectedSessionId() + 'x-protected-session-id': protectedSessionId }; } diff --git a/public/javascripts/utils.js b/public/javascripts/utils.js index 7495ebf50..030ba1e8b 100644 --- a/public/javascripts/utils.js +++ b/public/javascripts/utils.js @@ -46,4 +46,8 @@ function formatDate(date) { function formatDateTime(date) { return formatDate(date) + " " + formatTime(date); +} + +function isElectron() { + return window && window.process && window.process.type; } \ No newline at end of file diff --git a/services/build.js b/services/build.js index 02ff003c3..129528bca 100644 --- a/services/build.js +++ b/services/build.js @@ -1 +1 @@ -module.exports = { build_date:"2017-11-28T22:01:30-05:00", build_revision: "14001f67d87a7c7d900088807337fcda0d2fb9a0" }; +module.exports = { build_date:"2017-11-30T00:11:04-05:00", build_revision: "719f5530544efa1d7aae16afd8a9e64db04ff206" }; diff --git a/services/migration.js b/services/migration.js index ebb32ce6b..1ab2ed09b 100644 --- a/services/migration.js +++ b/services/migration.js @@ -4,7 +4,7 @@ const options = require('./options'); const fs = require('fs-extra'); const log = require('./log'); -const APP_DB_VERSION = 46; +const APP_DB_VERSION = 47; const MIGRATIONS_DIR = "migrations"; async function migrate() { diff --git a/views/index.ejs b/views/index.ejs index 5e304aa20..1e92f0d62 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -301,6 +301,7 @@ + @@ -329,6 +330,5 @@ - \ No newline at end of file diff --git a/views/migration.ejs b/views/migration.ejs index 8fa5075eb..6c11cd8e5 100644 --- a/views/migration.ejs +++ b/views/migration.ejs @@ -60,5 +60,7 @@ + + \ No newline at end of file