fedbox 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/profile-server.js +19 -0
- package/lib/server.js +23 -1
- package/package.json +1 -1
package/lib/profile-server.js
CHANGED
|
@@ -72,6 +72,15 @@ function buildActor(baseUrl) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// Add alsoKnownAs for identity linking (Nostr, etc.)
|
|
76
|
+
const alsoKnownAs = []
|
|
77
|
+
if (config.nostrPubkey) {
|
|
78
|
+
alsoKnownAs.push(`did:nostr:${config.nostrPubkey}`)
|
|
79
|
+
}
|
|
80
|
+
if (alsoKnownAs.length > 0) {
|
|
81
|
+
actor.alsoKnownAs = alsoKnownAs
|
|
82
|
+
}
|
|
83
|
+
|
|
75
84
|
return actor
|
|
76
85
|
}
|
|
77
86
|
|
|
@@ -224,6 +233,11 @@ ${JSON.stringify(actor, null, 2)}
|
|
|
224
233
|
<textarea class="edit-textarea" id="edit-summary" placeholder="Write a short bio...">${config.summary || ''}</textarea>
|
|
225
234
|
</div>
|
|
226
235
|
|
|
236
|
+
${config.nostrPubkey ? `<p class="view-mode" style="margin-bottom:1rem"><a href="nostr:${config.nostrPubkey}" style="color:#667eea;font-size:0.85rem">did:nostr:${config.nostrPubkey.slice(0,8)}...</a></p>` : ''}
|
|
237
|
+
<div class="edit-mode" style="margin-bottom:1rem">
|
|
238
|
+
<input type="text" class="edit-input" id="edit-nostr" value="${config.nostrPubkey || ''}" placeholder="Nostr pubkey (64-char hex)" style="font-size:0.85rem;max-width:400px">
|
|
239
|
+
</div>
|
|
240
|
+
|
|
227
241
|
<div class="edit-actions">
|
|
228
242
|
<button class="save-btn" onclick="saveProfile()">Save</button>
|
|
229
243
|
<button class="cancel-btn" onclick="toggleEdit()">Cancel</button>
|
|
@@ -253,6 +267,7 @@ ${JSON.stringify(actor, null, 2)}
|
|
|
253
267
|
const formData = new FormData();
|
|
254
268
|
formData.append('displayName', document.getElementById('edit-name').value);
|
|
255
269
|
formData.append('summary', document.getElementById('edit-summary').value);
|
|
270
|
+
formData.append('nostrPubkey', document.getElementById('edit-nostr').value);
|
|
256
271
|
if (avatarFile) formData.append('avatar', avatarFile);
|
|
257
272
|
try {
|
|
258
273
|
const res = await fetch('/edit', { method: 'POST', body: formData });
|
|
@@ -330,6 +345,10 @@ async function handleEdit(req, res) {
|
|
|
330
345
|
config.summary = parts.summary
|
|
331
346
|
updated = true
|
|
332
347
|
}
|
|
348
|
+
if (parts.nostrPubkey !== undefined) {
|
|
349
|
+
config.nostrPubkey = parts.nostrPubkey || undefined
|
|
350
|
+
updated = true
|
|
351
|
+
}
|
|
333
352
|
if (parts.avatar && parts.avatar.data && parts.avatar.data.length > 0) {
|
|
334
353
|
if (!existsSync('public')) mkdirSync('public', { recursive: true })
|
|
335
354
|
const ext = parts.avatar.contentType?.includes('png') ? 'png' :
|
package/lib/server.js
CHANGED
|
@@ -112,6 +112,16 @@ function buildActor() {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
// Add alsoKnownAs for identity linking (Nostr, etc.)
|
|
116
|
+
const alsoKnownAs = []
|
|
117
|
+
if (config.nostrPubkey) {
|
|
118
|
+
// Format as did:nostr per https://nostrcg.github.io/did-nostr/
|
|
119
|
+
alsoKnownAs.push(`did:nostr:${config.nostrPubkey}`)
|
|
120
|
+
}
|
|
121
|
+
if (alsoKnownAs.length > 0) {
|
|
122
|
+
actor.alsoKnownAs = alsoKnownAs
|
|
123
|
+
}
|
|
124
|
+
|
|
115
125
|
return actor
|
|
116
126
|
}
|
|
117
127
|
|
|
@@ -396,7 +406,7 @@ async function handleRequest(req, res) {
|
|
|
396
406
|
version: '2.1',
|
|
397
407
|
software: {
|
|
398
408
|
name: 'fedbox',
|
|
399
|
-
version: '0.0.
|
|
409
|
+
version: '0.0.8',
|
|
400
410
|
repository: 'https://github.com/micro-fed/fedbox'
|
|
401
411
|
},
|
|
402
412
|
protocols: ['activitypub'],
|
|
@@ -629,6 +639,12 @@ async function handleProfileEdit(req, res) {
|
|
|
629
639
|
updated = true
|
|
630
640
|
}
|
|
631
641
|
|
|
642
|
+
// Update nostr pubkey
|
|
643
|
+
if (parts.nostrPubkey !== undefined) {
|
|
644
|
+
config.nostrPubkey = parts.nostrPubkey || undefined
|
|
645
|
+
updated = true
|
|
646
|
+
}
|
|
647
|
+
|
|
632
648
|
// Handle avatar upload
|
|
633
649
|
if (parts.avatar && parts.avatar.data && parts.avatar.data.length > 0) {
|
|
634
650
|
// Ensure public directory exists
|
|
@@ -904,6 +920,11 @@ ${JSON.stringify(actor, null, 2)}
|
|
|
904
920
|
<textarea class="edit-textarea" id="edit-summary" placeholder="Write a short bio...">${config.summary || ''}</textarea>
|
|
905
921
|
</div>
|
|
906
922
|
|
|
923
|
+
${config.nostrPubkey ? `<p class="nostr-link view-mode" style="margin-bottom:1rem"><a href="nostr:${config.nostrPubkey}" style="color:#667eea;font-size:0.85rem">did:nostr:${config.nostrPubkey.slice(0,8)}...</a></p>` : ''}
|
|
924
|
+
<div class="edit-mode" style="margin-bottom:1rem">
|
|
925
|
+
<input type="text" class="edit-input" id="edit-nostr" value="${config.nostrPubkey || ''}" placeholder="Nostr pubkey (64-char hex)" style="font-size:0.85rem;max-width:400px">
|
|
926
|
+
</div>
|
|
927
|
+
|
|
907
928
|
<div class="stats">
|
|
908
929
|
<div class="stat">
|
|
909
930
|
<div class="stat-num">${followers}</div>
|
|
@@ -964,6 +985,7 @@ ${JSON.stringify(actor, null, 2)}
|
|
|
964
985
|
const formData = new FormData();
|
|
965
986
|
formData.append('displayName', document.getElementById('edit-name').value);
|
|
966
987
|
formData.append('summary', document.getElementById('edit-summary').value);
|
|
988
|
+
formData.append('nostrPubkey', document.getElementById('edit-nostr').value);
|
|
967
989
|
if (avatarFile) {
|
|
968
990
|
formData.append('avatar', avatarFile);
|
|
969
991
|
}
|