Commit Graph
9 Commits
Author SHA1 Message Date
hoelee 9cea82e24e Fix run_tick/send_pending_notifications signatures missing kw_fk_col 2026-09-13 18:49:44 +08:00
hoelee 92f9276b67 Read IgnoredKeywords watch link via physical FK column
Previously load_ignored_keywords() relied on the 'watch' Link column's
expanded shape ({'Id': N, ...}), which NocoDB does not guarantee. Now:

- _ensure_keyword_watch_link() discovers the physical FK column title
  (e.g. nc_xxx___Settings_id, uidt=ForeignKey) from the table meta and
  returns it from bootstrap()
- load_ignored_keywords() prefers reading the FK column (pure numeric Id
  in the records API), falling back to the watch object only if absent
- kw_fk_col is threaded bootstrap -> main -> run_tick ->
  send_pending_notifications -> load_ignored_keywords

Same one-Settings-fetch-per-cycle design, no N+1.
2026-09-13 18:37:20 +08:00
hoelee a381490f5f Drop IgnoredKeywords.search_url column; resolve URL via watch link
The search_url Lookup column is redundant: the watch Link -> Settings row
already defines the association. Remove handling for the column:
- _ensure_keyword_watch_link() no longer creates a Lookup; deletes any
  legacy search_url (URL or Lookup type) on bootstrap
- load_ignored_keywords(kw_tid, settings_tid) resolves Settings.url via
  the watch link, one Settings fetch per cycle (no N+1)
- send_pending_notifications passes settings_tid through
- Add COMPOSE-SETUP.md: detail documentation for the compose stack
  (topology, compose block-by-block, Dockerfile, healthcheck, deploy paths,
  troubleshooting); referenced from README + DOCUMENTATION.md
2026-09-13 18:22:58 +08:00
hoelee 531da933ca Make IgnoredKeywords.watch a real Link column to Settings
Replace the hand-copied search_url (URL type) with a proper relation:
- watch: LinkToAnotherRecord (belongs-to, many keywords -> one Settings row),
  picked from a dropdown in the UI so a wrong URL can't silently disable a keyword
- search_url: Lookup column that auto-fills Settings.url through the link

_ensure_keyword_watch_link() builds both columns idempotently on bootstrap and
upgrades a legacy URL-typed search_url to Link+Lookup. load_ignored_keywords()
now normalises Lookup values (string or array).
2026-09-13 18:11:51 +08:00
hoelee 9263b91276 Add per-watch ignored keywords (IgnoredKeywords table)
Silence Telegram alerts for listings whose title contains a keyword
configured for that watch, matched case-insensitively as a substring.

- New IgnoredKeywords table: search_url (watch key) + keyword (one per row)
- load_ignored_keywords() returns {search_url: {lowercase keywords}}, reloaded
  every notification cycle so UI edits apply immediately
- title_matches_keyword() does the case-insensitive substring check
- send_pending_notifications() now also pulls search_url on pending records;
  skip_notify=true + notified=true on a hit (still archived, no Telegram)
- Docs updated: AGENTS.md, README.md, DOCUMENTATION.md
2026-09-13 17:50:11 +08:00
hoelee bcd858106d Add seller ignore list: skip_notify column + IgnoredSellers table
New Listings.skip_notify checkbox and IgnoredSellers table (seller_name).\nPending listings whose seller_name matches the ignore list are marked\nskip_notify=true + notified=true and never sent to Telegram. List reloads\nevery notification cycle so UI add/remove takes effect immediately.
2026-09-11 11:37:35 +08:00
hoelee df5ed83664 Exclude Carousell ads; fix thumbnail suffix strip for extension-less URLs
- fetch_listings 跳过 listingID=0 的广告卡片(title 常为 ap_promo_*)
- strip_thumbnail_suffix 改用 replace,同时覆盖 _progressive_thumbnail.jpg 和 _progressive_thumbnail(无扩展名)两种形态
2026-09-09 05:41:14 +08:00
hoelee d280e5e587 Fix Telegram notifications: multipart upload + richer message format
- 通知重构:归档与通知解耦(Listings.notified 列),tick 末尾统一发,1s 间隔,失败自动重试(30s tick)
- 每商品一条图文消息:title/price/condition/seller 名/product_url + 高清图
- 图片用 multipart 上传本地字节(原先传 URL 让 Telegram 下载,遇 carousell CDN 不稳定导致间歇 400)
- 图片 URL 去 _progressive_thumbnail 后缀(高清原图)
- condition 归一化:New→Brand new、Used→Used,加第 6 档;从所有 paragraph 找 condition(修位置漂移)
- listed_at 加 active_bump fallback(被顶置商品)
- compose extra_hosts 钉 api.telegram.org 到 IPv4 149.154.166.110(容器无 IPv6 时 DNS 只返 AAAA)
- bot 换 @carousellFoundBot,chat @MrFullStackDev
2026-09-09 05:31:55 +08:00
hoelee 17b7c4c55f Carousell new-listing monitor: NocoDB archive + Telegram alerts 2026-09-02 08:25:12 +08:00