dsh-config-manager 0.1.17 → 0.1.18

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/lib/client.d.ts CHANGED
@@ -412,6 +412,33 @@ interface SyncPullPayload extends SyncPushPayload {
412
412
  strategy?: 'merge' | 'replace' | 'skipExisting';
413
413
  snapshotId?: string;
414
414
  }
415
+ /** POST /sync/github/start 响应:UI 展示用(device_code 只存宿主,绝不回传) */
416
+ interface GithubDeviceFlowStartResponse {
417
+ /** 随机 flowId:后续 poll/cancel 凭它引用宿主侧登记的 device_code */
418
+ flowId: string;
419
+ /** 一次性用户码(用户在 GitHub 授权页输入) */
420
+ userCode: string;
421
+ /** GitHub 授权页 URL(用户浏览器打开) */
422
+ verificationUri: string;
423
+ /** 设备码过期秒数 */
424
+ expiresIn: number;
425
+ /** GitHub 建议轮询间隔秒数 */
426
+ interval: number;
427
+ }
428
+ /** POST /sync/github/poll 响应状态 */
429
+ type GithubPollStatus = 'pending' | 'success' | 'denied' | 'expired' | 'error';
430
+ /** POST /sync/github/poll 响应:成功时 token 已由 Host 写入 DSH credentials(值永不回传) */
431
+ interface GithubPollResponse {
432
+ status: GithubPollStatus;
433
+ /** pending:下次轮询前应等待的毫秒数 */
434
+ pollDelayMs?: number;
435
+ /** 终止态错误码(GitHub error code) */
436
+ errorCode?: string;
437
+ /** 终止态可展示消息(来自 GitHub error_description / 宿主文案,不含秘密) */
438
+ message?: string;
439
+ /** success 时恒 true(凭据已配置);便于 UI 直接刷新状态 */
440
+ credentialConfigured?: boolean;
441
+ }
415
442
  /** 远程同步浏览器半数据入口(备份与迁移页第 4 个 tab 的注入业务面) */
416
443
  declare class SyncApi {
417
444
  /** 读取同步状态(配置 / 凭据 / 上次同步时间 / 分区数) */
@@ -420,6 +447,14 @@ declare class SyncApi {
420
447
  push(payload: SyncPushPayload): Promise<SyncPushReport>;
421
448
  /** 拉取差异预览:拉取远端最新快照 → 只读分析(绝不执行导入) */
422
449
  pull(payload: SyncPullPayload): Promise<SyncPullReport>;
450
+ /** GitHub OAuth device flow:发起登录,返回一次性用户码 + 授权页 URL + flowId */
451
+ githubStart(): Promise<GithubDeviceFlowStartResponse>;
452
+ /** GitHub OAuth device flow:凭 flowId 轮询授权结果(成功时 token 已由 Host 写入 credentials) */
453
+ githubPoll(flowId: string): Promise<GithubPollResponse>;
454
+ /** GitHub OAuth device flow:取消(丢弃宿主侧登记,零副作用) */
455
+ githubCancel(flowId: string): Promise<{
456
+ ok: boolean;
457
+ }>;
423
458
  }
424
459
  //#endregion
425
460
  //#region src/client/client-types.d.ts
@@ -476,6 +511,8 @@ declare const zh$1: {
476
511
  readonly 'import.select.title': "选择备份文件";
477
512
  readonly 'import.select.hint': "选择本机导出的 dsh-config-*.zip 备份文件开始导入。分析阶段只读,不会修改任何配置。";
478
513
  readonly 'import.select.browse': "选择 ZIP 文件";
514
+ readonly 'import.select.reselect': "重新选择";
515
+ readonly 'import.select.cancel': "取消选择";
479
516
  readonly 'import.select.file': "已选择:{name}";
480
517
  readonly 'import.analyzing': "正在分析备份…";
481
518
  readonly 'import.compatibility.title': "兼容性";
@@ -568,6 +605,14 @@ declare const zh: {
568
605
  readonly 'config.tokenSaved': "凭据已配置";
569
606
  readonly 'config.gitBin': "git 可执行文件(可选)";
570
607
  readonly 'config.gitBinHint': "缺省使用 PATH 中的 git。";
608
+ readonly 'github.title': "GitHub 登录";
609
+ readonly 'github.description': "通过 GitHub OAuth 设备码流程授权:无需手动输入 token,在浏览器中确认授权后,token 自动写入 DSH credentials。";
610
+ readonly 'github.login': "使用 GitHub 登录";
611
+ readonly 'github.retry': "重新登录";
612
+ readonly 'github.cancel': "取消";
613
+ readonly 'github.userCode': "一次性授权代码";
614
+ readonly 'github.openAuth': "打开 GitHub 授权页面";
615
+ readonly 'github.clientIdHint': "需要插件配置 githubClientId(GitHub OAuth App 的 client_id)才能使用 GitHub 登录。";
571
616
  readonly 'status.title': "同步状态";
572
617
  readonly 'status.never': "从未同步";
573
618
  readonly 'action.push': "推送到远端";