Changeset 72ec6a4 in Klonkt for src/routes/admin.js
- Timestamp:
- 07/31/2026 06:55:59 PM (6 weeks ago)
- Branches:
- main
- Children:
- 17546af
- Parents:
- bfa6fa1
- File:
-
- 1 edited
-
src/routes/admin.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin.js
rbfa6fa1 r72ec6a4 9 9 import { renderPage } from '../middleware/render.js'; 10 10 import { requireAuth } from '../middleware/auth.js'; 11 import { getTenancy,apEnabled } from '../services/SettingsService.js';11 import { apEnabled } from '../services/SettingsService.js'; 12 12 import { getPrimarySite } from '../middleware/site.js'; 13 13 … … 17 17 // Solves the problem that drafts (status != published) were not findable anywhere: 18 18 // the timeline shows only published posts. 19 function sitePosts(siteId, siteSlug, tenancy,limit = 60) {20 const base = tenancy === 'hub' ? `/user/${siteSlug}` :'';19 function sitePosts(siteId, siteSlug, limit = 60) { 20 const base = ''; 21 21 return db.prepare(` 22 22 SELECT slug, title, status, published_at, created_at, updated_at … … 53 53 mySite, 54 54 mine, 55 posts: sitePosts(mySite.id, mySite.slug , 'hub'), // my-site is hub-only55 posts: sitePosts(mySite.id, mySite.slug), 56 56 }); 57 57 } 58 58 59 const tenancy = getTenancy(); 60 61 // The primary/main site — in solo THE site, in hub the main site. Provides the 62 // "Appearance" tile with its edit link + the posts/drafts list. 59 // THE site: it provides the "Appearance" tile with its edit link and the 60 // posts/drafts list. 63 61 const primarySite = getPrimarySite(); 64 62 … … 72 70 }; 73 71 74 // Sites/users tables are only relevant in hub mode; in solo we skip the query. 75 const sites = tenancy === 'hub' ? db.prepare(` 76 SELECT s.slug, s.title, s.created_at, u.username AS owner_username 77 FROM sites s 78 LEFT JOIN users u ON u.id = s.owner_id 79 ORDER BY s.created_at DESC 80 LIMIT 50 81 `).all() : []; 82 83 const users = tenancy === 'hub' ? db.prepare(` 84 SELECT username, email, role, created_at 85 FROM users 86 ORDER BY created_at DESC 87 LIMIT 50 88 `).all() : []; 89 90 // Posts/drafts of the primary site (in solo = the site; in hub = the admin's 91 // main site). Drafts are listed first so they are easy to find. 92 const posts = primarySite ? sitePosts(primarySite.id, primarySite.slug, tenancy) : []; 72 // Posts/drafts of the site. Drafts are listed first so they are easy to find. 73 const posts = primarySite ? sitePosts(primarySite.id, primarySite.slug) : []; 93 74 94 75 renderPage(req, res, 'pages/admin', { 95 76 pageTitleKey: 'admin.t_admin', 96 77 bodyClass: 'on-admin', 97 tenancy, 98 circlesOn: apEnabled(), // solo vs cirkels tagline (federatie aan/uit) 78 circlesOn: apEnabled(), // federatie aan/uit in de tagline 99 79 primarySite, 100 80 stats, 101 sites,102 81 posts, 103 users,104 82 }); 105 83 }); … … 111 89 pageTitleKey: 'admin.t_manual', 112 90 bodyClass: 'on-admin', 113 tenancy: getTenancy(),114 91 }); 115 92 });
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)