Commit Graph

36 Commits

Author SHA1 Message Date
github-actions[bot]
8fe79459de Deploy d6b111f from main 2026-04-08 03:44:32 +00:00
github-actions[bot]
2ee59cab6a Deploy 8fe3d82 from main 2026-04-08 03:38:35 +00:00
github-actions[bot]
722293a8ea Deploy 672cdac from main 2026-04-08 03:27:12 +00:00
github-actions[bot]
dda0da31e8 Deploy 6c57f6c from main 2026-04-07 08:59:43 +00:00
github-actions[bot]
d0713aa561 Deploy 0cea96f from main 2026-04-07 08:25:15 +00:00
github-actions[bot]
a1a7fe6ea0 Deploy 67f932a from main 2026-04-07 08:22:17 +00:00
github-actions[bot]
d77cff73b3 Deploy 99aa2ca from main 2026-04-07 08:18:48 +00:00
github-actions[bot]
c242f0d59f Deploy 359b001 from main 2026-04-07 08:12:35 +00:00
github-actions[bot]
1e2a973acc Deploy 245b24b from main 2026-04-07 08:04:43 +00:00
github-actions[bot]
526959257f Deploy ab56ec7 from main 2026-04-07 07:59:55 +00:00
github-actions[bot]
89c7b553b2 Deploy 99ef0c9 from main 2026-04-07 06:20:58 +00:00
github-actions[bot]
9db9bb01c8 Deploy 1ae831e from main 2026-04-07 02:45:50 +00:00
Terence Ong
cd8eee11b8 Replace broken DDG search with AI thumbnail generation fallback
DuckDuckGo's HTML search endpoint now requires vqd session tokens,
making server-side search-based URL resolution unreliable. Simplified
the thumbnail pipeline:

- OG scrape only for non-aggregator URLs (direct publisher pages)
- AI image generation via OpenRouter for aggregator articles (Google News)
- Added Image Model settings field in admin UI
- Added thumbnail_local column for AI-generated images
- Updated public/admin display to check thumbnail_local as fallback
- Removed all DuckDuckGo search code (find_article_url_via_search,
  extract_ddg_url, resolve_article_for_scraping)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 20:29:32 +07:00
Terence Ong
de35f2d684 Fix thumbnail scraping: use search-based URL resolution for Google News articles
Google News RSS stores encrypted article URLs that cannot be resolved
server-side (JS SPA, no HTTP redirects, encrypted base64 IDs). Replace
the failed decode/parse strategies with DuckDuckGo search-based lookup
using article title + publisher name to find actual article pages, then
scrape OG images from those pages.

- Add find_article_url_via_search() using DuckDuckGo HTML endpoint
- Add resolve_article_for_scraping() combining redirect + search fallback
- Mark failed lookups with '_no_image' sentinel to avoid repeated retries
- Backfill button resets sentinels to allow manual re-scraping
- Clean up verbose debug instrumentation from prior attempts
- Update frontend to handle '_no_image' sentinel gracefully

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 20:01:25 +07:00
Terence Ong
acf7e61b90 Switch to multi-strategy HTML parsing for Google News URL resolution
Replace batchexecute API with direct fetch + HTML parsing strategies:
data-n-au attributes, anchor href extraction, meta refresh, JS redirect.
Add verbose debug output to diagnose server-side response from Google News.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:47:10 +07:00
Terence Ong
f828cec229 Use Google batchexecute API to resolve Google News article URLs
Replace broken base64 decoding with Google's internal batchexecute API
endpoint to resolve encrypted article IDs to actual publisher URLs.
This is the approach used by known Google News decoder libraries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:42:22 +07:00
Terence Ong
2c09ee4664 Add diagnostic debug output to thumbnail backfill for troubleshooting
Temporary debug version that returns query counts, URL resolution results,
and OG scraping outcomes to identify why thumbnail scraping returns 0.
Also adds Google News URL decoder (base64/protobuf approach).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:39:26 +07:00
Terence Ong
5918a7d446 Fix missing thumbnails by resolving Google News redirect URLs before OG scraping
The OG image scraper was using Google News redirect URLs (source_url) directly,
which don't serve og:image tags. Added resolve_scrape_url() to follow redirects
(including meta-refresh and JS redirects) to reach the actual publisher page
before scraping. Also added a backfill AJAX endpoint and admin button to
re-scrape thumbnails for existing articles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:32:09 +07:00
Terence Ong
18158a3b81 fix: resolve actual article source instead of showing aggregator domain
Google News RSS feeds report every article as coming from
"news.google.com" because the source was extracted from the feed URL
rather than the individual article. This adds a multi-strategy
resolver that extracts the real publisher name via:

1. SimplePie <source> element (Google News provides this)
2. Title suffix parsing ("Headline - Source" format)
3. HTTP HEAD redirect resolution as a fallback

Also adds a one-click "Fix Article Sources" backfill button on the
settings page to correct existing articles in the database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 19:11:14 +07:00
Peptide News Team
d99c505d1c Add missing Loader class and public CSS
The Peptide_News_Loader class was referenced by class-peptide-news.php
but never committed, causing a fatal error on plugin activation.
Also adds public/css/public-style.css which is enqueued by the public
class.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 16:32:42 +07:00
Terence Ong
c9be4ceb39 Fix pre-existing syntax errors in analytics and REST API classes
- analytics.php line 38: mismatched quotes on session_id array key
- analytics.php line 246: invalid escape before concatenation operator
- analytics.php line 250: COuNT typo → COUNT
- analytics.php line 252: NULIF typo → NULLIF
- rest-api.php line 54: stray # commenting out foreach variable

These bugs predate the content filter feature but were caught by the
new CI pipeline's PHP lint job.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:19:15 +07:00
Terence Ong
e6887e810f Add content filter to block ads, press releases, and promotional content
Two-tier filtering during article fetch: keyword/pattern rules as a fast
first pass, then optional LLM classification for borderline cases via
OpenRouter. Configurable sensitivity (strict/moderate/lenient), editable
keyword lists, blocked domain list, and admin stats display. Includes
30 unit tests covering domain blocking, title/body keywords, URL paths,
edge cases, and prompt structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:14:16 +07:00
Terence Ong
4367d68202 fix: security hardening for LLM thumbnail feature (QA-002,004,005,006)
- Use $wpdb->prepare() with esc_like() in clear_article_cache()
- Add strict base64_decode() validation with error handling
- Add isset()/is_array()/is_string() checks for nested array access
- Add wp_http_validate_url() SSRF prevention on all image downloads
- Add limit_response_size (5MB) on image URL downloads
- Set chmod 0644 after file_put_contents()
2026-04-06 10:19:53 +07:00
peptiderepo
01a794cd5f fix: security hardening for thumbnail feature (QA-001,003,004,006,008)
- Use $wpdb->prepare() with esc_like() in clear_article_cache()
- Add wp_http_validate_url() SSRF prevention in download_thumbnail()
- Add limit_response_size (5MB) on image downloads
- Set chmod 0644 after file_put_contents()
- Add transient-based concurrent fetch lock
2026-04-06 10:16:16 +07:00
peptiderepo
17e8247d2a fix(llm): add 429 retry, timeout guard, model validation, XSS protection, batch cache clear 2026-04-06 01:01:19 +07:00
peptiderepo
07d11499b2 fix(fetcher): use admin batch size setting, validate fetch_log type 2026-04-06 00:56:23 +07:00
peptiderepo
98e9c8516e fix(activator): remove TEXT DEFAULT for MySQL strict mode, add llm_max_articles default 2026-04-06 00:49:06 +07:00
peptiderepo
f753684a10 feat: integrate LLM processing into cron fetch cycle 2026-04-06 00:21:02 +07:00
peptiderepo
bdb4a17630 feat: add ai_summary column and LLM default options 2026-04-06 00:11:09 +07:00
peptiderepo
f672b4a670 feat: load LLM class dependency 2026-04-06 00:10:02 +07:00
peptiderepo
59b19b3c9e feat: add OpenRouter LLM integration for keyword extraction and summarization 2026-04-06 00:09:26 +07:00
peptiderepo
013a629ae1 fix: use article_retention option for pruning articles 2026-04-05 23:29:01 +07:00
peptiderepo
baa9794777 fix: guard division by zero in source performance SQL 2026-04-05 23:27:09 +07:00
peptiderepo
6332bab35a fix: rename NAMESPACE to API_NAMESPACE, add date validation 2026-04-05 23:25:10 +07:00
peptiderepo
90495dc22f fix: use wp_clear_scheduled_hook to properly clear all cron events 2026-04-05 23:23:10 +07:00
peptiderepo
6b73d7e6f8 fix: correct cron default to twicedaily, separate article retention, fix MySQL CURRENT_TIMESTAMP 2026-04-05 23:22:45 +07:00