Changeset 746d98a in Klonkt for src/services/PlatformIcons.js
- Timestamp:
- 09/30/2026 09:08:48 AM (2 hours ago)
- Branches:
- main
- Parents:
- 31680c3
- File:
-
- 1 edited
-
src/services/PlatformIcons.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/services/PlatformIcons.js
r31680c3 r746d98a 127 127 } 128 128 129 export default { PLATFORMS, PLATFORM_ORDER, listPlatforms, CONTACT_PLATFORMS, linkHref }; 129 /** 130 * De profiellinks uit een formulier (profile_link_platform[] + profile_link_url[]) 131 * als de JSON die in sites.profile_links staat, of null als er niets over is. 132 * 133 * Stond in routes/admin-sites.js, toen de links op de Appearance-pagina stonden. 134 * Sinds 30-9 bewerk je ze bij je profiel (/account), en een tweede kopie van 135 * deze keuring loopt gegarandeerd uit de pas -- dus hij staat hier. 136 */ 137 export function buildProfileLinks(body) { 138 const platforms = (body && body.profile_link_platform) || []; 139 const urls = (body && body.profile_link_url) || []; 140 const arr = []; 141 const platformsArr = Array.isArray(platforms) ? platforms : [platforms]; 142 const urlsArr = Array.isArray(urls) ? urls : [urls]; 143 for (let i = 0; i < platformsArr.length; i++) { 144 const p = (platformsArr[i] || '').toString().trim(); 145 const u = (urlsArr[i] || '').toString().trim(); 146 if (!p || !u) continue; 147 if (!PLATFORMS[p]) continue; 148 if (!/^https?:\/\//i.test(u) && p !== 'email') continue; 149 if (p === 'email' && !/^mailto:|^[^\s@]+@[^\s@]+$/i.test(u)) continue; 150 arr.push({ platform: p, url: u }); 151 } 152 return arr.length ? JSON.stringify(arr) : null; 153 } 154 155 /** sites.profile_links terug als lijst; een kapotte waarde is een lege lijst. */ 156 export function parseProfileLinks(json) { 157 if (!json) return []; 158 try { const a = JSON.parse(json); return Array.isArray(a) ? a : []; } catch { return []; } 159 } 160 161 export default { PLATFORMS, PLATFORM_ORDER, listPlatforms, CONTACT_PLATFORMS, linkHref, buildProfileLinks, parseProfileLinks };
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)