fix(search): send same-origin session credentials and surface load/retry states

Merged
YA
3d ago
+1276-98

User description

Summary

  • Send \credentials: 'same-origin'\ and
    edirect: 'manual'\ when fetching public /search//manifest.json, \ itles.json, and .sz\ shards so deployments protected by session-cookie SSO / \uth_request\ (e.g. Authelia behind Nginx) receive session cookies instead of redirecting or failing silently.
  • Keep strict cache control decoupled from credentials ('no-store'\ for /_access/\ restricted shards vs 'default'\ for public assets).
  • Track explicit \loadError, \phase\ ('loading-titles' | 'loading-shards' | 'ready' | 'partial-error' | 'error'), and failed shard requeuing (\ orceRetry) instead of silently poisoning \ itleLoaded\ / \ inishedBytes\ or displaying bogus \

PR Type

Bug fix, Enhancement, Tests


Description

  • 搜索请求改用 same-origin 凭证并阻止跨域重定向

  • 新增加载/错误/重试状态与 phase 阶段跟踪

  • 失败分片可重新入队,重试时不再误报空结果

  • 扩展正文匹配字段并补充单元与端到端测试


Diagram Walkthrough

flowchart LR
  A["SearchHost.vue"] -- "forceRetry / onRetry" --> B["search/engine.ts"]
  B -- "same-origin credentials" --> C["manifest / titles / shards"]
  B -- "loadError / phase" --> D["SearchPanel.vue (default + datasheet)"]
  D -- "retry button" --> A
  E["i18n en / zh-CN"] -- "loading/error/retry labels" --> D
  F["unit + e2e tests"] -- "verify" --> B

File Walkthrough

Relevant files
Enhancement
6 files
en.tsAdd English search loading, error and retry labels              +3/-0     
zh-CN.tsAdd Chinese search loading, error and retry labels              +3/-0     
registry.tsExtend search load state and panel prop types                        +8/-1     
SearchHost.vueWire retry, error state and new labels                                      +31/-12 
SearchPanel.vueRender error and loading states with retry button                +49/-1   
SearchPanel.vueRender error and loading states with retry button                +48/-1   
Bug fix
1 files
engine.tsSend same-origin credentials, track load errors and retry +108/-20
Tests
2 files
search.spec.tsAdd e2e test for auth error and retry                                        +28/-0   
search-index.test.tsAdd unit test for credentials and retry recovery                  +77/-0   

Summary by CodeRabbit

  • 新功能
    • 搜索索引加载期间显示状态提示;加载失败时提供错误说明和重试选项。
    • 搜索匹配范围扩展至完整标题及分组信息。
  • 问题修复
    • 索引加载中或失败且没有结果时,不再误显示“未找到相关内容”;加载失败时隐藏结果计数。
    • 清单加载失败时,标题搜索仍可用;重试后可恢复正文搜索。