dsh-jira-work-overview 0.16.3 → 0.16.4
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.
- package/CHANGELOG.md +11 -0
- package/README.md +1 -0
- package/README.zh.md +1 -0
- package/client.js +30 -5
- package/index.js +39 -5
- package/package.json +1 -1
- package/test/dsh-jira-credential.mjs +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to **dsh-jira-work-overview** are documented here.
|
|
|
4
4
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The first 25 releases were built in a single day, so the dates are real but the cadence was not: each entry lists what changed, not how long it took.
|
|
6
6
|
|
|
7
|
+
## [0.16.4] - 2026-11-23
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **第一次配置时只点「保存并验证」,站点地址没跟着保存,列表一直是空的。** 全新安装(或换了 profile)
|
|
12
|
+
时 `baseUrl` 还没写过:用户在配置页把邮箱、令牌、站点地址一起填好、只点了「保存并验证」这条通道
|
|
13
|
+
当时只提交 `token` + `email`,地址留在输入框里没落盘,于是面板一直报「还没有配置 Jira 站点地址」。
|
|
14
|
+
现在令牌保存会带上输入框里的站点地址、先拿它做 `/myself` 验证再一起写进 profile(地址非法整条拒绝、
|
|
15
|
+
不写入);配置保存成功后还会让面板自动重拉一次列表(以前配置完关掉弹窗,看到的仍是旧错误页,
|
|
16
|
+
得手动点「重试」);profile 没有 settings 服务、只能本次运行生效时也会明确提示。
|
|
17
|
+
|
|
7
18
|
## [0.16.3] - 2026-11-23
|
|
8
19
|
|
|
9
20
|
### Added
|
package/README.md
CHANGED
|
@@ -277,6 +277,7 @@ The current version is **0.16.0** (2026-11-20). The changelog records 30 version
|
|
|
277
277
|
| 0.14.0 | 2026-11-19 | feature | highlight follows **Jira's own priority order**; **first npm release** |
|
|
278
278
|
| 0.15.0 | 2026-11-19 | feature | transitions update **in place**, your own changes no longer notify you, typed failure hints |
|
|
279
279
|
| 0.15.1 | 2026-11-19 | **fix** | the four `/api` routes were never registered in a real host (404) |
|
|
280
|
+
| 0.16.4 | 2026-11-23 | **fix** | on a fresh profile, filling email + token + site URL and clicking only **Save & verify** left the URL unsaved, so the panel always said there was no site URL; the panel now also reloads automatically after a successful save |
|
|
280
281
|
| 0.16.3 | 2026-11-23 | **fix** | the Jira site URL is now an editable field in the config page (placeholder = current URL, saved to the profile Cordis patch); the failure hint's **Configure** button matches **Save and verify** |
|
|
281
282
|
| 0.16.2 | 2026-11-23 | **fix** | the workspace context menu's **Link Jira project…** could vanish for a whole page (client startup race); covered by a new offline suite |
|
|
282
283
|
| 0.16.1 | 2026-11-22 | fix | Windows notifications and *Show in file manager*, the Linux editor picker, UNC patch paths; three-OS CI and the release preflight; a planning walkthrough in both READMEs |
|
package/README.zh.md
CHANGED
|
@@ -531,6 +531,7 @@ Zed(`zed`)、Sublime Text(`subl`)、gedit(`gedit`)——**找到可
|
|
|
531
531
|
| 0.14.0 | 2026-11-19 | 功能 | 高亮挂到 **Jira 自己的优先级名次**;**首次发布到 npm** |
|
|
532
532
|
| 0.15.0 | 2026-11-19 | 功能 | 改状态**不再全量重拉**、自己改的状态不再通知自己、失败提示按类型 |
|
|
533
533
|
| 0.15.1 | 2026-11-19 | **修复** | 四条 `/api` 路由在真宿主里没注册(404) |
|
|
534
|
+
| 0.16.4 | 2026-11-23 | **修复** | 全新 profile 上把邮箱、令牌、站点地址一起填好、只点「保存并验证」时地址没落盘,面板一直说没配站点地址;配置保存成功后还会自动重拉列表 |
|
|
534
535
|
| 0.16.3 | 2026-11-23 | **修复** | 配置页「Jira 连接」的服务地址改成可编辑输入框(placeholder = 当前地址,写进 profile 的 Cordis patch);失败提示里的「去配置」按钮和「保存并验证」同款样式 |
|
|
535
536
|
| 0.16.2 | 2026-11-23 | **修复** | 左栏工作区右键菜单的「关联 Jira 项目…」会整页消失(客户端启动竞态);新增离线套件守住 |
|
|
536
537
|
| 0.16.1 | 2026-11-22 | 修复 | Windows 通知与「在文件管理器中显示」、Linux 编辑器直选、UNC 路径;三平台 CI 与发版预检;README 补计划会话图解 |
|
package/client.js
CHANGED
|
@@ -267,6 +267,8 @@ window.__ModuleLoader__.load({
|
|
|
267
267
|
credConfirmClear: '确认清除?',
|
|
268
268
|
credSaved: '已保存到 DSH 凭据库({key}),立即生效',
|
|
269
269
|
credSavedEmail: '账号邮箱已更新为 {email}',
|
|
270
|
+
credSavedBaseUrl: '站点地址已更新为 {baseUrl}',
|
|
271
|
+
baseUrlSavedLocal: '站点地址已应用({baseUrl}),但没能写进 profile 的 Cordis patch({reason}),重启后会丢',
|
|
270
272
|
credSavedOffline: '已保存到 DSH 凭据库({key});这次没能验证成功({message})',
|
|
271
273
|
credSavedAs: '已验证账号:{account}',
|
|
272
274
|
credCleared: '已从凭据库删除 {key}',
|
|
@@ -501,6 +503,8 @@ window.__ModuleLoader__.load({
|
|
|
501
503
|
credConfirmClear: 'Clear it?',
|
|
502
504
|
credSaved: 'Saved to the DSH credential store ({key}); effective immediately',
|
|
503
505
|
credSavedEmail: 'Account email updated to {email}',
|
|
506
|
+
credSavedBaseUrl: 'Site URL updated to {baseUrl}',
|
|
507
|
+
baseUrlSavedLocal: 'Site URL applied ({baseUrl}) but could not be written into this profile\'s Cordis patch ({reason}); it is lost after a restart',
|
|
504
508
|
credSavedOffline: 'Saved to the DSH credential store ({key}); verification failed this time ({message})',
|
|
505
509
|
credSavedAs: 'Verified account: {account}',
|
|
506
510
|
credCleared: 'Removed {key} from the credential store',
|
|
@@ -3049,7 +3053,13 @@ window.__ModuleLoader__.load({
|
|
|
3049
3053
|
onClick: () => setCredOpen(false),
|
|
3050
3054
|
}, h(CloseGlyph)),
|
|
3051
3055
|
]),
|
|
3052
|
-
|
|
3056
|
+
// 保存成功就让面板重拉一次列表:否则配置完关掉弹窗,后面还是那张
|
|
3057
|
+
// 「没有配置 / 加载失败」的旧错误页,用户以为没生效。
|
|
3058
|
+
h(CredentialSettings, {
|
|
3059
|
+
key: 'body',
|
|
3060
|
+
view: 'page',
|
|
3061
|
+
onChanged: () => { if (state.open) void load(snapshot.scope); },
|
|
3062
|
+
}),
|
|
3053
3063
|
]))
|
|
3054
3064
|
: null;
|
|
3055
3065
|
|
|
@@ -3212,34 +3222,45 @@ window.__ModuleLoader__.load({
|
|
|
3212
3222
|
|
|
3213
3223
|
async function save() {
|
|
3214
3224
|
// 令牌与邮箱是一对:有令牌就用新令牌,没令牌时用当前生效的那把(只改邮箱的场景)。
|
|
3225
|
+
// 站点地址也一并带上:用户在同一张表单里刚填的地址不该要求他先单独点一次「保存地址」,
|
|
3226
|
+
// 否则他只点「保存并验证」时地址根本没落盘,列表照样报 no_base_url。
|
|
3215
3227
|
const token = state.input.trim();
|
|
3216
3228
|
const email = state.email.trim();
|
|
3217
|
-
|
|
3229
|
+
const baseUrl = state.baseUrlDraft.trim();
|
|
3230
|
+
if (!token && !emailChanged() && !baseUrl) return;
|
|
3218
3231
|
setState((prev) => ({ ...prev, busy: 'save', message: '', error: '' }));
|
|
3219
3232
|
try {
|
|
3220
3233
|
const response = await watchFetch(CREDENTIAL_PATH, {
|
|
3221
3234
|
method: 'POST',
|
|
3222
3235
|
headers: { accept: 'application/json', 'content-type': 'application/json' },
|
|
3223
|
-
body: JSON.stringify({ token, email }),
|
|
3236
|
+
body: JSON.stringify(baseUrl ? { token, email, baseUrl } : { token, email }),
|
|
3224
3237
|
});
|
|
3225
3238
|
const payload = await response.json().catch(() => null);
|
|
3226
3239
|
if (payload?.ok !== true) throw new Error(payload?.error || `HTTP ${response.status}`);
|
|
3227
3240
|
const offline = payload.verification && payload.verification.ok === false;
|
|
3228
3241
|
const account = payload.verification?.account ? ` ${t('credSavedAs', { account: payload.verification.account })}` : '';
|
|
3229
3242
|
const emailNote = payload.emailSaved ? ` ${t('credSavedEmail', { email: payload.email ?? email })}` : '';
|
|
3243
|
+
const baseUrlNote = payload.baseUrlSaved
|
|
3244
|
+
? ` ${payload.baseUrlPersisted === false
|
|
3245
|
+
? t('baseUrlSavedLocal', { baseUrl: String(payload.baseUrl ?? baseUrl), reason: String(payload.baseUrlReason ?? '') })
|
|
3246
|
+
: t('credSavedBaseUrl', { baseUrl: String(payload.baseUrl ?? baseUrl) })}`
|
|
3247
|
+
: '';
|
|
3230
3248
|
setState((prev) => ({
|
|
3231
3249
|
...prev,
|
|
3232
3250
|
busy: '',
|
|
3233
3251
|
input: '',
|
|
3234
3252
|
email: String(payload.email ?? prev.email),
|
|
3235
3253
|
emailTouched: false,
|
|
3254
|
+
// 地址已经落盘:清空草稿,placeholder 变成新地址。
|
|
3255
|
+
baseUrlDraft: payload.baseUrlSaved ? '' : prev.baseUrlDraft,
|
|
3236
3256
|
status: payload,
|
|
3237
3257
|
error: '',
|
|
3238
3258
|
// 账号只跟着这次保存的消息显示;不要把验证结果留在 state 里,否则下一条消息也会挂上它。
|
|
3239
3259
|
message: (offline
|
|
3240
3260
|
? t('credSavedOffline', { key: payload.credentialKey, message: payload.verification.message ?? '' })
|
|
3241
|
-
: t('credSaved', { key: payload.credentialKey })) + emailNote + account,
|
|
3261
|
+
: t('credSaved', { key: payload.credentialKey })) + emailNote + baseUrlNote + account,
|
|
3242
3262
|
}));
|
|
3263
|
+
props?.onChanged?.();
|
|
3243
3264
|
} catch (error) {
|
|
3244
3265
|
setState((prev) => ({ ...prev, busy: '', error: t('credSaveFailed', { message: String(error?.message ?? error) }) }));
|
|
3245
3266
|
}
|
|
@@ -3271,12 +3292,15 @@ window.__ModuleLoader__.load({
|
|
|
3271
3292
|
baseUrlBusy: false,
|
|
3272
3293
|
baseUrlDraft: '',
|
|
3273
3294
|
baseUrlError: '',
|
|
3274
|
-
baseUrlMessage:
|
|
3295
|
+
baseUrlMessage: payload?.persisted === false
|
|
3296
|
+
? t('baseUrlSavedLocal', { baseUrl: String(payload?.applied?.baseUrl ?? value), reason: String(payload?.reason ?? '') })
|
|
3297
|
+
: t('baseUrlSaved', { baseUrl: String(payload?.applied?.baseUrl ?? value) }),
|
|
3275
3298
|
// 保存成功顺带刷新一遍状态:placeholder 立刻显示新的生效地址。
|
|
3276
3299
|
...readWatch(payload, prev),
|
|
3277
3300
|
}));
|
|
3278
3301
|
baseUrlFlashTimer = setTimeout(() => setState((prev) => ({ ...prev, baseUrlMessage: '' })), 2600);
|
|
3279
3302
|
if (typeof baseUrlFlashTimer?.unref === 'function') baseUrlFlashTimer.unref();
|
|
3303
|
+
props?.onChanged?.();
|
|
3280
3304
|
void refresh();
|
|
3281
3305
|
} catch (error) {
|
|
3282
3306
|
setState((prev) => ({ ...prev, baseUrlBusy: false, baseUrlError: t('baseUrlSaveFailed', { message: String(error?.message ?? error) }) }));
|
|
@@ -3468,6 +3492,7 @@ window.__ModuleLoader__.load({
|
|
|
3468
3492
|
const payload = await response.json().catch(() => null);
|
|
3469
3493
|
if (payload?.ok !== true) throw new Error(payload?.error || `HTTP ${response.status}`);
|
|
3470
3494
|
setState((prev) => ({ ...prev, busy: '', status: payload, error: '', message: t('credCleared', { key: payload.credentialKey }) }));
|
|
3495
|
+
props?.onChanged?.();
|
|
3471
3496
|
} catch (error) {
|
|
3472
3497
|
setState((prev) => ({ ...prev, busy: '', error: t('credClearFailed', { message: String(error?.message ?? error) }) }));
|
|
3473
3498
|
}
|
package/index.js
CHANGED
|
@@ -2309,12 +2309,13 @@ async function resolveToken(ctx, settings) {
|
|
|
2309
2309
|
|
|
2310
2310
|
/**
|
|
2311
2311
|
* 拿候选「邮箱 + 令牌」试一次 /myself:能分清「这个组合不对」(401/403)与「网络不通」。
|
|
2312
|
-
* email
|
|
2312
|
+
* email / site 省略时用当前生效值;site 允许传「还没落盘的候选地址」,免得用户
|
|
2313
|
+
* 在同一张表单里刚填的站点地址要先保存一次才能验证。
|
|
2313
2314
|
*/
|
|
2314
|
-
async function verifyCredential(settings, token, signal, email) {
|
|
2315
|
+
async function verifyCredential(settings, token, signal, email, site) {
|
|
2315
2316
|
const account = typeof email === 'string' && email ? email : liveSetting(settings, 'email', '');
|
|
2316
2317
|
const auth = Buffer.from(`${account}:${token}`, 'utf8').toString('base64');
|
|
2317
|
-
const response = await fetch(`${baseUrlOf(settings)}/rest/api/3/myself`, {
|
|
2318
|
+
const response = await fetch(`${site || baseUrlOf(settings)}/rest/api/3/myself`, {
|
|
2318
2319
|
headers: { Authorization: `Basic ${auth}`, Accept: 'application/json' },
|
|
2319
2320
|
signal,
|
|
2320
2321
|
});
|
|
@@ -2377,9 +2378,21 @@ function registerCredentialRoute(ctx, jira, settings) {
|
|
|
2377
2378
|
// 令牌与邮箱是一对:都从 payload 里取,缺的那一半用当前生效值。
|
|
2378
2379
|
const token = typeof payload?.token === 'string' ? payload.token.trim() : '';
|
|
2379
2380
|
const rawEmail = typeof payload?.email === 'string' ? payload.email.trim() : '';
|
|
2381
|
+
const rawBaseUrl = typeof payload?.baseUrl === 'string' ? payload.baseUrl.trim() : '';
|
|
2380
2382
|
const current = await resolveToken(ctx, settings);
|
|
2381
2383
|
const currentEmail = String(liveSetting(settings, 'email', '') ?? '').trim();
|
|
2382
2384
|
const nextEmail = rawEmail || currentEmail;
|
|
2385
|
+
// 站点地址也能和令牌一起提交:同一张表单里刚填的地址不必先单独保存一次,
|
|
2386
|
+
// 否则用户只点「保存并验证」时地址根本没落盘,列表照样是 no_base_url。
|
|
2387
|
+
let nextBaseUrl = baseUrlOf(settings);
|
|
2388
|
+
if (rawBaseUrl) {
|
|
2389
|
+
try {
|
|
2390
|
+
nextBaseUrl = normalizeBaseUrl(rawBaseUrl);
|
|
2391
|
+
} catch (error) {
|
|
2392
|
+
return jsonResponse({ ok: false, error: String(error?.message ?? error) }, 400);
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
if (!nextBaseUrl) return jsonResponse({ ok: false, error: t('err.noBaseUrl') }, 400);
|
|
2383
2396
|
|
|
2384
2397
|
if (!nextEmail) return jsonResponse({ ok: false, error: t('err.needEmail') }, 400);
|
|
2385
2398
|
if (rawEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(rawEmail)) {
|
|
@@ -2393,7 +2406,7 @@ function registerCredentialRoute(ctx, jira, settings) {
|
|
|
2393
2406
|
// 网络层失败照存但提示(同令牌单独保存时的策略)。
|
|
2394
2407
|
let verification = { skipped: true, reason: t('verify.skipped') };
|
|
2395
2408
|
try {
|
|
2396
|
-
const probe = await verifyCredential(settings, candidate, request.signal, nextEmail);
|
|
2409
|
+
const probe = await verifyCredential(settings, candidate, request.signal, nextEmail, nextBaseUrl);
|
|
2397
2410
|
verification = probe;
|
|
2398
2411
|
if (probe.ok === false && (probe.status === 401 || probe.status === 403)) {
|
|
2399
2412
|
return jsonResponse({
|
|
@@ -2417,8 +2430,29 @@ function registerCredentialRoute(ctx, jira, settings) {
|
|
|
2417
2430
|
await writeSettings(ctx, settings, { email: nextEmail });
|
|
2418
2431
|
emailSaved = true;
|
|
2419
2432
|
}
|
|
2433
|
+
let baseUrlSaved = false;
|
|
2434
|
+
let baseUrlPersisted = true;
|
|
2435
|
+
let baseUrlReason;
|
|
2436
|
+
if (rawBaseUrl) {
|
|
2437
|
+
// 验证已经用的是这个地址;这里只负责落盘,失败要把原因回给界面。
|
|
2438
|
+
const written = await writeSettings(ctx, settings, { baseUrl: nextBaseUrl });
|
|
2439
|
+
baseUrlSaved = true;
|
|
2440
|
+
baseUrlPersisted = written?.persisted !== false;
|
|
2441
|
+
baseUrlReason = written?.reason;
|
|
2442
|
+
}
|
|
2420
2443
|
const status = await credentialStatus(ctx, settings);
|
|
2421
|
-
return jsonResponse({
|
|
2444
|
+
return jsonResponse({
|
|
2445
|
+
ok: true,
|
|
2446
|
+
saved: true,
|
|
2447
|
+
tokenSaved: Boolean(token),
|
|
2448
|
+
emailSaved,
|
|
2449
|
+
baseUrlSaved,
|
|
2450
|
+
baseUrlPersisted,
|
|
2451
|
+
baseUrlReason,
|
|
2452
|
+
baseUrl: baseUrlOf(settings),
|
|
2453
|
+
verification,
|
|
2454
|
+
...status,
|
|
2455
|
+
});
|
|
2422
2456
|
} catch (error) {
|
|
2423
2457
|
return jsonResponse({ ok: false, error: String(error?.message ?? error) }, 400);
|
|
2424
2458
|
}
|
package/package.json
CHANGED
|
@@ -691,6 +691,45 @@ if (baseUrlInput()) {
|
|
|
691
691
|
console.log('非法地址 → 被拒:', settingsWrites.length === beforeBad,
|
|
692
692
|
'| 错误文案:', collect(credPage, (row) => classNameOf(row).includes('jmw-cred-msg') && classNameOf(row).includes('err')).map((row) => text(row).trim()).join(' | '));
|
|
693
693
|
}
|
|
694
|
+
// 站点地址与令牌一起提交:同一张表单里填的地址要跟着「保存并验证」一起落盘,
|
|
695
|
+
// 否则用户只点那个按钮时地址根本没保存,列表还是 no_base_url。
|
|
696
|
+
{
|
|
697
|
+
const beforeWrites = settingsWrites.length;
|
|
698
|
+
const beforeCalls = myselfCalls.length;
|
|
699
|
+
const response = await credentialFetch(CRED_PATH, {
|
|
700
|
+
method: 'POST',
|
|
701
|
+
headers: { 'content-type': 'application/json' },
|
|
702
|
+
body: JSON.stringify({ token: GOOD, email: 'someone@example.com', baseUrl: 'https://saved-with-token.atlassian.net/' }),
|
|
703
|
+
});
|
|
704
|
+
const body = await response.json().catch(() => ({}));
|
|
705
|
+
const write = settingsWrites[settingsWrites.length - 1];
|
|
706
|
+
const baseOp = write?.ops?.find((op) => op.path[0] === 'baseUrl');
|
|
707
|
+
const probe = myselfCalls[myselfCalls.length - 1];
|
|
708
|
+
const okSave = body.ok === true && body.baseUrlSaved === true && body.baseUrl === 'https://saved-with-token.atlassian.net';
|
|
709
|
+
const okWrite = settingsWrites.length > beforeWrites && baseOp?.value === 'https://saved-with-token.atlassian.net';
|
|
710
|
+
const okProbe = myselfCalls.length > beforeCalls && String(probe?.url ?? '').startsWith('https://saved-with-token.atlassian.net/rest/api/3/myself');
|
|
711
|
+
console.log('\n令牌 + 站点地址一次保存: ok:', body.ok === true, '| baseUrlSaved:', body.baseUrlSaved, '| baseUrl:', body.baseUrl);
|
|
712
|
+
console.log(' profile patch 写入:', okWrite, '| /myself 用新地址验证:', okProbe, '(', probe?.url, ')');
|
|
713
|
+
if (!okSave || !okWrite || !okProbe) process.exitCode = 1;
|
|
714
|
+
|
|
715
|
+
const beforeBad = settingsWrites.length;
|
|
716
|
+
const bad = await credentialFetch(CRED_PATH, {
|
|
717
|
+
method: 'POST',
|
|
718
|
+
headers: { 'content-type': 'application/json' },
|
|
719
|
+
body: JSON.stringify({ token: GOOD, email: 'someone@example.com', baseUrl: 'not a url' }),
|
|
720
|
+
});
|
|
721
|
+
const badBody = await bad.json().catch(() => ({}));
|
|
722
|
+
console.log(' 非法站点地址一起提交 → 被拒:', badBody.ok === false, '| 未写入:', settingsWrites.length === beforeBad,
|
|
723
|
+
'| 文案:', badBody.error);
|
|
724
|
+
if (badBody.ok !== false || settingsWrites.length !== beforeBad) process.exitCode = 1;
|
|
725
|
+
|
|
726
|
+
// 还原:后面的用例还要用配置里的站点地址。
|
|
727
|
+
await settingsFetch(SETTINGS_PATH, {
|
|
728
|
+
method: 'POST',
|
|
729
|
+
headers: { 'content-type': 'application/json' },
|
|
730
|
+
body: JSON.stringify({ baseUrl: env.JIRA_BASE_URL }),
|
|
731
|
+
});
|
|
732
|
+
}
|
|
694
733
|
// 界面语言:三个 chip(自动 / 中文 / English),点了立刻写进 profile 的 Cordis patch
|
|
695
734
|
// 迷你 React 不保留 key,所以按「文本是三种语言名之一」来找(配置页里不会同时出现状态下拉的 chip)
|
|
696
735
|
const LANG_LABELS = ['自动', '中文', 'English'];
|