Commit Graph

57 Commits

Author SHA1 Message Date
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
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
a58423990b fix(admin): add sanitize_callbacks, model ID validation, max articles per cycle setting 2026-04-06 01:08:36 +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
b8a266e302 fix(v1.1.0): bump version, add DB upgrade migration on plugins_loaded 2026-04-06 00:36:07 +07:00
peptiderepo
c6079830f0 feat: display AI summary and keyword tags on frontend 2026-04-06 00:27:52 +07:00
peptiderepo
5bd6d7ec1a feat: add AI Keywords and AI Summary columns to articles list 2026-04-06 00:23:27 +07:00
peptiderepo
f753684a10 feat: integrate LLM processing into cron fetch cycle 2026-04-06 00:21:02 +07:00
peptiderepo
740d6026c4 feat: add OpenRouter settings section with model selection per function 2026-04-06 00:18:06 +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
91103afcee feat: add default thumbnail placeholder image 2026-04-05 23:41:06 +07:00
peptiderepo
9d04f52c78 feat: add i18n POT file with all translatable strings 2026-04-05 23:40:26 +07:00
peptiderepo
6eeecb2d11 fix: add Secure flag to session cookie on HTTPS 2026-04-05 23:39:14 +07:00
peptiderepo
59bf17bcfb fix: conditional asset loading, rate limiting, session cookie 2026-04-05 23:38:42 +07:00
peptiderepo
05733ebcbd fix: add date validation and nonce to CSV export link 2026-04-05 23:36:36 +07:00
peptiderepo
67b802a38d fix: add CSRF on CSV export, article retention setting, correct cron defaults 2026-04-05 23:34:51 +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
peptiderepo
5001183a4a feat: add class-peptide-news-analytics.php 2026-04-05 20:38:52 +07:00
peptiderepo
ee7fb0500e feat: add articles-list.php 2026-04-05 20:35:31 +07:00
peptiderepo
9fb2a3df13 feat: add admin-style.css 2026-04-05 20:34:36 +07:00
peptiderepo
e1e9b71f57 feat: add peptide-news-plugin/includes/class-peptide-news-loader.php 2026-04-05 20:31:53 +07:00
peptiderepo
2b44d506bf feat: add peptide-news-plugin/includes/class-peptide-news-activator.php 2026-04-05 20:31:52 +07:00
peptiderepo
c09851672c feat: add peptide-news-plugin/includes/class-peptide-news-deactivator.php 2026-04-05 20:31:26 +07:00
peptiderepo
8872a5b8a2 feat: add peptide-news-plugin/includes/class-peptide-news-rest-api.php 2026-04-05 20:31:25 +07:00
peptiderepo
76f398d4c6 feat: add peptide-news-plugin/includes/class-peptide-news-fetcher.php 2026-04-05 20:31:22 +07:00
peptiderepo
89304ccee6 feat: add peptide-news-plugin/includes/class-peptide-news.php 2026-04-05 20:31:21 +07:00
peptiderepo
3c0e42b9eb feat: add peptide-news-plugin/public/js/public-script.js 2026-04-05 20:30:36 +07:00
peptiderepo
c687b7ddf9 feat: add peptide-news-plugin/public/css/public-style.css 2026-04-05 20:30:35 +07:00
peptiderepo
d5b48b75f8 feat: add peptide-news-plugin/public/class-peptide-news-public.php 2026-04-05 20:30:34 +07:00
peptiderepo
2090382d63 feat: add peptide-news-plugin/admin/partials/dashboard.php 2026-04-05 20:28:50 +07:00
peptiderepo
08a8ae0df1 feat: add peptide-news-plugin/admin/partials/settings-page.php 2026-04-05 20:28:48 +07:00
peptiderepo
4ffe6e40f8 feat: add peptide-news-plugin/admin/js/admin-script.js 2026-04-05 20:28:47 +07:00
peptiderepo
739393385e feat: add peptide-news-plugin/admin/class-peptide-news-admin.php 2026-04-05 20:28:45 +07:00