Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 🐛 Bug Report / 💡 Feature Request

**Thanks for contributing to the oEmbed Craft CMS plugin!** This template helps us understand issues with the field type, embed functionality, caching, and admin interface.

## 📋 Issue Type
- [ ] 🐛 Bug report
- [ ] 💡 Feature request
- [ ] 📚 Documentation issue
- [ ] ❓ Question/Support

---

## 🔍 **Bug Report** (Skip if feature request)

### What's the issue?
<!-- Clear description of what's wrong -->

### Where does it happen?
- [ ] **Admin CP Field**: Issue in the Craft control panel field interface
- [ ] **Frontend Render**: Problem with `{{ entry.field.render() }}` output
- [ ] **Caching**: Cached content not updating or cache errors
- [ ] **GDPR Compliance**: Issues with privacy settings (YouTube no-cookie, Vimeo DNT, etc.)
- [ ] **Network/Provider**: Provider-specific embed failures
- [ ] **GraphQL**: Issues with GraphQL field queries

### Steps to reproduce
1.
2.
3.

### Expected vs Actual
**Expected:**
**Actual:**

### Your Environment
- **Craft CMS**: <!-- e.g., 4.5.0 -->
- **oEmbed Plugin**: <!-- e.g., 3.1.5 -->
- **PHP**: <!-- e.g., 8.2 -->
- **Provider**: <!-- e.g., YouTube, Vimeo, Instagram, Twitter -->
- **Test URL**: <!-- The URL you're trying to embed -->

---

## 💡 **Feature Request** (Skip if bug report)

### What feature would you like?
<!-- Clear description -->

### What problem does this solve?
<!-- Context about why this is needed -->

### Suggested implementation
<!-- How you think it should work -->

---

## 🔧 Additional Context

### Admin CP Issues (if applicable)
- Field preview not showing?
- Save/validation problems?
- Settings interface issues?

### Frontend Issues (if applicable)
- Template method used: `render()` / `embed()` / `media()` / `valid()`
- Cache enabled/disabled?
- GDPR settings active?

### Provider-Specific Issues
- Does the URL work on the provider's site?
- Using embed URL vs regular URL?
- API tokens configured (for Instagram/Facebook)?

### Error Messages/Screenshots
<!-- Paste any error messages or attach screenshots -->

---

**💡 Pro Tips:**
- Many providers need **embed URLs** not regular URLs (check provider's share → embed option)
- Check your **cache settings** - try disabling cache temporarily to test
- For Instagram: requires Facebook API token in plugin settings
- For GDPR: check if privacy settings are affecting embeds
82 changes: 82 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# 🚀 Pull Request

**Thanks for contributing to the oEmbed Craft CMS plugin!** Please fill out the sections below to help us review your changes.

## 📝 What does this PR do?
<!-- Brief description of your changes -->

## 🔗 Related Issue
<!-- Link to the issue this PR addresses -->
Fixes #

## 🎯 Type of Change
<!-- Put an `x` in the box that applies -->
- [ ] 🐛 **Bug fix** (fixes an issue without breaking existing functionality)
- [ ] ✨ **New feature** (adds functionality without breaking changes)
- [ ] 💥 **Breaking change** (fix/feature that changes existing functionality)
- [ ] 🏗️ **Refactor** (code improvement without functional changes)
- [ ] 📚 **Documentation** (README, comments, or docs)
- [ ] 🧪 **Tests** (adding or updating tests)

## 🧪 Testing

### How did you test this?
<!-- Describe your testing approach -->
- [ ] Added/updated unit tests
- [ ] Tested with multiple embed providers (YouTube, Vimeo, etc.)
- [ ] Tested admin CP field functionality
- [ ] Tested frontend rendering
- [ ] Tested caching behavior
- [ ] Tested GDPR compliance features
- [ ] Manual testing in Craft CMS environment

### Test Environment
- **Craft CMS version**:
- **PHP version**:
- **Tested providers**: <!-- e.g., YouTube, Vimeo, Instagram -->

## ✅ Checklist
<!-- Put an `x` in completed boxes -->

### Code Quality
- [ ] My code follows the existing code style
- [ ] I've added comments where code is complex
- [ ] No new warnings or errors introduced

### Functionality
- [ ] Field works correctly in Craft CP
- [ ] Frontend rendering works as expected
- [ ] Caching behaves properly
- [ ] GDPR settings are respected (if applicable)
- [ ] GraphQL queries work (if applicable)

### Testing & Documentation
- [ ] I've added/updated tests for my changes
- [ ] All existing tests still pass
- [ ] I've updated documentation if needed
- [ ] I've tested edge cases and error scenarios

### Plugin-Specific
- [ ] Handles provider URL variations (embed vs regular URLs)
- [ ] Fallback behavior works for unsupported providers
- [ ] Network/timeout errors are handled gracefully
- [ ] API token requirements documented (if applicable)

## 🔍 Review Focus Areas
<!-- Help reviewers know what to focus on -->
- [ ] **Admin UI**: Changes to the control panel field interface
- [ ] **Template Methods**: Changes to `render()`, `embed()`, `media()`, `valid()` methods
- [ ] **Provider Support**: New or modified provider handling
- [ ] **Caching Logic**: Changes to cache behavior
- [ ] **GDPR Features**: Privacy compliance modifications
- [ ] **Error Handling**: Network/provider failure scenarios

## 📸 Screenshots (if applicable)
<!-- Add screenshots for UI changes -->

## 💭 Additional Notes
<!-- Any other context, concerns, or questions for reviewers -->

---

**🔄 Ready for Review?** Make sure all tests pass and the CI checks are green!
113 changes: 113 additions & 0 deletions .github/workflows/pull-request-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Pull Request Tests

on:
pull_request:
branches:
- 'master'
- 'v*'
push:
branches:
- 'master'

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: pgsql, pdo_pgsql, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, xdebug
coverage: xdebug
ini-values: memory_limit=-1

- name: Cache Composer Dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install Dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Setup Test Environment
run: |
# Wait for PostgreSQL
until pg_isready -h localhost -p 5432 -U postgres; do
echo "Waiting for PostgreSQL to be ready..."
sleep 1
done

# Copy test environment file
cp tests/.env.example tests/.env

# Update environment variables for GitHub Actions
sed -i 's/host=postgres/host=localhost/' tests/.env

- name: Run Unit Tests
env:
DB_DSN: "pgsql:host=localhost;port=5432;dbname=postgres"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
DB_SCHEMA: "public"
DB_TABLE_PREFIX: "craft"
CRAFT_SECURITY_KEY: "3WaPXa5zWQPi3YqkuZpc97JN8rNO-1Ba"
run: vendor/bin/codecept run unit

- name: Run Functional Tests
env:
DB_DSN: "pgsql:host=localhost;port=5432;dbname=postgres"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
DB_SCHEMA: "public"
DB_TABLE_PREFIX: "craft"
CRAFT_SECURITY_KEY: "3WaPXa5zWQPi3YqkuZpc97JN8rNO-1Ba"
run: vendor/bin/codecept run functional

- name: Run Tests with Coverage
env:
DB_DSN: "pgsql:host=localhost;port=5432;dbname=postgres"
DB_USER: "postgres"
DB_PASSWORD: "postgres"
DB_SCHEMA: "public"
DB_TABLE_PREFIX: "craft"
CRAFT_SECURITY_KEY: "3WaPXa5zWQPi3YqkuZpc97JN8rNO-1Ba"
CODECLIMATE_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
run: |
if [ -n "$CODECLIMATE_TEST_REPORTER_ID" ]; then
vendor/bin/codecept run --coverage --coverage-xml
else
echo "Code Climate token not available, skipping coverage upload"
vendor/bin/codecept run
fi

- name: Upload Coverage to Code Climate
if: env.CODECLIMATE_TEST_REPORTER_ID != ''
env:
CODECLIMATE_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
./cc-test-reporter format-coverage --input-type clover tests/_output/coverage.xml
./cc-test-reporter upload-coverage
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ Thumbs.db
.idea
node_modules
npm-debug.log
yarn-error.log
yarn-error.log


# Claude AI ignore files
todo.md
.claude/settings.local.json
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# oEmbed Changelog

## 3.1.7 - 2025-08-30

### Fixed

- Fixed broken URL email notifications not including the invalid URL in the message. Resolves [#170](https://github.com/wrav/oembed/issues/170)
- Fixed GraphQL error when querying entries with empty oEmbed URLs. Resolves [#156](https://github.com/wrav/oembed/issues/156)
- Fixed cookie file accumulation issue where embed-cookie files were not being cleaned up. Resolves [#152](https://github.com/wrav/oembed/issues/152)
- Added comprehensive validation to prevent empty or null URLs from causing notification issues
- Enhanced email template with better formatting and XSS protection
- Added debug logging for broken URL notification system to aid troubleshooting
- Fixed TypeError in generateCacheKey() when processing null URLs from GraphQL queries
- Implemented automatic cookie cleanup system with configurable cleanup intervals and file age limits

### Added

- Added unit tests for broken URL notification system
- Added validation layers across the notification flow (service → event → job)
- Added comprehensive unit tests for OembedModel null URL handling
- Added URL normalization at entry points (model constructor and service method)
- Added cookie cleanup console command (`php craft oembed/cookie/cleanup`)
- Added cookie cleanup settings: `enableCookieCleanup`, `cookieMaxAge`, and `cookiesPath`
- Added automatic cookie cleanup on plugin initialization with throttling to prevent performance impact
- Added comprehensive unit tests for cookie cleanup functionality

## 3.1.6 - 2025-08-08

### Fixed
Expand Down
Loading