feat: v0.2.1 — fix encryption, diverse multi-topic generation, UX fixes

- Rewrite encryption with "enc:" prefix to permanently eliminate
  the double-encryption bug on settings save
- Add one-time migration to clear legacy non-prefixed encrypted values
- Rewrite content analyzer prompts to request N distinct diverse topics
  across 5 categories (question, complaint, comparison, news, guide)
- Pass target_count*2 from pipeline to analyzer for headroom
- Add skip_dedup flag so manual Generate Now always produces content
- Generate Now button now sends force=1 to clear stale locks
- Rename OpenRouter provider files to PSR-4 convention (hyphenated)
- Switch default models to google/gemini-2.5-flash-lite
- Clean up reddit_debug log channel to standard 'reddit'
- Bump version to 0.2.1

Cost: ~$0.003/article with Gemini 2.0 Flash, ~34s pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-12 13:36:36 +07:00
parent 726b378a52
commit b5cbbef804
15 changed files with 509 additions and 67 deletions

View File

@@ -255,7 +255,21 @@ class PRAutoBlogger_Admin_Page {
$encrypted = [ 'prautoblogger_openrouter_api_key', 'prautoblogger_ga4_credentials_json' ];
if ( in_array( $option_name, $encrypted, true ) ) {
if ( '' === $value ) { return get_option( $option_name, '' ); }
// Empty value means password field wasn't touched — keep existing.
if ( '' === $value ) {
return get_option( $option_name, '' );
}
// Already encrypted (has "enc:" prefix) — return as-is.
// This is the primary defence against double-encryption:
// PRAutoBlogger_Encryption::encrypt() also checks for this prefix,
// so even if this callback is called multiple times, the value
// is encrypted exactly once and never re-encrypted.
if ( PRAutoBlogger_Encryption::is_encrypted( $value ) ) {
return $value;
}
// New plaintext value — encrypt it (adds "enc:" prefix).
return PRAutoBlogger_Encryption::encrypt( sanitize_text_field( $value ) );
}