Dateien nach "frontend/src" hochladen

This commit is contained in:
2026-05-26 15:12:17 +02:00
parent 777ebcbb02
commit d656027a20
2 changed files with 11 additions and 26 deletions

View File

@@ -93,7 +93,6 @@ export default function CalendarWidget() {
const [selected, setSelected] = useState(null); // date object
const [errors, setErrors] = useState([]);
const [debug, setDebug] = useState([]);
// Load all feeds
const loadFeeds = async (feedList) => {
@@ -102,33 +101,23 @@ export default function CalendarWidget() {
setErrors([]);
const all = [];
const errs = [];
const dbg = [];
dbg.push(`Feeds: ${feedList.length}`);
for (const f of feedList) {
try {
dbg.push(`Lade: ${f.name} (${f.url.slice(0,50)}…)`);
const res = await fetch(`/api/calendar/fetch?url=${encodeURIComponent(f.url)}`, {
headers: { Authorization: `Bearer ${localStorage.getItem('sk_token')}` }
});
dbg.push(`HTTP: ${res.status}`);
if (res.ok) {
const text = await res.text();
dbg.push(`Bytes: ${text.length}, VCALENDAR: ${text.includes('BEGIN:VCALENDAR')}, VEVENTs: ${(text.match(/BEGIN:VEVENT/g)||[]).length}`);
dbg.push(`Inhalt (erste 200 Zeichen): ${text.slice(0,200).replace(/\n/g,' ')}`);
const evs = parseIcal(text).map(e => ({ ...e, color: f.color, feedName: f.name }));
dbg.push(`Geparst: ${evs.length} Termine`);
if (evs.length > 0) dbg.push(`Erstes: ${evs[0].summary} @ ${evs[0].dtstart}`);
all.push(...evs);
} else {
const d = await res.json().catch(()=>({error:'Unbekannter Fehler'}));
errs.push(`${f.name}: ${d.error}`);
dbg.push(`Fehler: ${d.error}`);
}
} catch(e) { errs.push(`${f.name}: ${e.message}`); dbg.push(`Exception: ${e.message}`); }
} catch(e) { errs.push(`${f.name}: ${e.message}`); }
}
setEvents(all);
setErrors(errs);
setDebug(dbg);
setLoading(false);
};
@@ -270,16 +259,7 @@ export default function CalendarWidget() {
</div>
)}
{/* Debug Panel */}
{debug.length > 0 && (
<div style={{ marginTop:10, background:'rgba(0,0,0,0.4)', borderRadius:8,
padding:'8px 10px', border:'1px solid rgba(255,255,255,0.08)' }}>
<div style={{ color:'rgba(255,255,255,0.3)', fontFamily:'monospace', fontSize:9, marginBottom:4 }}>DEBUG</div>
{debug.map((d,i) => (
<div key={i} style={{ color:'rgba(255,255,255,0.55)', fontFamily:'monospace', fontSize:10, lineHeight:1.6 }}>{d}</div>
))}
</div>
)}
</div>
)}
</div>