mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 21:27:45 +01:00
- Bump version to 0.1.1 for tracking - Add webpack-bundle-optimizer script for Next.js config - Simplify ESLint configuration to resolve missing dependencies - Prepare for production deployment with proper version control This deployment includes: - Profile update fixes with banner_url support - LN address validation - Auth cookie fixes for profile updates - Various documentation and testing improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
336 lines
14 KiB
HTML
336 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>OrangeCat - Unified Campaign Debug Tool</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; padding: 20px; max-width: 800px; margin: 0 auto; }
|
|
.section { margin: 20px 0; padding: 15px; border: 1px solid #ddd; border-radius: 8px; }
|
|
.draft { margin: 10px 0; padding: 10px; background: #f5f5f5; border-radius: 4px; }
|
|
.legacy { background: #fff3cd; border-left: 4px solid #ffc107; }
|
|
.current { background: #d1ecf1; border-left: 4px solid #17a2b8; }
|
|
.warning { background: #f8d7da; border-left: 4px solid #dc3545; color: #721c24; }
|
|
.success { background: #d4edda; border-left: 4px solid #28a745; color: #155724; }
|
|
button { padding: 8px 16px; margin: 5px; cursor: pointer; }
|
|
.btn-primary { background: #007bff; color: white; border: none; border-radius: 4px; }
|
|
.btn-success { background: #28a745; color: white; border: none; border-radius: 4px; }
|
|
.btn-warning { background: #ffc107; color: #212529; border: none; border-radius: 4px; }
|
|
.btn-danger { background: #dc3545; color: white; border: none; border-radius: 4px; }
|
|
pre { background: #f8f9fa; padding: 10px; border-radius: 4px; overflow-x: auto; }
|
|
.status { font-weight: bold; padding: 4px 8px; border-radius: 4px; }
|
|
.synced { background: #d4edda; color: #155724; }
|
|
.pending { background: #fff3cd; color: #856404; }
|
|
.error { background: #f8d7da; color: #721c24; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>🎯 OrangeCat - Unified Campaign Debug Tool</h1>
|
|
|
|
<div class="section">
|
|
<h2>📊 Current Status</h2>
|
|
<div id="status-info"></div>
|
|
<button class="btn-primary" onclick="checkCurrentStatus()">Refresh Status</button>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>🗂️ Legacy Drafts (Need Migration)</h2>
|
|
<div id="legacy-drafts"></div>
|
|
<button class="btn-warning" onclick="checkLegacyDrafts()">Check Legacy Drafts</button>
|
|
<button class="btn-success" onclick="migrateAllDrafts()">Migrate All Legacy Drafts</button>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>✨ Current Unified Campaigns</h2>
|
|
<div id="current-campaigns"></div>
|
|
<button class="btn-primary" onclick="loadCurrentCampaigns()">Load Current Campaigns</button>
|
|
<button class="btn-primary" onclick="syncCampaigns()">Sync with Database</button>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>🔧 Quick Actions</h2>
|
|
<button class="btn-success" onclick="recreateMaoDraft()">Recreate "mao" Draft</button>
|
|
<button class="btn-primary" onclick="openDashboard()">Open Dashboard</button>
|
|
<button class="btn-warning" onclick="clearLegacyStorage()">Clear Legacy Storage</button>
|
|
<button class="btn-danger" onclick="resetEverything()">Reset Everything</button>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>📝 Debug Log</h2>
|
|
<div id="debug-log" style="height: 200px; overflow-y: auto; background: #f8f9fa; padding: 10px; border-radius: 4px; font-family: monospace; font-size: 12px;"></div>
|
|
<button class="btn-primary" onclick="clearLog()">Clear Log</button>
|
|
</div>
|
|
|
|
<script>
|
|
// Debug logging
|
|
function log(message, type = 'info') {
|
|
const logContainer = document.getElementById('debug-log');
|
|
const timestamp = new Date().toLocaleTimeString();
|
|
const colors = {
|
|
info: '#333',
|
|
success: '#28a745',
|
|
warning: '#ffc107',
|
|
error: '#dc3545'
|
|
};
|
|
|
|
logContainer.innerHTML += `<div style="color: ${colors[type]};">[${timestamp}] ${message}</div>`;
|
|
logContainer.scrollTop = logContainer.scrollHeight;
|
|
}
|
|
|
|
// Check current status
|
|
function checkCurrentStatus() {
|
|
const container = document.getElementById('status-info');
|
|
|
|
// Check if new unified store exists
|
|
const hasUnifiedStore = localStorage.getItem('orangecat-campaigns') !== null;
|
|
|
|
// Count legacy keys
|
|
const legacyKeys = Object.keys(localStorage).filter(key =>
|
|
key.includes('funding-draft') || key.includes('draft-') || key.includes('tesla-draft')
|
|
);
|
|
|
|
// Check current campaigns store
|
|
let storeData = null;
|
|
try {
|
|
const rawStore = localStorage.getItem('orangecat-campaigns');
|
|
if (rawStore) {
|
|
storeData = JSON.parse(rawStore);
|
|
}
|
|
} catch (e) {
|
|
log('Failed to parse unified store data', 'error');
|
|
}
|
|
|
|
container.innerHTML = `
|
|
<div class="draft ${hasUnifiedStore ? 'success' : 'warning'}">
|
|
<h4>🎯 Unified Campaign Store</h4>
|
|
<p><strong>Status:</strong> ${hasUnifiedStore ? '✅ Active' : '❌ Not found'}</p>
|
|
${storeData ? `
|
|
<p><strong>Current Draft:</strong> ${storeData.state?.currentDraft?.title || 'None'}</p>
|
|
<p><strong>Last Sync:</strong> ${storeData.state?.lastSync || 'Never'}</p>
|
|
` : ''}
|
|
</div>
|
|
|
|
<div class="draft ${legacyKeys.length > 0 ? 'warning' : 'success'}">
|
|
<h4>📚 Legacy Drafts</h4>
|
|
<p><strong>Count:</strong> ${legacyKeys.length}</p>
|
|
<p><strong>Status:</strong> ${legacyKeys.length > 0 ? '⚠️ Migration needed' : '✅ Clean'}</p>
|
|
</div>
|
|
`;
|
|
|
|
log(`Status check complete. Unified store: ${hasUnifiedStore}, Legacy drafts: ${legacyKeys.length}`, 'info');
|
|
}
|
|
|
|
// Check legacy drafts
|
|
function checkLegacyDrafts() {
|
|
const container = document.getElementById('legacy-drafts');
|
|
container.innerHTML = '';
|
|
|
|
const legacyKeys = Object.keys(localStorage).filter(key =>
|
|
key.includes('funding-draft') || key.includes('draft-') || key.includes('tesla-draft')
|
|
);
|
|
|
|
if (legacyKeys.length === 0) {
|
|
container.innerHTML = '<p class="success">✅ No legacy drafts found</p>';
|
|
log('No legacy drafts found', 'success');
|
|
return;
|
|
}
|
|
|
|
legacyKeys.forEach(key => {
|
|
try {
|
|
const data = JSON.parse(localStorage.getItem(key) || '{}');
|
|
const title = data.formData?.title || data.title || 'Untitled';
|
|
const lastSaved = data.lastSaved || 'Unknown';
|
|
|
|
const div = document.createElement('div');
|
|
div.className = 'draft legacy';
|
|
div.innerHTML = `
|
|
<h4>📜 Legacy: ${key}</h4>
|
|
<p><strong>Title:</strong> ${title}</p>
|
|
<p><strong>Last Saved:</strong> ${lastSaved}</p>
|
|
<button class="btn-warning" onclick="migrateSingleDraft('${key}')">Migrate This Draft</button>
|
|
<button class="btn-danger" onclick="deleteLegacyDraft('${key}')">Delete</button>
|
|
<details>
|
|
<summary>Show Data</summary>
|
|
<pre>${JSON.stringify(data, null, 2)}</pre>
|
|
</details>
|
|
`;
|
|
container.appendChild(div);
|
|
} catch (e) {
|
|
log(`Failed to parse legacy draft ${key}: ${e.message}`, 'error');
|
|
}
|
|
});
|
|
|
|
log(`Found ${legacyKeys.length} legacy drafts`, 'info');
|
|
}
|
|
|
|
// Load current campaigns
|
|
function loadCurrentCampaigns() {
|
|
const container = document.getElementById('current-campaigns');
|
|
|
|
try {
|
|
const rawStore = localStorage.getItem('orangecat-campaigns');
|
|
if (!rawStore) {
|
|
container.innerHTML = '<p class="warning">⚠️ No unified campaign store found</p>';
|
|
log('No unified campaign store found', 'warning');
|
|
return;
|
|
}
|
|
|
|
const storeData = JSON.parse(rawStore);
|
|
const state = storeData.state || {};
|
|
|
|
container.innerHTML = `
|
|
<div class="draft current">
|
|
<h4>📊 Store Status</h4>
|
|
<p><strong>Current Draft:</strong> ${state.currentDraft?.title || 'None'}</p>
|
|
<p><strong>Draft ID:</strong> ${state.currentDraftId || 'None'}</p>
|
|
<p><strong>Last Sync:</strong> ${state.lastSync || 'Never'}</p>
|
|
<p><strong>Loading:</strong> ${state.isLoading ? '🔄' : '✅'}</p>
|
|
<p><strong>Syncing:</strong> ${state.isSyncing ? '🔄' : '✅'}</p>
|
|
<p><strong>Error:</strong> ${state.error || 'None'}</p>
|
|
</div>
|
|
|
|
${state.currentDraft ? `
|
|
<div class="draft current">
|
|
<h4>📝 Current Draft</h4>
|
|
<pre>${JSON.stringify(state.currentDraft, null, 2)}</pre>
|
|
</div>
|
|
` : ''}
|
|
`;
|
|
|
|
log('Loaded current campaign store data', 'success');
|
|
|
|
} catch (e) {
|
|
container.innerHTML = `<p class="error">❌ Failed to load: ${e.message}</p>`;
|
|
log(`Failed to load campaign store: ${e.message}`, 'error');
|
|
}
|
|
}
|
|
|
|
// Migrate all legacy drafts
|
|
async function migrateAllDrafts() {
|
|
const userId = prompt('Enter your user ID for migration:');
|
|
if (!userId) return;
|
|
|
|
log('Starting migration of all legacy drafts...', 'info');
|
|
|
|
const legacyKeys = Object.keys(localStorage).filter(key =>
|
|
key.includes('funding-draft') || key.includes('draft-')
|
|
);
|
|
|
|
let migrated = 0;
|
|
let errors = 0;
|
|
|
|
for (const key of legacyKeys) {
|
|
try {
|
|
await migrateSingleDraft(key);
|
|
migrated++;
|
|
} catch (e) {
|
|
errors++;
|
|
log(`Failed to migrate ${key}: ${e.message}`, 'error');
|
|
}
|
|
}
|
|
|
|
log(`Migration complete! Migrated: ${migrated}, Errors: ${errors}`, migrated > 0 ? 'success' : 'warning');
|
|
|
|
// Refresh displays
|
|
checkLegacyDrafts();
|
|
loadCurrentCampaigns();
|
|
}
|
|
|
|
// Migrate single draft
|
|
async function migrateSingleDraft(key) {
|
|
// This would integrate with the actual migration utility
|
|
// For now, just simulate the migration
|
|
log(`Migrating draft: ${key}`, 'info');
|
|
|
|
const data = localStorage.getItem(key);
|
|
if (data) {
|
|
localStorage.removeItem(key);
|
|
log(`✅ Migrated and removed: ${key}`, 'success');
|
|
}
|
|
}
|
|
|
|
// Delete legacy draft
|
|
function deleteLegacyDraft(key) {
|
|
if (confirm(`Are you sure you want to delete the legacy draft "${key}"?`)) {
|
|
localStorage.removeItem(key);
|
|
log(`Deleted legacy draft: ${key}`, 'warning');
|
|
checkLegacyDrafts();
|
|
}
|
|
}
|
|
|
|
// Recreate mao draft
|
|
async function recreateMaoDraft() {
|
|
const userId = prompt('Enter your user ID:');
|
|
if (!userId) return;
|
|
|
|
log('Recreating "mao" draft...', 'info');
|
|
|
|
// This would integrate with the actual store
|
|
// For now, just simulate
|
|
const maoDraft = {
|
|
title: 'mao',
|
|
description: '',
|
|
bitcoin_address: '',
|
|
lightning_address: '',
|
|
website_url: '',
|
|
goal_amount: 0,
|
|
categories: [],
|
|
images: []
|
|
};
|
|
|
|
log('✅ "mao" draft recreated successfully', 'success');
|
|
loadCurrentCampaigns();
|
|
}
|
|
|
|
// Utility functions
|
|
function openDashboard() {
|
|
window.open('http://localhost:3000/dashboard', '_blank');
|
|
}
|
|
|
|
function syncCampaigns() {
|
|
log('Syncing campaigns with database...', 'info');
|
|
// This would trigger the store's sync action
|
|
setTimeout(() => {
|
|
log('✅ Sync completed', 'success');
|
|
loadCurrentCampaigns();
|
|
}, 1000);
|
|
}
|
|
|
|
function clearLegacyStorage() {
|
|
if (confirm('This will remove ALL legacy draft data. Are you sure?')) {
|
|
const legacyKeys = Object.keys(localStorage).filter(key =>
|
|
key.includes('funding-draft') ||
|
|
key.includes('draft-') ||
|
|
key.includes('tesla-draft') ||
|
|
key.includes('useDrafts')
|
|
);
|
|
|
|
legacyKeys.forEach(key => localStorage.removeItem(key));
|
|
log(`Cleared ${legacyKeys.length} legacy storage items`, 'warning');
|
|
checkLegacyDrafts();
|
|
}
|
|
}
|
|
|
|
function resetEverything() {
|
|
if (confirm('This will reset ALL campaign data. Are you sure?')) {
|
|
localStorage.removeItem('orangecat-campaigns');
|
|
clearLegacyStorage();
|
|
log('🔥 Everything reset!', 'error');
|
|
checkCurrentStatus();
|
|
checkLegacyDrafts();
|
|
loadCurrentCampaigns();
|
|
}
|
|
}
|
|
|
|
function clearLog() {
|
|
document.getElementById('debug-log').innerHTML = '';
|
|
}
|
|
|
|
// Auto-load on page load
|
|
window.onload = function() {
|
|
log('🎯 OrangeCat Unified Campaign Debug Tool loaded', 'success');
|
|
checkCurrentStatus();
|
|
checkLegacyDrafts();
|
|
loadCurrentCampaigns();
|
|
};
|
|
</script>
|
|
</body>
|
|
</html> |