fix: added setup* fields

This commit is contained in:
gdjdkid committed 2026-03-26 23:08:10 +08:00
1 parent f37db4b22b
commit e146b59aae
2 files changed
+71 -14

No files matched your search

+16 -14
View File
@@ -24,29 +24,32 @@ program
.option('-l, --lang <lang>', '显示语言 zh/en/jp/kr/de', 'zh')
.action(async (id, options) => {
const lang = options.lang || 'zh';
const t = getLang(lang); // 统一获取语言包
if (options.setup) {
console.log('');
console.log(chalk.yellow('=== 配置 JAVDB Cookie(可选)==='));
console.log(chalk.yellow('=== ' + (t.setupTitle || '配置 JAVDB Cookie(可选)') + ' ==='));
console.log('');
console.log('不配置也可以正常使用,配置后覆盖率更高。');
console.log(t.setupDesc || '不配置也可以正常使用,配置后覆盖率更高。');
console.log('');
console.log('获取步骤:');
console.log(' 1. Chrome 打开 https://javdb.com 并登录账号');
console.log(' 2. 安装插件 "Get cookies.txt LOCALLY"');
console.log(' 3. 导出 Cookie 文件,找到 _jdb_session 那行');
console.log(' 4. 复制最后一列的值粘贴到下面');
console.log(t.setupSteps || '获取步骤:');
console.log(' 1. ' + (t.setupStep1 || 'Chrome 打开 https://javdb.com 并登录账号'));
console.log(' 2. ' + (t.setupStep2 || '安装插件 "Get cookies.txt LOCALLY"'));
console.log(' 3. ' + (t.setupStep3 || '导出 Cookie 文件,找到 _jdb_session 那行'));
console.log(' 4. ' + (t.setupStep4 || '复制最后一列的值粘贴到下面'));
console.log('');
const rl = createInterface({ input: process.stdin, output: process.stdout });
await new Promise((resolve) => {
rl.question(chalk.cyan('请粘贴 _jdb_session 的值(直接回车跳过): '), (session) => {
rl.question(chalk.cyan((t.setupPrompt || '请粘贴 _jdb_session 的值(直接回车跳过): ')), (session) => {
rl.close();
if (!session.trim()) {
console.log(chalk.gray('\n已跳过,使用 JAVBUS + JavLibrary 作为数据源。'));
console.log(chalk.gray('\n' + (t.setupSkipped || '已跳过,使用 JAVBUS + JavLibrary 作为数据源。')));
} else {
setConfig({ session: session.trim() });
console.log(chalk.green('\n✅ 配置保存成功!'));
console.log(chalk.gray('保存位置: ~/.config/javinfo/config.json'));
console.log(chalk.green('\n✅ ' + (t.setupSuccess || '配置保存成功!')));
console.log(chalk.gray((t.setupSavePath || '保存位置: ~/.config/javinfo/config.json')));
}
console.log('');
resolve();
@@ -56,7 +59,7 @@ program
}
if (options.clearCache) {
clearCache(options.lang || 'zh'); // 支持 -l zh/en/jp 等
clearCache(lang);
process.exit(0);
}
@@ -65,7 +68,6 @@ program
process.exit(0);
}
const t = getLang(options.lang || 'zh');
const spinner = ora(`${t.searching} ${id.toUpperCase()} ...`).start();
try {
@@ -81,7 +83,7 @@ program
process.exit(1);
}
display(result, options.raw, options.lang || 'zh');
display(result, options.raw, lang);
} catch (err) {
spinner.stop();
console.error(`\n${t.queryFailed}:`, err.message);
+55
View File
@@ -21,6 +21,17 @@ export const messages = {
cachePath: '缓存路径',
fc2Detected: 'FC2番号已转换为',
windowsHint: '温馨提示: 此番号需要JAVDB数据源,Windows暂不支持~',
setupTitle: '配置 JAVDB Cookie(可选)',
setupDesc: '不配置也可以正常使用,配置后覆盖率更高。',
setupSteps: '获取步骤:',
setupStep1: 'Chrome 打开 https://javdb.com 并登录账号',
setupStep2: '安装插件 "Get cookies.txt LOCALLY"',
setupStep3: '导出 Cookie 文件,找到 _jdb_session 那行',
setupStep4: '复制最后一列的值粘贴到下面',
setupPrompt: '请粘贴 _jdb_session 的值(直接回车跳过): ',
setupSkipped: '已跳过,使用 JAVBUS + JavLibrary 作为数据源。',
setupSuccess: '配置保存成功!',
setupSavePath: '保存位置: ~/.config/javinfo/config.json',
},
en: {
actress: 'Actress',
@@ -44,6 +55,17 @@ export const messages = {
cachePath: 'Cache path',
fc2Detected: 'FC2 format detected',
windowsHint: 'Note: This title requires JAVDB, which is unavailable on Windows.',
setupTitle: 'Setup JAVDB Cookie (Optional)',
setupDesc: 'You can use without configuration, but adding it improves coverage.',
setupSteps: 'Steps to get cookie:',
setupStep1: 'Open https://javdb.com in Chrome and log in',
setupStep2: 'Install extension "Get cookies.txt LOCALLY"',
setupStep3: 'Export cookies and find the _jdb_session line',
setupStep4: 'Copy the last column value and paste below',
setupPrompt: 'Paste the value of _jdb_session (press Enter to skip): ',
setupSkipped: 'Skipped. Using JAVBUS + JavLibrary as data sources.',
setupSuccess: 'Configuration saved successfully!',
setupSavePath: 'Saved to: ~/.config/javinfo/config.json',
},
jp: {
actress: '女優',
@@ -67,6 +89,17 @@ export const messages = {
cachePath: 'キャッシュパス',
fc2Detected: 'FC2番号を変換しました',
windowsHint: '注意: この番号はJAVDBが必要ですが、WindowsではJAVDBが利用できません。',
setupTitle: 'JAVDB Cookieの設定(オプション)',
setupDesc: '設定しなくても使用できますが、設定すると検索範囲が広がります。',
setupSteps: '取得手順:',
setupStep1: 'Chromeで https://javdb.com を開いてログイン',
setupStep2: '拡張機能 "Get cookies.txt LOCALLY" をインストール',
setupStep3: 'Cookieをエクスポートし、_jdb_session の行を探す',
setupStep4: '最後の列の値をコピーして以下に貼り付け',
setupPrompt: '_jdb_session の値を貼り付けてください(Enterでスキップ): ',
setupSkipped: 'スキップしました。JAVBUS + JavLibrary をデータソースとして使用します。',
setupSuccess: '設定を保存しました!',
setupSavePath: '保存場所: ~/.config/javinfo/config.json',
},
kr: {
actress: '여배우',
@@ -90,6 +123,17 @@ export const messages = {
cachePath: '캐시 경로',
fc2Detected: 'FC2 번호 변환됨',
windowsHint: '알림: 이 번호는 JAVDB가 필요하지만 Windows에서는 사용할 수 없습니다.',
setupTitle: 'JAVDB Cookie 설정 (선택사항)',
setupDesc: '설정하지 않아도 사용할 수 있지만, 설정하면 검색 범위가 넓어집니다.',
setupSteps: '획득 단계:',
setupStep1: 'Chrome에서 https://javdb.com 을 열고 로그인',
setupStep2: '확장 프로그램 "Get cookies.txt LOCALLY" 설치',
setupStep3: '쿠키를 내보내고 _jdb_session 줄을 찾기',
setupStep4: '마지막 열의 값을 복사하여 아래에 붙여넣기',
setupPrompt: '_jdb_session 값을 붙여넣어주세요 (Enter로 건너뛰기): ',
setupSkipped: '건너뛰었습니다. JAVBUS + JavLibrary를 데이터 소스로 사용합니다.',
setupSuccess: '설정이 성공적으로 저장되었습니다!',
setupSavePath: '저장 위치: ~/.config/javinfo/config.json',
},
de: {
actress: 'Darstellerin',
@@ -113,6 +157,17 @@ export const messages = {
cachePath: 'Cache-Pfad',
fc2Detected: 'FC2-Format erkannt',
windowsHint: 'Hinweis: Dieser Titel benötigt JAVDB, das unter Windows nicht verfügbar ist.',
setupTitle: 'JAVDB Cookie einrichten (optional)',
setupDesc: 'Ohne Konfiguration funktioniert es auch, aber mit Cookie ist die Abdeckung besser.',
setupSteps: 'Schritte zum Abrufen:',
setupStep1: 'Chrome öffnen, https://javdb.com aufrufen und anmelden',
setupStep2: 'Erweiterung "Get cookies.txt LOCALLY" installieren',
setupStep3: 'Cookies exportieren und die _jdb_session Zeile finden',
setupStep4: 'Den Wert der letzten Spalte kopieren und unten einfügen',
setupPrompt: 'Wert von _jdb_session einfügen (Enter zum Überspringen): ',
setupSkipped: 'Übersprungen. JAVBUS + JavLibrary werden als Datenquellen verwendet.',
setupSuccess: 'Konfiguration erfolgreich gespeichert!',
setupSavePath: 'Gespeichert unter: ~/.config/javinfo/config.json',
},
};