Changeset d7e72b8 in Klonkt for src/routes
- Timestamp:
- 08/09/2026 07:47:48 AM (4 weeks ago)
- Branches:
- main
- Children:
- b406d25
- Parents:
- c832064
- Location:
- src/routes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/routes/posts.js
rc832064 rd7e72b8 6 6 import ejs from 'ejs'; 7 7 import db from '../config/database.js'; 8 import { POST_TYPES, KEUZE_TYPES } from '../config/post-types.js'; 8 9 import { requireAuth, requireSiteManager, isViewer } from '../middleware/auth.js'; 9 10 import { renderPage } from '../middleware/render.js'; … … 265 266 }, 266 267 isNew: true, 268 keuzeTypes: KEUZE_TYPES, 267 269 pageTitle: 'New post', 268 270 bodyClass: 'on-special', … … 359 361 finalSlug = uniqueSlug(site.id, finalSlug); 360 362 361 const validTypes = new Set(['post', 'foto', 'video', 'audio']); 362 const finalType = validTypes.has(type) ? type : 'post'; 363 const finalType = POST_TYPES.has(type) ? type : 'post'; 363 364 const pollJson = parsePollForm(req.body); // AS2 Question definition, or null 364 365 const postId = uuid(); … … 454 455 post, 455 456 isNew: false, 457 keuzeTypes: KEUZE_TYPES, 456 458 pollLocked, 457 459 fediOpenAudio: postAudioFediOpen(site.id, post.content), … … 486 488 const newSlug = req.body.slug; 487 489 const action = req.body.action || 'save'; 488 const validTypes = new Set(['post', 'foto', 'video', 'audio']); 489 const finalType = validTypes.has(type) ? type : (post.type || 'post'); 490 const finalType = POST_TYPES.has(type) ? type : (post.type || 'post'); 490 491 491 492 // A poll that has already received votes is frozen (you can still edit the surrounding -
src/routes/types.js
rc832064 rd7e72b8 8 8 import express from 'express'; 9 9 import db from '../config/database.js'; 10 import { POST_TYPES } from '../config/post-types.js'; 10 11 import { renderPage } from '../middleware/render.js'; 11 12 12 13 const router = express.Router(); 13 const VALID_TYPES = new Set(['post', 'foto', 'video', 'audio']); 14 // Een lijst, drie gebruikers: zie config/post-types.js. 15 const VALID_TYPES = POST_TYPES; 14 16 15 17 router.get('/:type', (req, res) => {
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)