diff --git a/admin.html b/admin.html
index 6c02dd1..08f62a3 100644
--- a/admin.html
+++ b/admin.html
@@ -608,27 +608,40 @@ async function uploadMembersAdmin() {
if (!token) { alert('Bitte zuerst Admin-Token in den Einstellungen speichern.'); return; }
const statusEl = document.getElementById('members-status');
statusEl.textContent = 'Lädt hoch…'; statusEl.style.color = 'var(--muted)';
- const state = loadState();
- const extras = loadExtras();
- const members = state.members.map(m => {
- const ex = extras[extrasKey(m.name)] || {};
- const entry = { id:m.id, name:m.name, company:m.company, specialty:m.specialty, photoUrl:m.photoUrl||'', profileUrl:m.profileUrl||'' };
- if (ex.photoB64 || ex.offlinePhotoB64) entry.photoData = ex.photoB64 || ex.offlinePhotoB64;
- return entry;
- });
- const data = { lastUpdated: new Date().toISOString().slice(0,10), members };
- const content = btoa(unescape(encodeURIComponent(JSON.stringify(data, null, 2))));
- const path = `chapters/${activeChapter.code}/members.json`;
try {
+ const state = loadState();
+ const extras = loadExtras();
+ const members = state.members.map(m => {
+ const ex = extras[extrasKey(m.name)] || {};
+ const entry = { id:m.id, name:m.name, company:m.company, specialty:m.specialty, photoUrl:m.photoUrl||'', profileUrl:m.profileUrl||'' };
+ if (ex.photoB64 || ex.offlinePhotoB64) entry.photoData = ex.photoB64 || ex.offlinePhotoB64;
+ return entry;
+ });
+ const data = { lastUpdated: new Date().toISOString().slice(0,10), members };
+ const content = btoa(unescape(encodeURIComponent(JSON.stringify(data, null, 2))));
+ const path = `chapters/${activeChapter.code}/members.json`;
+ const url = giteaAuthUrl(path, token);
+ console.log('[Upload] URL:', url);
+ statusEl.textContent = 'Prüfe SHA…';
let sha = null;
- const shaRes = await fetch(giteaAuthUrl(path, token));
+ const shaRes = await fetch(url);
+ console.log('[Upload] SHA-Status:', shaRes.status);
if (shaRes.ok) sha = (await shaRes.json()).sha;
const body = { message:`Mitglieder aktualisiert ${new Date().toLocaleDateString('de')}`, content };
if (sha) body.sha = sha;
- const res = await fetch(giteaAuthUrl(path, token), { method:sha?'PUT':'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify(body) });
+ statusEl.textContent = sha ? 'Aktualisiere…' : 'Erstelle…';
+ const res = await fetch(url, { method:sha?'PUT':'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify(body) });
+ console.log('[Upload] Upload-Status:', res.status);
if (res.ok) { statusEl.textContent = `✓ ${members.length} Mitglieder hochgeladen`; statusEl.style.color = 'var(--success)'; }
- else { statusEl.textContent = 'Fehler beim Upload.'; statusEl.style.color = '#dc2626'; }
- } catch(e) { statusEl.textContent = 'Verbindungsfehler.'; statusEl.style.color = '#dc2626'; }
+ else {
+ const errText = await res.text();
+ console.error('[Upload] Fehler:', errText);
+ statusEl.textContent = `Fehler ${res.status}: ${errText.slice(0,80)}`; statusEl.style.color = '#dc2626';
+ }
+ } catch(e) {
+ console.error('[Upload] Exception:', e);
+ statusEl.textContent = `Fehler: ${e.message}`; statusEl.style.color = '#dc2626';
+ }
}
// ============================================================