Changeset 746d98a in Klonkt for src/routes/account.js
- Timestamp:
- 09/30/2026 09:08:48 AM (2 hours ago)
- Branches:
- main
- Parents:
- 31680c3
- File:
-
- 1 edited
-
src/routes/account.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/account.js
r31680c3 r746d98a 14 14 15 15 import express from 'express'; 16 import { listPlatforms, buildProfileLinks, parseProfileLinks } from '../services/PlatformIcons.js'; 16 17 import path from 'path'; 17 18 import fs from 'fs'; … … 69 70 pageTitle: 'Account', 70 71 bodyClass: 'on-special', 72 // De profiellinks staan sinds 30-9 hier, bij je profiel, en niet meer op de 73 // Appearance-pagina (Robins verzoek). 74 pageJs: 'profile-links', 75 platforms: listPlatforms(), 76 profileLinks: editableSite ? parseProfileLinks(editableSite.profile_links) : [], 71 77 account, 72 78 hasPassword, … … 106 112 function ownedSite(user) { 107 113 if (!user) return null; 108 let site = db.prepare('SELECT id, title, tagline, slug, owner_id, profile_photo FROM sites WHERE owner_id = ? ORDER BY created_at LIMIT 1').get(user.id); 114 // profile_links hoort erbij sinds de links hier staan (30-9). Zonder die kolom 115 // toonde de pagina nul links, en wiste opslaan ze dus. 116 let site = db.prepare('SELECT id, title, tagline, slug, owner_id, profile_photo, profile_links FROM sites WHERE owner_id = ? ORDER BY created_at LIMIT 1').get(user.id); 109 117 if (!site && user.role === 'god') { 110 118 site = getPrimarySite(); // primary/main site as fallback … … 128 136 }); 129 137 138 // ==================== PROFIELLINKS ==================== 139 // Sinds 30-9 hier en niet meer op Appearance: ze horen bij je profiel, naast je 140 // naam, bio en foto. Dezelfde rechten als de site-naam hierboven: de eigenaar 141 // van de site, of god. 142 router.post('/links', requireAuth, (req, res) => { 143 const site = ownedSite(req.session.user); 144 if (!site) return res.redirect('/account?error=' + encodeURIComponent('Geen site om te bewerken.')); 145 if (site.owner_id !== req.session.user.id && req.session.user.role !== 'god') { 146 return res.redirect('/account?error=' + encodeURIComponent('Geen rechten om deze site te bewerken.')); 147 } 148 db.prepare('UPDATE sites SET profile_links = ?, updated_at = CURRENT_TIMESTAMP WHERE id = ?') 149 .run(buildProfileLinks(req.body), site.id); 150 res.redirect('/account?success=' + encodeURIComponent('Links bijgewerkt') + '#links'); 151 }); 152 130 153 // ==================== UPDATE BIO ==================== 131 154 const RESERVED_USERNAMES = new Set(['admin', 'account', 'auth', 'login', 'register', 'logout', 'user', 'users', 'api', 'fediverse', 'posts', 'media', 'audio', 'assets', 'cirkel', 'authorize_interaction']);
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)