Skip to content

Commit 03b1c60

Browse files
committed
fix: 修复以下问题
1. 修复更新转换器时可能导致的转换器目录清空异常 2. 添加zotero-chinese 转换器下载源 3. 优化弹窗提示信息
1 parent 6cefab6 commit 03b1c60

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

addon/chrome/content/preferences-main.xhtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@
118118
preference="translatorSource"
119119
>
120120
<menupopup>
121-
<!-- <menuitem
122-
value="https://ftp.linxingzhong.top/translators_CN"
123-
label="l0o0"
124-
/> -->
121+
<menuitem
122+
value="https://ftp.zotero-chinese.com/translators_CN"
123+
label="Zotero中文"
124+
/>
125125
<menuitem
126126
value="https://oss.wwang.de/translators_CN"
127127
label="可口可乐"

src/modules/services/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ export async function metaSearch(
9696
);
9797
});
9898
scrapeSearchResults = filteredResults1.concat(filteredResults2);
99+
task.addMsg(
100+
`After filtering, ${scrapeSearchResults.length} results left.`,
101+
);
99102
} else {
100103
task.addMsg("Filename parsing error");
101104
task.status = "fail";

src/modules/translators.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export async function bestSpeedBaseUrl() {
55
const baseUrls = [
66
"https://oss.wwang.de/translators_CN",
77
"https://www.wieke.cn/translators_CN",
8+
"https://ftp.zotero-chinese.com/translators_CN",
89
];
910

1011
const testUrl = async (
@@ -94,17 +95,22 @@ export async function getLastUpdatedMap(
9495
}
9596

9697
async function mendTranslators() {
97-
const translators = Zotero.Translators.getAll();
98+
// Detect Endnote XML translator, if it's missing, it means the translators are broken, try to reset them.
99+
// Return False if missing.
100+
const endNoteTranslator = await Zotero.Translators.get(
101+
"eb7059a4-35ec-4961-a915-3cf58eb9784b",
102+
);
98103
// 727 is the number of translators at the time of writing
99104
if (
100105
!getPref("firstRun") &&
101106
!getPref("translatorsMended") &&
102-
Object.keys(translators).length < 727
107+
!endNoteTranslator
103108
) {
104109
ztoolkit.log(
105110
"jasminum has been installed, and translators seems to be missing, try to reset them",
106111
);
107-
await Zotero.Schema.resetTranslators();
112+
const reset = await Zotero.Schema.resetTranslators();
113+
ztoolkit.log(`reset translators ${reset ? "successfully" : "failed"}`);
108114
setPref("translatorsMended", true);
109115
}
110116
}

0 commit comments

Comments
 (0)