diff --git a/landing/js/landing.js b/landing/js/landing.js index 30a4fea..c6f1a23 100644 --- a/landing/js/landing.js +++ b/landing/js/landing.js @@ -128,13 +128,27 @@ var data = JSON.parse(body); if (!Array.isArray(data)) throw new Error('Expected a JSON array of projects, got ' + typeof data); - allProjects = data.map(function(p) { - return { - name: String(p.name || ''), - title: String(p.title || ''), - url: String(p.url || '') - }; - }).filter(function(p) { return p.name; }); + // The root JSON is now a generic listing.FileInfo[] (same + // shape every other directory returns). Filter to + // directories (projects are folders), strip the trailing + // "/" the server adds to dir names, and pick up `title` + // (the per-project .zddc title:, populated by the + // server-side listing pipeline). + allProjects = data + .filter(function (p) { return p && p.is_dir; }) + .map(function (p) { + var raw = String(p.name || '').replace(/\/$/, ''); + return { + name: raw, + title: String(p.title || ''), + url: String(p.url || '') + }; + }) + .filter(function (p) { + if (!p.name) return false; + var c = p.name.charAt(0); + return c !== '.' && c !== '_'; + }); return true; } catch (e) { loadError = e.message || String(e); diff --git a/zddc/cmd/zddc-server/main.go b/zddc/cmd/zddc-server/main.go index 6a42dd0..985c86b 100644 --- a/zddc/cmd/zddc-server/main.go +++ b/zddc/cmd/zddc-server/main.go @@ -754,25 +754,27 @@ func dispatch(cfg config.Config, idx *archive.Index, ring *handler.LogRing, apps return } - // Project list API: GET / with Accept: application/json - if urlPath == "/" { - accept := r.Header.Get("Accept") - if strings.Contains(accept, "application/json") { - handler.ServeProjectList(cfg, w, r) - return - } - } + // (Project list at GET / with Accept: application/json used to be + // served by a bespoke handler that returned a custom JSON shape. + // Removed in favour of routing /through the generic ServeDirectory: + // the directory listing now carries `title` per entry, so the + // landing page reads project names from the same shape every other + // listing has. Single canonical wire format > exception that + // reveals a special perspective.) // Split path into segments segments := strings.Split(strings.Trim(urlPath, "/"), "/") - // Per-directory .zddc editor:
' + path + '/.zddc';
if (p.title) html += ' — ' + escText(p.title);
html += '{{ if .IsRoot }}Editing the root /.zddc.{{ else }}Editing {{ .Path }}/.zddc.{{ end }} You are signed in as {{ .Email }}.