@cloud411716/fancy-webnovel 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -98,6 +98,10 @@ export function apply(ctx) {
|
|
|
98
98
|
}
|
|
99
99
|
throw err;
|
|
100
100
|
}
|
|
101
|
+
// Handle case where user skipped or X'd the question
|
|
102
|
+
if (!result?.answers?.[0]) {
|
|
103
|
+
return notify(session, 'error', bootstrap.notify({ type: 'cancelled' }));
|
|
104
|
+
}
|
|
101
105
|
projectRoot = result.answers[0]?.custom?.trim() ?? '';
|
|
102
106
|
}
|
|
103
107
|
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* 因为项目根由用户指定,不一定在 DSH workspace 内。
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { mkdirSync, writeFileSync, existsSync } from 'fs';
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
|
|
9
12
|
const DIRS = [
|
|
10
13
|
'设定/角色', '设定/势力', '设定/物品', '设定/地点',
|
|
11
14
|
'大纲', '正文', '故事档案', '对标', '拆文库',
|
|
@@ -19,9 +22,6 @@ const DIRS = [
|
|
|
19
22
|
* @returns {Promise<{ ok: boolean, error?: string }>}
|
|
20
23
|
*/
|
|
21
24
|
export async function initProject(projectRoot) {
|
|
22
|
-
const { mkdirSync, writeFileSync, existsSync } = await import('fs');
|
|
23
|
-
const { join } = await import('path');
|
|
24
|
-
|
|
25
25
|
// Validate
|
|
26
26
|
if (!projectRoot || typeof projectRoot !== 'string') {
|
|
27
27
|
return { ok: false, error: '无效的项目根路径' };
|
package/commands/scan/index.js
CHANGED
|
@@ -31,6 +31,12 @@ function platformLabel(platform) {
|
|
|
31
31
|
return row ? row[2] : platform;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
const SCRAPERS = { qidian, fanqie, jinjiang, qimao };
|
|
35
|
+
|
|
36
|
+
// ASCII spinner sequence for live progress feedback during scraping
|
|
37
|
+
const SPINNER = ['|', '/', '—', '\\'];
|
|
38
|
+
let _spinnerIdx = 0;
|
|
39
|
+
|
|
34
40
|
const scan = {
|
|
35
41
|
platformList() {
|
|
36
42
|
return (
|
|
@@ -40,7 +46,7 @@ const scan = {
|
|
|
40
46
|
},
|
|
41
47
|
|
|
42
48
|
askPlatform() {
|
|
43
|
-
return { question: '📊 请选择要扫的平台(输入编号 1-4):' };
|
|
49
|
+
return { id: 'platform', question: '📊 请选择要扫的平台(输入编号 1-4):' };
|
|
44
50
|
},
|
|
45
51
|
|
|
46
52
|
rankOptions(platform) {
|
|
@@ -114,12 +120,6 @@ const scan = {
|
|
|
114
120
|
},
|
|
115
121
|
};
|
|
116
122
|
|
|
117
|
-
const SCRAPERS = { qidian, fanqie, jinjiang, qimao };
|
|
118
|
-
|
|
119
|
-
// ASCII spinner sequence for live progress feedback during scraping
|
|
120
|
-
const SPINNER = ['|', '/', '—', '\\'];
|
|
121
|
-
let _spinnerIdx = 0;
|
|
122
|
-
|
|
123
123
|
/**
|
|
124
124
|
* @param {object} ctx - Cordis plugin context
|
|
125
125
|
*/
|
|
@@ -160,6 +160,10 @@ export function apply(ctx) {
|
|
|
160
160
|
// Re-throw unexpected errors
|
|
161
161
|
throw err;
|
|
162
162
|
}
|
|
163
|
+
// Handle case where user skipped or X'd the question
|
|
164
|
+
if (!platformResult?.answers?.[0]) {
|
|
165
|
+
return notify(session, 'error', scan.notify({ type: 'cancelled' }));
|
|
166
|
+
}
|
|
163
167
|
const answer = platformResult.answers[0]?.custom?.trim();
|
|
164
168
|
if (!answer) {
|
|
165
169
|
return notify(session, 'error', scan.notify({ type: 'cancelled' }));
|
|
@@ -188,6 +192,10 @@ export function apply(ctx) {
|
|
|
188
192
|
}
|
|
189
193
|
throw err;
|
|
190
194
|
}
|
|
195
|
+
// Handle case where user skipped or X'd the question
|
|
196
|
+
if (!rankResult?.answers?.[0]) {
|
|
197
|
+
return notify(session, 'error', scan.notify({ type: 'cancelled' }));
|
|
198
|
+
}
|
|
191
199
|
const selected = rankResult.answers[0]?.selected ?? [];
|
|
192
200
|
const custom = rankResult.answers[0]?.custom?.trim();
|
|
193
201
|
|