Commit Graph

97 Commits

Author SHA1 Message Date
github-actions[bot]
5d4e73b947 Deploy 6796121 from main 2026-04-12 10:29:18 +00:00
github-actions[bot]
24d15ca938 Deploy b05913e from main 2026-04-11 14:23:03 +00:00
github-actions[bot]
2e916c12c8 Deploy 71f7a35 from main 2026-04-11 14:01:45 +00:00
github-actions[bot]
ad67ab89e5 Deploy 221a46a from main 2026-04-09 05:34:35 +00:00
github-actions[bot]
759b22ce3b Deploy d78347d from main 2026-04-08 04:53:09 +00:00
github-actions[bot]
95870bfe7b Deploy 44cc4f5 from main 2026-04-08 04:02:57 +00:00
github-actions[bot]
fb12a6a835 Deploy 0a550ca from main 2026-04-08 03:54:21 +00:00
github-actions[bot]
568529fdae Deploy aeceab2 from main 2026-04-08 03:50:13 +00:00
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]
260d2b6a1d Deploy 88766d7 from main 2026-04-07 09:43:46 +00:00
github-actions[bot]
3e0565fc83 Deploy e8a45e9 from main 2026-04-07 09:14:49 +00:00
github-actions[bot]
dda0da31e8 Deploy 6c57f6c from main 2026-04-07 08:59:43 +00:00
github-actions[bot]
9fd08b7834 Deploy e1d18ba from main 2026-04-07 08:30:04 +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]
8831622d03 Deploy f6629a8 from main 2026-04-07 07:29:44 +00:00
github-actions[bot]
dd36c7fe6e Deploy 8b14e9e from main 2026-04-07 07:22:55 +00:00
github-actions[bot]
a767833036 Deploy c899476 from main 2026-04-07 06:35:07 +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
peptiderepo
9ec67591bd Merge pull request #1 from peptiderepo/feature/list-layout
feat: switch article display from grid to list layout
2026-04-06 18:58:58 +07:00
Peptide News Team
aad57424c9 fix: add focus states for keyboard a11y and guard empty excerpt
Addresses QA Agent 2 findings:
- Add :focus outline on title and thumbnail links for keyboard navigation
- Wrap excerpt paragraph in conditional to avoid empty <p> when both
  ai_summary and excerpt are missing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:55:22 +07:00
Peptide News Team
203aa46036 feat: switch article display from grid to list layout
Rewrites public CSS to match actual .pn-* class names from the PHP
template and changes the default shortcode layout from card/grid to a
horizontal list: fixed-width thumbnail on the left, title + summary on
the right.  Includes compact variant for widgets and responsive
stacking on small screens.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:43:16 +07:00
Peptide News Team
15306ade35 chore: bump version to 1.2.2 — pipeline verification test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 18:28:04 +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
0b29059463 fix: use linear history for deploy branch instead of orphan/force-push
Hostinger's git pull fails with divergent branches when force-pushing
orphan commits. Switch to a linear commit strategy: checkout the
existing deploy branch, sync plugin files from main, and push normally.
This keeps Hostinger's git pull fast-forward compatible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 15:14:19 +07:00
Terence Ong
1304d205fa refactor: switch deploy to Hostinger GIT pull-based strategy
Replace broken SCP/SSH deploy (blocked by Hostinger firewall) with a
deploy-branch strategy. After CI passes, GitHub Actions pushes only
plugin files to the 'deploy' branch. Hostinger's built-in GIT
integration watches this branch via webhook and auto-pulls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 15:06:18 +07:00
Terence Ong
61d06c10c4 Switch deploy from FTP to SSH/SCP for Hostinger compatibility
FTP deploy timed out due to Hostinger blocking FTPS from external CI
servers. Switched to appleboy/scp-action using SSH on port 65002,
which is more reliable for CI/CD pipelines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:48:50 +07:00
Terence Ong
b9d14cbb59 Add workflow_call trigger to CI for reusable workflow support
The deploy workflow references CI via `uses: ./.github/workflows/ci.yml`
which requires the CI workflow to have an `on: workflow_call` trigger.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:35:27 +07:00
Terence Ong
9f267342a0 Fix pre-existing PHPUnit test failures in CI
Add missing WordPress function stubs (current_user_can, esc_url_raw,
is_user_logged_in, get_current_user_id) and load LLM class in test
bootstrap so AdminTest model validation and RestApiTest permission
checks work correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:26:31 +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
849ffa1260 Add CI/CD pipeline with automated testing and SFTP deployment
Introduces GitHub Actions workflows for continuous integration and
deployment. CI runs PHP linting (7.4, 8.1, 8.3), PHPCS with WordPress
coding standards, PHPUnit tests across PHP versions, and JS syntax
checks. Deployment to Hostinger via FTPS triggers on push to main
after all CI checks pass, with optional LiteSpeed cache purge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:41:47 +07:00
Terence Ong
6ed902394d Bump version to 1.2.1 for chart sizing fix deployment
The prepareCanvas wrapper fix (fee4f0f) required a version bump to
bust the LiteSpeed server cache that was serving the old admin-script.js
at the ?ver=1.2.0 URL. A Code Snippets filter on the live server now
rewrites the script version to 1.2.1-<timestamp>.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:29:29 +07:00
Terence Ong
fee4f0f52a Fix chart sizing with prepareCanvas wrapper
Chart.js with responsive:true + maintainAspectRatio:false requires
the parent container to have an explicit height. Without it, charts
grow unbounded. The prepareCanvas() helper wraps each canvas in a
height-constrained div before Chart initialization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 11:15:26 +07:00
Terence Ong
973fb1117a Fix chart sizing issue on analytics dashboard
Charts were not rendering properly because admin-script.js targeted a
non-existent canvas ID (peptide-analytics-chart) instead of the actual
IDs (pn-trends-chart, pn-devices-chart, pn-sources-chart). The script
also used hardcoded demo data instead of the peptideNewsDashboardData
object exported from PHP.

Changes:
- Rewrite admin-script.js to initialise all three dashboard charts
  (line, doughnut, bar) using the correct canvas IDs and PHP data
- Set maintainAspectRatio: false so explicit canvas heights are respected
- Add max-height CSS constraint on chart canvases to prevent unbounded
  vertical growth
- Sync JS/CSS to admin/ root directory to match PEPTIDE_NEWS_PLUGIN_URL
  asset path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 10:45:42 +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