Remove support for the origin migrator

Requires https://github.com/vector-im/riot-web/pull/11631
This commit is contained in:
David Baker 2019-12-09 12:49:41 +00:00
parent 5a0c1cda22
commit 986c12b451

View File

@ -35,7 +35,6 @@ const tray = require('./tray');
const vectorMenu = require('./vectormenu'); const vectorMenu = require('./vectormenu');
const webContentsHandler = require('./webcontents-handler'); const webContentsHandler = require('./webcontents-handler');
const updater = require('./updater'); const updater = require('./updater');
const { migrateFromOldOrigin } = require('./originMigrator');
const windowStateKeeper = require('electron-window-state'); const windowStateKeeper = require('electron-window-state');
const Store = require('electron-store'); const Store = require('electron-store');
@ -64,11 +63,6 @@ if (argv["help"]) {
app.exit(); app.exit();
} }
// boolean flag set whilst we are doing one-time origin migration
// We only serve the origin migration script while we're actually
// migrating to mitigate any risk of it being used maliciously.
let migratingOrigin = false;
if (argv['profile-dir']) { if (argv['profile-dir']) {
app.setPath('userData', argv['profile-dir']); app.setPath('userData', argv['profile-dir']);
} else if (argv['profile']) { } else if (argv['profile']) {
@ -77,7 +71,7 @@ if (argv['profile-dir']) {
let vectorConfig = {}; let vectorConfig = {};
try { try {
vectorConfig = require('../../webapp/config.json'); vectorConfig = require('../webapp/config.json');
} catch (e) { } catch (e) {
// it would be nice to check the error code here and bail if the config // it would be nice to check the error code here and bail if the config
// is unparseable, but we get MODULE_NOT_FOUND in the case of a missing // is unparseable, but we get MODULE_NOT_FOUND in the case of a missing
@ -231,11 +225,6 @@ ipcMain.on('ipcCall', async function(ev, payload) {
mainWindow.focus(); mainWindow.focus();
} }
break; break;
case 'origin_migrate':
migratingOrigin = true;
await migrateFromOldOrigin();
migratingOrigin = false;
break;
case 'getConfig': case 'getConfig':
ret = vectorConfig; ret = vectorConfig;
break; break;
@ -476,15 +465,8 @@ app.on('ready', () => {
} }
let baseDir; let baseDir;
// first part of the path determines where we serve from if (target[1] === 'webapp') {
if (migratingOrigin && target[1] === 'origin_migrator_dest') { baseDir = path.join(__dirname, "../webapp");
// the origin migrator destination page
// (only the destination script needs to come from the
// custom protocol: the source part is loaded from a
// file:// as that's the origin we're migrating from).
baseDir = __dirname + "/../../origin_migrator/dest";
} else if (target[1] === 'webapp') {
baseDir = __dirname + "/../../webapp";
} else { } else {
callback({error: -6}); // FILE_NOT_FOUND callback({error: -6}); // FILE_NOT_FOUND
return; return;