# miniSISKA — Version Tracker

## Current Version

**v2.9.0** — 2026-05-26

---

## Version History

### v2.9.0 — 2026-05-26
**Non-Destructive Image Watermarking System**
- `config/watermark.php` — GD watermark engine (open, scale, position, blend, save)
- `api/apply_watermark.php` — per-image apply (saves `_wm` copy) / clear endpoint
- `api/preview_watermark.php` — live preview before committing
- `api/upload_watermark.php` — brand watermark asset upload
- `database/migrate_watermark.sql` — idempotent migration (14 new columns across 2 tables)
- `tests/test_watermark.php` — 37-check CLI integration test (37/37 PASS)
- `public/business_profiles.php` — Brand Kit section redesigned (asset library only, no placement controls)
- `public/index.php` — per-image watermark panel in Content History modal (position grid, sliders, preview, apply, clear, badge)
- `api/business_profiles.php` — saves wm brand kit fields (backward-safe)
- `api/history.php` — includes `processed_path`/`wm_enabled` in media response (backward-safe)
- `api/post_now.php` + `cron/post_scheduler.php` — use `processed_path` when watermarked, fallback to original
- Fixed: `refreshRowThumb()` now reflects watermarked hero image in history list

### v2.8.0 — 2026-05-15
**System Stability, Security & Deployment Preparation**
- `config/crypto.php` — AES-256-CBC token encryption utility (optional, backward-compatible)
- `api/social_accounts.php` — encrypt tokens on save, decrypt before API use
- `cron/post_scheduler.php` + `api/post_now.php` — token_decrypt() on account load
- `database/migrate_encrypt_tokens.php` — one-time migration for existing plaintext tokens
- `api/db_backup.php` — MySQL export/list/delete backup endpoint (timestamped SQL files)
- `public/dashboard.php` — Developer Tools full upgrade: Backup DB button, backup file list, delete, status chips, token encryption check
- `api/dev_tools.php` — added token_encryption health check
- `public/manifest.json` — PWA improvement: shortcuts, display_override, maskable icons, categories
- `docs/deployment.md` — full VPS/cPanel/ngrok deployment guide
- `.env.example` — added TOKEN_ENCRYPTION_KEY template
- `CHANGELOG.md` + `VERSION.md` updated to v2.8.0

### v2.7.0 — 2026-05-14
**Git & Development Safety System**
- Comprehensive `.gitignore` (secrets, uploads, logs, cache)
- `README.md` — full project documentation
- `CHANGELOG.md` — structured change log
- `docs/git-workflow.md` — Git backup, rollback, restore guide
- `git-backup.bat` / `git-backup.ps1` — one-click backup scripts
- `api/dev_tools.php` — system health check API
- Developer Tools panel added to `public/dashboard.php`
- Backup folder structure (`backups/database/`, `backups/media/`)
- `.env.example` — safe credential template

### v2.6.0 — 2026-05-13
**Advanced Content Structure System**
- Structured JSON output for all platforms (Hook, Script, CTA, Caption, WhatsApp Closing, Hashtags, Assembled)
- Per-platform field sets (FB, Instagram, Threads, Telegram, TikTok)
- Content component cards with individual copy buttons
- Color-coded component borders per field type
- `buildStructuredInstruction()` function in `api/openai.php`
- `renderStructured()` / `copyStruct()` in `public/index.php`
- `STRUCT_META` / `PLAT_FIELDS` constants

### v2.5.0 — 2026-05-12
**Video Upload & ffmpeg Auto-Conversion**
- Expanded video MIME type whitelist (MOV, AVI, WebM, MKV, 3GP, M4V, MPEG, WMV)
- `find_ffmpeg()` auto-detects ffmpeg installation (winget, common paths, PATH)
- Auto-converts non-MP4 video to MP4 H.264 + AAC on upload
- ffmpeg installed via `winget install --id Gyan.FFmpeg`
- Upload response includes `converted`, `convert_note`, `warn` fields

### v2.4.0 — 2026-05-12
**AI Media Analysis Fix**
- GD image resize to 1024px max before base64 encoding
- Prevents OpenAI vision failures on large iPhone/DSLR photos
- Added `response_format: json_object` to media analysis payload
- Updated system prompt to prevent AI refusals on unclear images
- Bumped max_tokens to 1000, temperature to 0.5

### v2.3.0 — 2026-05-11
**Threads 500-Character Fix**
- Auto-truncation at word boundary with `mb_strrpos`
- Added code 100 to `th_graph_error()` error mapping
- Truncated text appends `…` ellipsis

### v2.2.0 — 2026-05-11
**Threads Content Engine (9 Writing Modes)**
- 9 modes: Relatable, Storytelling, Opinion, Soft Feminine, Daily Thoughts, Mood Posting, Casual Luxury, Random Thoughts, Viral Conversation
- 3 length options: Short (120w), Medium (150-280w), Viral Shortform (3-5 lines)
- Generate 3 Variations feature (emotional / funny / luxury)
- `threads_prompt.txt` completely rewritten for Threads-native voice
- Threads mode/length selectors in generator UI
- Variations panel with `===VAR===` separator parsing

### v2.1.0 — 2026-05-10
**Threads Token Auto-Renewal**
- `th_refresh_token()` function — calls Threads refresh endpoint
- `cron/refresh_tokens.php` — batch renewal for all Threads accounts
- `cron/run_refresh_tokens.bat` — Windows Task Scheduler launcher
- Windows Task Scheduler task registered (weekly, Sunday 3am)
- Token expiry badge in `public/social_accounts.php` (green/orange/red)
- `sa_test_threads()` auto-renews when token has < 30 days remaining
- `token_expires_at` added to `sa_list()` SELECT

### v2.0.0 — 2026-05-08
**AI Media Analysis (Vision)**
- `api/media_analysis.php` — OpenAI GPT-4o vision analysis
- Analyze button appears after media upload
- Auto-fills product name, details, extra instruction fields
- AI analysis panel with detected fields and hook suggestions
- Video thumbnail extraction via Canvas API (client-side)
- `ai_analysis` column in `contents` table

### v1.5.0 — 2026-05-07
**Media Upload + Social Posting Queue**
- `api/upload.php` — file upload with MIME validation
- `storage/uploads/.htaccess` — blocks PHP execution
- Social account manager (`api/social_accounts.php`)
- `public/social_accounts.php` — account manager UI
- `social/meta.php` — Facebook + Instagram Graph API
- `social/threads.php` — Threads Graph API
- `social/telegram.php` — Telegram Bot API
- `social/tiktok.php` — TikTok placeholder
- `api/queue.php` — cron HTTP endpoint
- Platform checkboxes, media preview, schedule picker in UI

### v1.2.0 — 2026-05-05
**Content Output Styles**
- 12 output styles: natural, structured, viral, luxury, short, softsell, hardsell, storytelling, viral_hook, elegant, bahasa_pasar, netizen
- Prompt files rewritten to remove numbered section labels
- Hard rule: "Do not add section labels, headers, or numbered lists"

### v1.1.0 — 2026-05-04
**MySQL Save System**
- `config/database.php` — MySQLi connection
- `database/schema.sql` — full table definition
- `api/save.php`, `api/history.php`, `api/action.php`
- Content history panel in UI
- Approve/delete/schedule/mark_posted actions

### v1.0.0 — 2026-05-03
**Initial Release**
- `config/env.php` — secure .env parser
- `api/openai.php` — OpenAI chat completions
- `public/index.php` — dark theme single-page app
- Platform prompts: FB, Threads, TikTok, Telegram
- `.htaccess` security (blocks .env, config/, logs/)

---

## Upcoming (Planned)

- Real TikTok API integration
- Multi-image carousel support
- Instagram Stories posting
- ERP/accounting module (Phase 3)
- WhatsApp Business API
- Advanced scheduling calendar UI
