OverviewFilesCommitsIssuesDocsReleasesPeers

wirecore commits / 5c4d0d3

Fix API endpoints for ANProto system
Fixed /api/profile and timeline endpoints to support both ANProto and legacy identity systems: 1. /api/profile GET - Check anprotoKeypair first, fallback to identity 2. getTimelineMessages() - Use correct public key for own posts This fixes "Cannot read properties of null" errors when identity is null (ANProto-only system). Testing: - ✅ Web interface loads without API errors - ✅ Profile endpoint returns ANProto public key (base64) - ✅ Timeline shows own posts with correct public key Released: version 4090 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5c4d0d3bc7766e54670d2c32586d4dc5bbc9e6b2
by plankatron <fleeky@gmail.com> · 2026-01-21T17:52:22.000Z

Changed files (1) +10 -2

pear-app/index.js +10 -2
……@@ -1006,9 +1006,13 @@ async function handleAPI(req, res, url) {
10061006 const profileNode = await metaBee.get('profile')
10071007 const profile = (profileNode && profileNode.value) || {}
10081008
1009 const pubkey = anprotoKeypair
1010 ? b4a.toString(anprotoKeypair.publicKey, 'base64')
1011 : b4a.toString(identity.identityPublicKey, 'hex')
1012
10091013 res.writeHead(200, { 'Content-Type': 'application/json' })
10101014 res.end(JSON.stringify({
1011 pubkey: b4a.toString(identity.identityPublicKey, 'hex'),
1015 pubkey,
10121016 username: profile.username || null
10131017 }))
10141018 } else if (req.method === 'POST') {
……@@ -1287,10 +1291,14 @@ async function getTimelineMessages(limit) {
12871291 // Use username from post if available, otherwise "You"
12881292 const displayName = entry.username || 'You'
12891293
1294 const ownPublicKey = anprotoKeypair
1295 ? b4a.toString(anprotoKeypair.publicKey, 'base64')
1296 : b4a.toString(identity.identityPublicKey, 'hex')
1297
12901298 messages.push({
12911299 ...entry,
12921300 author: displayName,
1293 publicKey: b4a.toString(identity.identityPublicKey, 'hex'),
1301 publicKey: ownPublicKey,
12941302 isOwn: true
12951303 })
12961304 } catch (err) {