Fix archive missing on manual publish; refresh VK token instructions
- Mark scheduled post as 'published' instead of deleting it when user clicks "Опубликовать сейчас", so it appears in the archive (parity with cron path) - Surface VK warnings (e.g. photos posted as links when community token lacks photos right) in both the post-publish notification and the archive card - Replace dead vkhost.github.io / VK Admin instructions with a community-token flow via group settings, since VK now blocks the old app (error 8) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3679,14 +3679,24 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const anySuccess = Object.values(results).some(r => r.success);
|
||||
|
||||
if (anySuccess) {
|
||||
// Delete the scheduled post
|
||||
const delForm = new FormData();
|
||||
delForm.append('action', 'delete_scheduled_post');
|
||||
delForm.append('id', postId);
|
||||
await fetch('api.php', { method: 'POST', body: delForm });
|
||||
// Mark scheduled post as published so it appears in archive
|
||||
const markForm = new FormData();
|
||||
markForm.append('action', 'mark_post_published');
|
||||
markForm.append('id', postId);
|
||||
markForm.append('results', JSON.stringify(results));
|
||||
await fetch('api.php', { method: 'POST', body: markForm });
|
||||
|
||||
showNotification(allSuccess ? 'Опубликовано!' : 'Частично опубликовано', allSuccess ? 'success' : 'warning');
|
||||
// Surface VK warnings (e.g. photos posted as links instead of attachments)
|
||||
const warnings = Object.entries(results)
|
||||
.filter(([, r]) => r.success && r.warning)
|
||||
.map(([p, r]) => `${p.toUpperCase()}: ${r.warning}`);
|
||||
if (warnings.length > 0) {
|
||||
showNotification('Опубликовано с предупреждением — ' + warnings.join(' | '), 'warning');
|
||||
} else {
|
||||
showNotification(allSuccess ? 'Опубликовано!' : 'Частично опубликовано', allSuccess ? 'success' : 'warning');
|
||||
}
|
||||
loadScheduledPosts();
|
||||
loadPublishedPosts();
|
||||
} else {
|
||||
const errors = Object.entries(results).map(([p, r]) => `${p}: ${r.error}`).join(', ');
|
||||
showNotification('Ошибка: ' + errors, 'error');
|
||||
@@ -3734,10 +3744,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
// Check results for success/error
|
||||
const results = post.results || {};
|
||||
let statusIcons = '';
|
||||
let warningText = '';
|
||||
Object.entries(results).forEach(([platform, result]) => {
|
||||
const icon = result.success ? '✓' : '✗';
|
||||
const icon = result.success ? (result.warning ? '⚠' : '✓') : '✗';
|
||||
const platformName = platform === 'telegram' ? 'TG' : platform === 'vk' ? 'VK' : platform;
|
||||
statusIcons += `<span class="result-${result.success ? 'success' : 'error'}" title="${result.error || 'OK'}">${platformName} ${icon}</span> `;
|
||||
const tip = result.error || result.warning || 'OK';
|
||||
const cls = result.success ? (result.warning ? 'result-warning' : 'result-success') : 'result-error';
|
||||
statusIcons += `<span class="${cls}" title="${escapeHtml(tip)}">${platformName} ${icon}</span> `;
|
||||
if (result.warning) {
|
||||
warningText = `${platformName}: ${result.warning}`;
|
||||
}
|
||||
});
|
||||
|
||||
// Collect all photo URLs for preview
|
||||
@@ -3766,6 +3782,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
</div>
|
||||
${photosPreviewHtml}
|
||||
${post.text ? `<p class="archive-text">${escapeHtml(post.text.substring(0, 100))}${post.text.length > 100 ? '...' : ''}</p>` : ''}
|
||||
${warningText ? `<p class="archive-warning">⚠ ${escapeHtml(warningText)}</p>` : ''}
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
|
||||
Reference in New Issue
Block a user