From 7703f837426616bc0bd0926c0e6caccb9170ea0e Mon Sep 17 00:00:00 2001 From: MarvNC Date: Tue, 23 Jul 2024 17:58:44 -0700 Subject: [PATCH] Support Updatable Dictionaries https://github.com/themoeway/yomitan/pull/1174 --- src/builders/dictionaryIndex.ts | 12 ++++++++++++ src/types/yomitan/dictionaryindex.ts | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/builders/dictionaryIndex.ts b/src/builders/dictionaryIndex.ts index ab87f29..191a08a 100644 --- a/src/builders/dictionaryIndex.ts +++ b/src/builders/dictionaryIndex.ts @@ -28,6 +28,18 @@ export class DictionaryIndex { this.index.author = author; return this; } + setIsUpdatable(isUpdatable: boolean) { + this.index.isUpdatable = isUpdatable; + return this; + } + setIndexUrl(indexUrl: string) { + this.index.indexUrl = indexUrl; + return this; + } + setDownloadUrl(downloadUrl: string) { + this.index.downloadUrl = downloadUrl; + return this; + } setDescription(description: string) { this.index.description = description; return this; diff --git a/src/types/yomitan/dictionaryindex.ts b/src/types/yomitan/dictionaryindex.ts index b9b7356..bfb1abe 100644 --- a/src/types/yomitan/dictionaryindex.ts +++ b/src/types/yomitan/dictionaryindex.ts @@ -16,7 +16,7 @@ type TagInfo = { type DictionaryIndexType = { /** Title of the dictionary. */ title: string; - /** Revision of the dictionary. This value is only used for displaying information. */ + /** Revision of the dictionary. This value is displayed, and used to check for dictionary updates. */ revision: string; /** Whether or not this dictionary contains sequencing information for related terms. */ sequenced?: boolean; @@ -24,7 +24,13 @@ type DictionaryIndexType = { format?: 1 | 2 | 3; /** Creator of the dictionary. */ author?: string; - /** URL for the source of the dictionary. */ + /** Whether this dictionary contains links to its latest version. */ + isUpdatable?: boolean; + /** URL for the index file of the latest revision of the dictionary, used to check for updates. */ + indexUrl?: string; + /** URL for the download of the latest revision of the dictionary. */ + downloadUrl?: string; + /** URL for the source of the dictionary, displayed in the dictionary details. */ url?: string; /** Description of the dictionary data. */ description?: string;