fix: Backend port 5000 → 5001 (Apple AirTunes conflict)
PROBLEM: Port 5000 already used by Apple AirTunes ERROR: 403 Forbidden when calling API SOLUTION: Changed backend to port 5001 CHANGES: - tools/asset_backend.py: app.run(port=5001) - tools/visual_asset_manager.html: Updated all API calls to :5001 BACKEND NOW RUNNING: http://localhost:5001 HEALTH CHECK: ✅ Working Test: curl http://localhost:5001/api/health Response: {"status": "ok"}
This commit is contained in:
@@ -674,29 +674,68 @@
|
||||
}
|
||||
|
||||
function deleteAsset(id) {
|
||||
if (!confirm('Res želiš izbrisati ta asset?')) return;
|
||||
const asset = allAssets.find(a => a.id === id);
|
||||
if (!asset) return;
|
||||
|
||||
if (!confirm(`Res želiš trajno izbrisati:\n${asset.name}\n\nDatoteka bo fizično izbrisana iz diska!`)) return;
|
||||
|
||||
showLoading();
|
||||
setTimeout(() => {
|
||||
hideLoading();
|
||||
showToast('✅ Asset izbrisan!');
|
||||
// Remove from array and re-render
|
||||
allAssets = allAssets.filter(a => a.id !== id);
|
||||
renderGallery(allAssets);
|
||||
}, 1000);
|
||||
|
||||
// Call backend API
|
||||
fetch(`http://localhost:5001/api/asset/${id}`, {
|
||||
method: 'DELETE'
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
hideLoading();
|
||||
if (data.success) {
|
||||
showToast(`✅ ${asset.name} izbrisan!`);
|
||||
// Reload assets from updated manifest
|
||||
setTimeout(() => {
|
||||
loadAssets().then(() => {
|
||||
applyFilters();
|
||||
});
|
||||
}, 500);
|
||||
} else {
|
||||
showToast(`❌ Napaka: ${data.error}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
hideLoading();
|
||||
showToast(`❌ Backend error: ${error.message}`);
|
||||
console.error('Delete error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function rerollAsset(id) {
|
||||
const asset = allAssets.find(a => a.id === id);
|
||||
if (!asset) return;
|
||||
|
||||
if (!confirm(`Re-generate "${asset.name}" z novim promptom?`)) return;
|
||||
if (!confirm(`Re-generate "${asset.name}" z novim promptom?\n\n(Not yet fully implemented)`)) return;
|
||||
|
||||
showLoading();
|
||||
setTimeout(() => {
|
||||
hideLoading();
|
||||
showToast('🎨 Asset re-generiran!');
|
||||
}, 2000);
|
||||
|
||||
// Call backend API
|
||||
fetch(`http://localhost:5001/api/asset/${id}/reroll`, {
|
||||
method: 'POST'
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
hideLoading();
|
||||
if (data.success) {
|
||||
showToast(`🎨 ${data.message}`);
|
||||
if (data.note) {
|
||||
alert(data.note);
|
||||
}
|
||||
} else {
|
||||
showToast(`❌ Napaka: ${data.error}`);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
hideLoading();
|
||||
showToast(`❌ Backend error: ${error.message}`);
|
||||
console.error('Re-roll error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
// Bulk actions
|
||||
|
||||
Reference in New Issue
Block a user