Changes for page Linkding + SingleFile Archief
Last modified by XWikiGuest on 2026/03/11 21:04
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -78,6 +78,7 @@ 78 78 </style> 79 79 80 80 <div id="ldsf-wrapper"> 81 + <button id="ldsf-test-btn" style="background:#df691a;color:#fff;padding:8px 16px;border:none;border-radius:4px;cursor:pointer;margin-bottom:10px;">TEST KLIK</button> 81 81 <div id="ldsf-status">Laden...</div> 82 82 <div id="ldsf-bookmarks"></div> 83 83 <div id="ldsf-viewer-container"> ... ... @@ -128,8 +128,13 @@ 128 128 129 129 function ldsfLoadBookmarks() { 130 130 var apiUrl = LDSF_LINKDING_URL + '?limit=' + LDSF_COUNT + '&q=%23' + encodeURIComponent(LDSF_TAG); 132 + console.log('Fetching bookmarks:', apiUrl); 131 131 fetch(apiUrl, { headers: { 'Authorization': 'Token ' + LDSF_TOKEN } }) 132 - .then(function(r) { return r.json(); }) 134 + .then(function(r) { 135 + console.log('Linkding response status:', r.status, r.headers.get('content-type')); 136 + if (!r.ok) return r.text().then(function(t) { throw new Error('HTTP ' + r.status + ': ' + t.substring(0, 200)); }); 137 + return r.json(); 138 + }) 133 133 .then(function(data) { 134 134 var total = data.count || 0; 135 135 var archiveCount = 0; ... ... @@ -169,14 +169,20 @@ 169 169 .catch(function(err) { document.getElementById('ldsf-status').textContent = 'Fout: ' + err.message; }); 170 170 } 171 171 178 +// Debug test button 179 +document.getElementById('ldsf-test-btn').addEventListener('click', function() { 180 + alert('archiveMap: ' + JSON.stringify(ldsf_archiveMap) + '\nurlToFile: ' + JSON.stringify(ldsf_urlToFile)); 181 +}); 182 + 172 172 // Load index then bookmarks 173 173 fetch(LDSF_WEBDAV + 'index.json', { headers: { 'Authorization': LDSF_AUTH } }) 174 174 .then(function(r) { return r.ok ? r.json() : {}; }) 175 175 .then(function(idx) { 187 + console.log('SingleFile index loaded:', idx); 176 176 Object.keys(idx).forEach(function(f) { ldsf_urlToFile[idx[f]] = f; }); 177 177 ldsfLoadBookmarks(); 178 178 }) 179 -.catch(function() { ldsfLoadBookmarks(); }); 191 +.catch(function(err) { console.log('SingleFile index FAILED:', err); ldsfLoadBookmarks(); }); 180 180 </script> 181 181 {{/html}} 182 182