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).
This commit is contained in:
2026-09-13 18:11:51 +08:00
parent 9263b91276
commit 531da933ca
4 changed files with 106 additions and 20 deletions
+13 -8
View File
@@ -98,12 +98,18 @@ deleting a table is safe; it is recreated on the next start).
| Column | Type | Purpose |
|---|---|---|
| `search_url` | URL | **copy the `url` from a `Settings` row** — which watch this keyword applies to |
| `watch` | Link → `Settings` | **pick the watch from a dropdown** (belongs-to: many keywords → one watch) — no URL to copy by hand |
| `search_url` | Lookup (`Settings.url`) | read-only, auto-filled from the linked watch — this is what the monitor reads |
| `keyword` | SingleLineText | if the listing **title** contains this (case-insensitive substring), skip the Telegram alert (still archived) |
One keyword per row; add multiple rows for multiple keywords. A keyword only
silences listings found by the watch whose `Settings.url` matches `search_url` —
the same keyword never applies to other watches. Empty rows are ignored.
silences listings found by the watch you linked — the same keyword never applies to
other watches. Rows with no watch or no keyword are ignored.
`watch` is a real NocoDB Link column, so deleting/renaming a watch shows up in the
relation, and there is no hand-copied URL that can silently drift out of sync.
(The monitor's bootstrap also builds these two columns itself, including upgrading a
legacy URL-typed `search_url` to Link+Lookup.)
### `Settings` (the watch list — you manage this)
@@ -150,7 +156,7 @@ the same keyword never applies to other watches. Empty rows are ignored.
| Remove / pause a watch | Set `enabled` = false (or delete the row) |
| Stop Telegram pings but keep archiving | Set `notify` = false |
| Ignore a seller everywhere | Add `seller_name` row in `IgnoredSellers` |
| Ignore certain keywords for **one watch** | Add row(s) in `IgnoredKeywords`: `search_url` = copy of that watch's `Settings.url`, `keyword` = e.g. `nike` (case-insensitive, matches inside the title) |
| Ignore certain keywords for **one watch** | Add row(s) in `IgnoredKeywords`: pick the watch in the `watch` dropdown, `keyword` = e.g. `nike` (case-insensitive, matches inside the title). `search_url` fills itself |
| Change how often it checks | Edit `check_interval_minutes` (5 = every 5 min) |
| See what's new | Open `Listings`, sort by `first_seen_at` desc |
| Browse with images | `Listings` grid view — the `image` column renders thumbnails |
@@ -230,8 +236,7 @@ Health file lives at `/data/health.json` inside the container:
## 11. Changelog
- **2026-09-13** 新增 per-watch 忽略关键词:`IgnoredKeywords` 表(`search_url` +
`keyword`)。标题命中该 watch 关键词(大小写不敏感子串)时静默归档、不发
Telegram(`skip_notify=true`)。`search_url` 需与 `Settings.url` 一致,实现按
watch 隔离。
- **2026-09-13** `IgnoredKeywords.watch` 改成真正的 NocoDB **Link 列**(Many-to-One → `Settings`),`search_url` 改成 **Lookup 列**自动带出 `Settings.url`(UI 下拉选 watch,不用手抄 URL)。bootstrap 会自建这两列,并把旧版 URL 型 `search_url` 自动升级成 Link+Lookup。
- **2026-09-13** 新增 per-watch 忽略关键词:`IgnoredKeywords` 表。标题命中该 watch
关键词(大小写不敏感子串)时静默归档、不发 Telegram(`skip_notify=true`)。
- **2026-09-08** 通知重构:每商品一条图文消息(title/price/condition/seller/url),归档与通知解耦(`notified` 列 + tick 末尾统一发 + 1s 间隔)。图片改用高清 URL(去 `_progressive_thumbnail`)。condition 归一化(New→Brand new、Used→Used,加第 6 档)。listed_at 加 `active_bump` fallback。修复 Telegram IPv6/DNS 问题(compose `extra_hosts` 钉 IPv4)。bot 换 `@carousellFoundBot`。