Skip to content

feat(43): Actress Favorite + /search Integration#24

Merged
slive777 merged 15 commits intomainfrom
feature/43-actress-search
Apr 12, 2026
Merged

feat(43): Actress Favorite + /search Integration#24
slive777 merged 15 commits intomainfrom
feature/43-actress-search

Conversation

@slive777
Copy link
Copy Markdown
Owner

@slive777 slive777 commented Apr 12, 2026

Summary

  • DB actresses 表 + ActressRepository CRUD + 照片下載模組
  • API Router 四端點(POST favorite / GET / DELETE / GET photo)
  • /search DB 優先查詢(已收藏女優 0 網路請求)+ is_favorite 旗標
  • Hero Card footer 重設計(name + age + 三圍)+ 愛心收藏 overlay
  • Actress Lightbox 重建(上圖下文 5 rows + chips 收合)
  • Source link icon(minnano / Wikipedia JP)
  • i18n 四語系 + Capabilities 三端點
  • Bug fixes: aliases flatten、race guard、URL scheme XSS、422 handler、makers 保序

Test plan

  • 2167 tests passed (unit + integration + frontend lint)
  • 敏感資訊掃描 PASS
  • 打包完整性 PASS
  • 手動 smoke test:收藏女優 → 再搜尋 → hero card 本地照片 + 愛心實心
  • 手動 smoke test:Actress lightbox 完整 metadata + aliases chips
  • 手動 smoke test:Source link 開啟 minnano / Wikipedia

🤖 Generated with Claude Code

peace and others added 14 commits April 12, 2026 16:18
新增 DB schema(CREATE TABLE IF NOT EXISTS actresses)、
Actress dataclass(to_dict/from_row JSON 序列化)、
ActressRepository 五個方法(save/get_by_name/delete_by_name/get_all/exists)。
save() 使用 ON CONFLICT(name) DO UPDATE SET 保留 created_at(CD-12)。
含 13 個 unit tests。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
新建 actress_photo 模組,提供 download_actress_photo(含 Referer 設定、
Content-Type 副檔名推斷、glob 刪舊檔)、get_local_photo_path、
delete_local_photo 三個公開函數。含 6 個 unit tests。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 新建 web/routers/actress.py:POST favorite / GET photo/{name} /
  GET {name} / DELETE {name} 四端點
- Orchestrator 新增 ProfileResult namedtuple + get_cached_profile()
  公開 cache 讀取,get_actress_profile 改回傳 ProfileResult(區分
  timeout vs not-found)
- web/app.py 掛載 actress router
- 既有 orchestrator + actress_profile 測試同步更新(73 tests pass)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
search.py 新增 _fetch_actress_profile_with_db() — 已收藏女優從
DB 直接讀取(0 網路請求)+ is_favorite=True,未收藏走 orchestrator
+ is_favorite=False。REST 和 SSE 兩條路徑都套用。
修正 T3 ProfileResult 改造後 search.py 的相容性問題。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Footer:左 name 右 age,hover 顯示 height · cup · 三圍
- 愛心 overlay:.av-card-preview-overlay + .btn-glass-circle(CD-13)
- 未收藏:hover 空心可點擊加入;已收藏:常駐實心純指示(CD-10)
- addFavoriteActress():POST + 10s timeout + toast
- 搜尋重置時清空 _actressFavoriteLoading 防競態

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
新增 actress lightbox metadata:名稱+愛心 / age·birth·三圍 /
aliases chips / info chips / URL 連結。chips 超過 N 個顯示
+剩餘數 badge 可展開。lightbox 開關時重置展開狀態。
Lightbox 照片 img src 加本地路徑判斷(同 hero card)。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 四語系新增 search.unit.age/cup + search.actress.* 共 7 keys
- capabilities.py 新增 favorite_actress / get_actress /
  unfavorite_actress 三個工具(含 side_effect + confirmation_required)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
新建 test_api_actress.py 含 12 個 TestClient 測試:
POST favorite(cache hit/miss/409/404/504/422)、GET {name}(200/404)、
DELETE {name}(200/404)、GET photo/{name}(200/404)。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- #ff4d6d 改用 --color-favorite CSS 變數(theme.css 定義)
- hero card guard test 搜尋範圍 800→1200 字元(T5 overlay 增加了偏移量)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…s 保序

P1: addFavoriteActress() 加 capturedProfile/capturedName capture +
    await 後 stale-check(同 41d race pattern)
P1: 新增 _safeUrl() http(s) 白名單 guard,blog_url/official_url
    不再直接綁 :href(防 javascript: scheme XSS)
P2: web/app.py 加全域 RequestValidationError handler 回固定中文 422
P2: actress.py makers 番號前綴→片商名轉換(load_prefix_mapping)
    使用保序去重維持 gfriends probe 優先順序

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
minnano scraper 回傳 aliases 為 [{"ja":"...", ...}] 物件陣列,
前端 x-text 渲染為 [object Object]。新增 _flatten_aliases() helper
在 actress.py 和 search.py 兩處 flatten 為純字串 list。含 6 unit tests。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
新增 _actressSourceUrl() helper 構造文字來源頁面 URL
(minnano 搜尋頁 / Wikipedia JP)。hero card footer 和 actress
lightbox Row 1 各加一個 bi-box-arrow-up-right icon,點擊用
openSourceUrl() 開啟。is_favorite 或無文字來源時不顯示。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- search.py DB-miss 路徑:aliases flatten 後寫到 profile 頂層
  (前端讀 actressProfile.aliases,不是 text.aliases)
- 同時補齊 tags/agency/nickname 等 Phase 43 欄位到頂層
- source link icon 從 hero footer + lightbox Row 1 移到
  cover-actions(取代返回詳情,與影片版一致)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f542fe56e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/routers/actress.py Outdated
Comment thread web/static/js/pages/search/state/search-flow.js
P2-1: download_actress_photo 改用 actress.name(DB 正規化名)
      而非 request raw name,修正 alias 搜尋時照片檔名不匹配
P2-2: addFavoriteActress finally 加 generation counter stale-check,
      防止舊 request 的 finally 清掉新 request 的 loading flag

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@slive777 slive777 merged commit acf13d9 into main Apr 12, 2026
3 checks passed
@slive777 slive777 deleted the feature/43-actress-search branch April 15, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant