debug(library): ajouter console.log pour tracer init + loadTab + flatItems
Ajoute des logs dans init(), loadTab() et _recomputeFlatItems() pour identifier pourquoi flatItems reste vide malgré le chargement API. CSP: ajout fonts.googleapis.com/gstatic.com pour débloquer Google Fonts.
This commit is contained in:
@@ -65,9 +65,9 @@ class ContentSecurityPolicyMiddleware(BaseHTTPMiddleware):
|
|||||||
CSP_VALUE = (
|
CSP_VALUE = (
|
||||||
"default-src 'self'; "
|
"default-src 'self'; "
|
||||||
"script-src 'self' 'unsafe-inline' 'unsafe-eval'; "
|
"script-src 'self' 'unsafe-inline' 'unsafe-eval'; "
|
||||||
"style-src 'self' 'unsafe-inline'; "
|
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; "
|
||||||
"img-src 'self' data: blob: https:; "
|
"img-src 'self' data: blob: https:; "
|
||||||
"font-src 'self' data:; "
|
"font-src 'self' data: https://fonts.gstatic.com; "
|
||||||
"connect-src 'self' https: wss:; "
|
"connect-src 'self' https: wss:; "
|
||||||
"media-src 'self' blob:; "
|
"media-src 'self' blob:; "
|
||||||
"frame-src 'self'; "
|
"frame-src 'self'; "
|
||||||
|
|||||||
@@ -420,18 +420,21 @@ function libraryPage() {
|
|||||||
|
|
||||||
// ── Init ──
|
// ── Init ──
|
||||||
init() {
|
init() {
|
||||||
|
console.log('[Library] init start');
|
||||||
var wsEl = document.getElementById('lib-workspace-id');
|
var wsEl = document.getElementById('lib-workspace-id');
|
||||||
this.workspaceId = parseInt(wsEl ? wsEl.textContent : '0') || 0;
|
this.workspaceId = parseInt(wsEl ? wsEl.textContent : '0') || 0;
|
||||||
var giteaEl = document.getElementById('lib-gitea-active');
|
var giteaEl = document.getElementById('lib-gitea-active');
|
||||||
this.isGiteaActive = (giteaEl ? giteaEl.textContent : '0') === '1';
|
this.isGiteaActive = (giteaEl ? giteaEl.textContent : '0') === '1';
|
||||||
this.giteaOwner = (document.getElementById('lib-gitea-owner') || {}).textContent || '';
|
this.giteaOwner = (document.getElementById('lib-gitea-owner') || {}).textContent || '';
|
||||||
this.giteaRepo = (document.getElementById('lib-gitea-repo') || {}).textContent || '';
|
this.giteaRepo = (document.getElementById('lib-gitea-repo') || {}).textContent || '';
|
||||||
|
console.log('[Library] workspaceId=' + this.workspaceId + ' isGitea=' + this.isGiteaActive);
|
||||||
var params = new URLSearchParams(window.location.search);
|
var params = new URLSearchParams(window.location.search);
|
||||||
var t = params.get('tab');
|
var t = params.get('tab');
|
||||||
if (t && ['recents','favorites','shared','published','private','workspace','repository'].indexOf(t) !== -1) {
|
if (t && ['recents','favorites','shared','published','private','workspace','repository'].indexOf(t) !== -1) {
|
||||||
this.tab = t;
|
this.tab = t;
|
||||||
}
|
}
|
||||||
this._recomputeEmpty();
|
this._recomputeEmpty();
|
||||||
|
console.log('[Library] loading tab: ' + this.tab);
|
||||||
this.loadTab();
|
this.loadTab();
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -461,6 +464,7 @@ function libraryPage() {
|
|||||||
// ── Load ──
|
// ── Load ──
|
||||||
async loadTab() {
|
async loadTab() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
console.log('[Library] loadTab: ' + this.tab + ' workspaceId=' + this.workspaceId);
|
||||||
try {
|
try {
|
||||||
var url = '/api/library/' + this.tab;
|
var url = '/api/library/' + this.tab;
|
||||||
var sep = '?';
|
var sep = '?';
|
||||||
@@ -471,13 +475,16 @@ function libraryPage() {
|
|||||||
url += sep + 'gitea_owner=' + encodeURIComponent(this.giteaOwner) + '&gitea_repo=' + encodeURIComponent(this.giteaRepo);
|
url += sep + 'gitea_owner=' + encodeURIComponent(this.giteaOwner) + '&gitea_repo=' + encodeURIComponent(this.giteaRepo);
|
||||||
sep = '&';
|
sep = '&';
|
||||||
}
|
}
|
||||||
|
console.log('[Library] fetching: ' + url);
|
||||||
var r = await fetch(url);
|
var r = await fetch(url);
|
||||||
var d = await r.json();
|
var d = await r.json();
|
||||||
this.items = d.items || [];
|
this.items = d.items || [];
|
||||||
|
console.log('[Library] loaded ' + this.items.length + ' items');
|
||||||
this._markTree(this.items, 0);
|
this._markTree(this.items, 0);
|
||||||
this._recomputeFlatItems();
|
this._recomputeFlatItems();
|
||||||
|
console.log('[Library] flatItems after recompute: ' + this.flatItems.length);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('Library load:', e);
|
console.error('[Library] load error:', e);
|
||||||
this.items = [];
|
this.items = [];
|
||||||
}
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user