This commit is contained in:
IGNY8 VPS (Salman)
2026-01-10 08:47:36 +00:00
parent b0c941dba5
commit 60f981cafd
7 changed files with 747 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
# WordPress Integration & Publishing Flow - Complete Technical Documentation
**Last Updated:** January 1, 2026
**Version:** 1.3.0
**Last Updated:** January 10, 2026
**Version:** 1.7.0
**Status:** Production Active
---
@@ -15,8 +15,9 @@
5. [Webhook Sync Flow (WordPress → IGNY8)](#5-webhook-sync-flow-wordpress--igny8)
6. [Metadata Sync Flow](#6-metadata-sync-flow)
7. [Data Models & Storage](#7-data-models--storage)
8. [Current Implementation Gaps](#8-current-implementation-gaps)
9. [Flow Diagrams](#9-flow-diagrams)
8. [Plugin Distribution System](#8-plugin-distribution-system)
9. [Current Implementation](#9-current-implementation)
10. [Flow Diagrams](#10-flow-diagrams)
---
@@ -28,6 +29,8 @@ IGNY8 integrates with WordPress sites through a **custom WordPress plugin** (`ig
- Receives content from IGNY8 via a custom REST endpoint (`/wp-json/igny8/v1/publish`)
- Sends status updates back to IGNY8 via webhooks
- Authenticates using API keys stored in both systems
- Auto-updates via IGNY8 plugin distribution system (v1.7.0+)
- Supports advanced template rendering with image layouts
### Communication Pattern
@@ -40,6 +43,9 @@ IGNY8 App ←→ WordPress Site
│ HTTP POST │
│←─────────────┤ Webhook status updates via /api/v1/integration/webhooks/wordpress/status/
│ │
│ HTTP GET │
├─────────────→│ Check plugin updates via /wp-json/igny8/v1/check-update
│ │
```
### Key Components
@@ -48,10 +54,20 @@ IGNY8 App ←→ WordPress Site
|-----------|----------|---------|
| SiteIntegration Model | `business/integration/models.py` | Stores WordPress credentials & config |
| SyncEvent Model | `business/integration/models.py` | Logs all sync operations |
| Plugin Models | `plugins/models.py` | Plugin versioning and distribution |
| Celery Task | `tasks/wordpress_publishing.py` | Background publishing worker |
| Webhook Handler | `modules/integration/webhooks.py` | Receives WordPress status updates |
| Frontend Form | `components/sites/WordPressIntegrationForm.tsx` | User setup UI |
### Recent Updates (v1.7.0)
**Plugin Distribution System:**
- ✅ Automated plugin distribution and updates
- ✅ WordPress plugin v1.3.3 with template improvements
- ✅ Image layout fixes (square/landscape positioning)
- ✅ Auto-update mechanism via WordPress hooks
- ✅ Health check and monitoring endpoints
---
## 2. Integration Setup Flow
@@ -60,10 +76,30 @@ IGNY8 App ←→ WordPress Site
1. WordPress 5.6+ with REST API enabled
2. Pretty permalinks enabled (Settings → Permalinks)
3. IGNY8 WordPress Bridge plugin installed and activated
3. IGNY8 WordPress Bridge plugin v1.3.0+ installed and activated
4. No security plugins blocking REST API
### 2.2 Setup Steps (User Flow)
### 2.2 Plugin Installation (Updated v1.7.0)
**Option 1: Manual Download & Install**
- User downloads latest plugin from IGNY8 app
- Frontend: Site Settings → WordPress Integration → Download Plugin
- Download endpoint: `https://api.igny8.com/api/plugins/igny8-wp-bridge/download/`
- Installs in WordPress: Plugins → Add New → Upload ZIP
**Option 2: Direct URL Install**
- WordPress admin → Plugins → Add New → Upload Plugin
- Paste ZIP URL with signed download token
- Plugin installs and auto-registers with IGNY8
**Plugin Auto-Update:**
- WordPress checks for updates every 12 hours
- Plugin hooks into `pre_set_site_transient_update_plugins`
- Compares current version with latest from IGNY8 API
- Notifies admin if update available
- Can be updated via WordPress admin (one-click)
### 2.3 Setup Steps (User Flow)
**Step 1: User navigates to Site Settings**
- Frontend: `/sites/{id}/settings` → WordPress Integration section
@@ -74,11 +110,9 @@ IGNY8 App ←→ WordPress Site
- Body: `{ "site_id": 123 }`
- Backend creates/updates `SiteIntegration` record with new API key
**Step 3: User copies API key and configures WordPress plugin**
- User downloads plugin from GitHub releases
- Installs in WordPress: Plugins → Add New → Upload
**Step 3: User configures WordPress plugin**
- Configures plugin with:
- IGNY8 API URL: `https://app.igny8.com`
- IGNY8 API URL: `https://api.igny8.com`
- Site API Key: (copied from IGNY8)
- Site ID: (shown in IGNY8)
@@ -86,10 +120,10 @@ IGNY8 App ←→ WordPress Site
- User clicks "Test Connection" in either app
- IGNY8 calls: `GET {wordpress_url}/wp-json/wp/v2/users/me`
- Uses API key in `X-IGNY8-API-KEY` header
- Success: Connection verified, `is_active` set to true
- Success: Connection verified, `is_active` set to true, plugin registers installation
- Failure: Error message displayed
### 2.3 Data Created During Setup
### 2.4 Data Created During Setup
**SiteIntegration Record:**
```json
@@ -463,18 +497,124 @@ Refreshes understanding of WordPress site:
- WordPress plugin must download and create attachment
- If plugin doesn't handle this, no featured image
### 8.5 Missing: Conflict Resolution
---
**Problem:** If content is edited in both IGNY8 and WordPress, there's no merge strategy.
## 8. Plugin Distribution System
**Current State:**
- Last write wins
- No version tracking
- No conflict detection
### 8.1 Architecture (v1.7.0)
**Plugin Distribution Components:**
- `Plugin` model - Multi-platform plugin registry
- `PluginVersion` model - Version tracking with files and checksums
- `PluginInstallation` model - Installation tracking per site
- `PluginDownload` model - Download analytics
**Distribution Endpoints:**
```
GET /api/plugins/igny8-wp-bridge/download/ - Download latest ZIP
POST /api/plugins/igny8-wp-bridge/check-update/ - Check for updates
GET /api/plugins/igny8-wp-bridge/info/ - Plugin metadata
POST /api/plugins/igny8-wp-bridge/register/ - Register installation
POST /api/plugins/igny8-wp-bridge/health-check/ - Health monitoring
```
### 8.2 Auto-Update Mechanism
**WordPress Side:**
1. Plugin hooks into `pre_set_site_transient_update_plugins`
2. Calls `/api/plugins/igny8-wp-bridge/check-update/` with current version
3. Receives update info if newer version available
4. WordPress displays update notification
5. User clicks "Update Now" (or auto-update runs)
6. WordPress downloads ZIP from `/download/` endpoint
7. Installs and activates new version
**IGNY8 Side:**
1. Developer updates plugin source code
2. Creates new `PluginVersion` in Django admin
3. Changes status to "released"
4. Signal automatically builds ZIP with checksums
5. Files stored in `/plugins/wordpress/dist/`
6. WordPress sites can now download/update
### 8.3 Version History (Recent)
| Version | Date | Changes |
|---------|------|---------|
| 1.3.3 | Jan 10, 2026 | Template design: Square image grid fixes, landscape positioning, direct styling for images without captions |
| 1.3.2 | Jan 9, 2026 | Template rendering improvements, image layout enhancements |
| 1.3.1 | Jan 9, 2026 | Plugin versioning updates |
| 1.3.0 | Jan 8, 2026 | Distribution system release, auto-update mechanism |
### 8.4 Security Features
- **Signed URLs:** Download links expire after configurable time
- **Checksums:** MD5 and SHA256 verification
- **Rate Limiting:** Per IP/site download limits
- **API Authentication:** Required for sensitive operations
- **Version Verification:** WordPress validates plugin before update
### 8.5 Monitoring
**Installation Tracking:**
- Total installations per version
- Active installations by site
- Version distribution analytics
**Download Analytics:**
- Download counts per version
- Geographic distribution
- Failed download attempts
**Health Checks:**
- Plugin health status per installation
- Error reporting from WordPress sites
- Version compatibility tracking
---
## 9. Flow Diagrams
## 9. Current Implementation
### 9.1 Production Status (v1.7.0)
**✅ Fully Operational:**
- WordPress plugin distribution system
- Auto-update mechanism
- Template rendering with advanced layouts
- Image positioning (square/landscape)
- Content publishing (manual + automation)
- Webhook status sync
- API authentication
- Health monitoring
**✅ Template Features (v1.3.3):**
- Square images: Side-by-side layout (left/right aligned)
- Landscape images: Full-width with max 1024px
- Images appear after first paragraph in sections
- Direct border-radius/shadow on images without captions
- Responsive design for mobile/tablet
### 9.2 Known Limitations
**Missing Features:**
- Bi-directional content sync (WordPress → IGNY8 editing)
- Conflict resolution for dual edits
- Advanced metadata sync beyond basics
- Multi-site WordPress network support
- Custom post type publishing
### 9.3 Future Enhancements
**Planned:**
- Image regeneration feature (Phase 9)
- Advanced template customization
- Custom field mapping
- Bulk publishing operations
- Real-time sync notifications
---
## 10. Flow Diagrams
### 9.1 Integration Setup
@@ -486,26 +626,33 @@ Refreshes understanding of WordPress site:
│ 1. Open Site Settings │
├─────────────────>│ │
│ │ │
│ 2. Generate API Key
│ 2. Download Plugin
├─────────────────>│ │
│ │ │
│<─────────────────┤ │
│ 3. Display API Key
│ 3. Plugin ZIP │
│ │ │
│ 4. Install Plugin──────────────────────┼──────────>
│ │ │
│ 5. Enter API Key in Plugin─────────────┼──────────>
│ │ │
│ 6. Test Connection │
│ 5. Generate API Key
├─────────────────>│ │
│ 7. GET /wp-json/...
<─────────────────┤
│ 6. Display API Key │
│ │ │
│ 7. Enter API Key in Plugin─────────────┼──────────>
│ │ │
│ 8. Test Connection │
├─────────────────>│ │
│ │ 9. GET /wp-json/... │
│ ├────────────────────>│
│ │<────────────────────┤
│<─────────────────┤ 8. Success
│<─────────────────┤ 10. Success │
│ │ │
│ │ 11. Register Install│
│ │<────────────────────┤
```
### 9.2 Manual Publishing
### 10.2 Manual Publishing
```
┌──────────┐ ┌──────────────┐ ┌──────────┐ ┌───────────────┐
@@ -534,7 +681,43 @@ Refreshes understanding of WordPress site:
│ │ │ │
```
### 9.3 Webhook Status Sync
### 10.3 Plugin Auto-Update Flow
```
┌───────────────┐ ┌──────────────┐
│ WordPress │ │ IGNY8 API │
└───────┬───────┘ └──────┬───────┘
│ │
│ 1. Check for updates (cron)
│ POST /check-update/│
├───────────────────>│
│ (current: 1.3.2) │
│ │
│<───────────────────┤
│ 2. Update available│
│ (latest: 1.3.3) │
│ │
│ 3. User clicks │
│ "Update Now" │
│ │
│ GET /download/ │
├───────────────────>│
│ │
│<───────────────────┤
│ 4. ZIP file │
│ │
│ 5. Install & Activate
│ │
│ POST /register/ │
├───────────────────>│
│ (new version info) │
│ │
│<───────────────────┤
│ 6. Registration OK │
│ │
```
### 10.4 Webhook Status Sync
```
┌───────────────┐ ┌──────────────┐