diff --git a/src/common/store.js b/src/common/store.js index cd3cf1eb3..a756df94c 100644 --- a/src/common/store.js +++ b/src/common/store.js @@ -6,9 +6,10 @@ const defaults = { type: 'go', path: '', flags: [ + '--agent-version-suffix=desktop', '--migrate', '--enable-gc', - '--routing', 'dhtclient' + '--routing=dhtclient' ] }, language: (electron.app || electron.remote.app).getLocale(), @@ -32,6 +33,25 @@ const migrations = { if (flags.includes('--enable-gc') && !automaticGC) { store.set('automaticGC', true) } + }, + '>=0.17.0': store => { + let flags = store.get('ipfsConfig.flags', []) + + // make sure version suffix is always present and normalized + const setVersionSuffix = '--agent-version-suffix=desktop' + if (!flags.includes(setVersionSuffix)) { + // remove any custom suffixes, if present + flags = flags.filter(f => !f.startsWith('--agent-version-suffix=')) + // set /desktop + flags.push('--agent-version-suffix=desktop') + store.set('ipfsConfig.flags', flags) + } + // merge routing flags into one + if (flags.includes('--routing') && flags.includes('dhtclient')) { + flags = flags.filter(f => f !== '--routing').filter(f => f !== 'dhtclient') + flags.push('--routing=dhtclient') + store.set('ipfsConfig.flags', flags) + } } }