diff --git a/ext/js/dictionary/dictionary-importer.js b/ext/js/dictionary/dictionary-importer.js index 021046410..599993d55 100644 --- a/ext/js/dictionary/dictionary-importer.js +++ b/ext/js/dictionary/dictionary-importer.js @@ -24,7 +24,7 @@ import { ZipReader as ZipReader0, configure, } from '../../lib/zip.js'; -import {compareRevisions} from 'dictionary-data-util.js'; +import {compareRevisions} from './dictionary-data-util.js'; import {ExtensionError} from '../core/extension-error.js'; import {parseJson} from '../core/json.js'; import {toError} from '../core/to-error.js'; @@ -181,8 +181,9 @@ export class DictionaryImporter { } } + const yomitanVersion = details.yomitanVersion; /** @type {import('dictionary-importer').SummaryDetails} */ - const summaryDetails = {prefixWildcardsSupported, counts, styles}; + const summaryDetails = {prefixWildcardsSupported, counts, styles, yomitanVersion}; const summary = this._createSummary(dictionaryTitle, version, index, summaryDetails); await dictionaryDatabase.bulkAdd('dictionaries', [summary], 0, 1); @@ -331,11 +332,10 @@ export class DictionaryImporter { const {minimumYomitanVersion, author, url, description, attribution, frequencyMode, isUpdatable, sourceLanguage, targetLanguage} = index; if (typeof minimumYomitanVersion === 'string') { - const {version} = chrome.runtime.getManifest(); - if (version === "0.0.0.0") { + if (details.yomitanVersion === "0.0.0.0") { // Running a development version of Yomitan - } else if (compareRevisions(version, minimumYomitanVersion)) { - throw new Error(`Dictionary is incompatible with this version of Yomitan (${version}; minimum required: ${minimumYomitanVersion})`); + } else if (compareRevisions(details.yomitanVersion, minimumYomitanVersion)) { + throw new Error(`Dictionary is incompatible with this version of Yomitan (${details.yomitanVersion}; minimum required: ${minimumYomitanVersion})`); } summary.minimumYomitanVersion = minimumYomitanVersion; } diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js index d8e803f01..48fedbbc4 100644 --- a/ext/js/pages/settings/dictionary-import-controller.js +++ b/ext/js/pages/settings/dictionary-import-controller.js @@ -555,6 +555,7 @@ export class DictionaryImportController { const optionsFull = await this._settingsController.getOptionsFull(); const importDetails = { prefixWildcardsSupported: optionsFull.global.database.prefixWildcardsSupported, + yomitanVersion: chrome.runtime.getManifest().version, }; for (let i = 0; i < importProgressTracker.dictionaryCount; ++i) { diff --git a/types/ext/dictionary-importer.d.ts b/types/ext/dictionary-importer.d.ts index 5f42b8f68..27b177cf9 100644 --- a/types/ext/dictionary-importer.d.ts +++ b/types/ext/dictionary-importer.d.ts @@ -40,6 +40,7 @@ export type ImportResult = { export type ImportDetails = { prefixWildcardsSupported: boolean; + yomitanVersion: string; }; export type Summary = { @@ -68,6 +69,7 @@ export type SummaryDetails = { prefixWildcardsSupported: boolean; counts: SummaryCounts; styles: string; + yomitanVersion: string; }; export type SummaryCounts = {