fedbox 0.0.8 → 0.0.9
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/README.md +109 -27
- package/lib/profile-server.js +18 -7
- package/lib/server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,44 +26,118 @@ That's it. You're on the Fediverse.
|
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
# Setup
|
|
29
|
-
fedbox init
|
|
30
|
-
fedbox start
|
|
31
|
-
fedbox
|
|
29
|
+
fedbox init # Set up your identity
|
|
30
|
+
fedbox start # Start full ActivityPub server
|
|
31
|
+
fedbox profile [port] # Start profile-only server (for editing)
|
|
32
|
+
fedbox status # Show your profile info
|
|
32
33
|
|
|
33
34
|
# Social
|
|
34
|
-
fedbox post "text"
|
|
35
|
+
fedbox post "text" # Post a message to followers
|
|
35
36
|
fedbox follow @user@domain # Follow someone
|
|
36
|
-
fedbox timeline
|
|
37
|
+
fedbox timeline # View posts from people you follow
|
|
37
38
|
fedbox reply <url> "text" # Reply to a post
|
|
38
|
-
fedbox posts
|
|
39
|
+
fedbox posts # View your own posts
|
|
39
40
|
|
|
40
|
-
#
|
|
41
|
-
fedbox
|
|
41
|
+
# Maintenance
|
|
42
|
+
fedbox clean # Remove database
|
|
43
|
+
fedbox clean --all # Remove database and config
|
|
44
|
+
fedbox help # Show all commands
|
|
42
45
|
```
|
|
43
46
|
|
|
47
|
+
## Profile Editing (Web UI)
|
|
48
|
+
|
|
49
|
+
Visit your profile page and click **Edit** to change:
|
|
50
|
+
- Display name
|
|
51
|
+
- Bio
|
|
52
|
+
- Avatar (upload image)
|
|
53
|
+
- Nostr pubkey (64-char hex)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
fedbox profile
|
|
57
|
+
# Visit http://localhost:3000/
|
|
58
|
+
# Click "Edit" to modify your profile
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Nostr Identity
|
|
62
|
+
|
|
63
|
+
Link your Nostr identity by adding your pubkey (64-char hex):
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"nostrPubkey": "124c0fa99407182ece5a24fad9b7f6674902fc422843d3128d38a0afbee0fdd2"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Your actor will include:
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"alsoKnownAs": ["did:nostr:124c0fa99407182ece5a24fad9b7f6674902fc422843d3128d38a0afbee0fdd2"]
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This follows the [did:nostr spec](https://nostrcg.github.io/did-nostr/).
|
|
79
|
+
|
|
80
|
+
## Solid-Compatible URIs
|
|
81
|
+
|
|
82
|
+
Fedbox uses Solid-style WebID URIs:
|
|
83
|
+
|
|
84
|
+
- `/alice` — Profile document (HTML + JSON-LD)
|
|
85
|
+
- `/alice#me` — WebID (the Person/Actor)
|
|
86
|
+
|
|
87
|
+
This makes profiles compatible with both ActivityPub and Solid ecosystems.
|
|
88
|
+
|
|
89
|
+
## Separated Architecture
|
|
90
|
+
|
|
91
|
+
Fedbox supports separating **identity** (profile) from **federation** (AP server):
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Profile Server (static host) AP Server (fedbox)
|
|
95
|
+
─────────────────────────── ─────────────────
|
|
96
|
+
https://me.example.com https://fedbox.example.com
|
|
97
|
+
/alice /alice/inbox
|
|
98
|
+
/alice#me ──points to──► /alice/outbox
|
|
99
|
+
/alice/followers
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Profile-only config** (`fedbox.json`):
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"username": "alice",
|
|
106
|
+
"displayName": "Alice",
|
|
107
|
+
"summary": "My bio",
|
|
108
|
+
"apServer": "https://fedbox.example.com",
|
|
109
|
+
"nostrPubkey": "124c0fa9..."
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The profile can be hosted anywhere (GitHub Pages, S3, any static server). The AP server handles federation.
|
|
114
|
+
|
|
44
115
|
## Federation (so Mastodon can find you)
|
|
45
116
|
|
|
46
|
-
To federate with the wider Fediverse, you need a public HTTPS URL
|
|
117
|
+
To federate with the wider Fediverse, you need a public HTTPS URL:
|
|
47
118
|
|
|
48
119
|
```bash
|
|
49
120
|
# In another terminal
|
|
50
121
|
ngrok http 3000
|
|
51
122
|
```
|
|
52
123
|
|
|
53
|
-
Copy your ngrok URL
|
|
124
|
+
Copy your ngrok URL and add it to `fedbox.json`:
|
|
54
125
|
|
|
55
126
|
```json
|
|
56
127
|
{
|
|
57
|
-
"domain": "abc123.ngrok.io"
|
|
58
|
-
...
|
|
128
|
+
"domain": "abc123.ngrok.io"
|
|
59
129
|
}
|
|
60
130
|
```
|
|
61
131
|
|
|
62
|
-
Restart your server
|
|
132
|
+
Restart your server. Search for `@yourname@abc123.ngrok.io` on Mastodon.
|
|
63
133
|
|
|
64
134
|
## What You Get
|
|
65
135
|
|
|
66
136
|
- **Your own identity** — `@you@yourdomain.com`
|
|
137
|
+
- **Web UI editing** — Edit profile in browser
|
|
138
|
+
- **Nostr identity** — Link via `did:nostr`
|
|
139
|
+
- **Solid-compatible** — WebID at `/username#me`
|
|
140
|
+
- **Separated architecture** — Profile and AP server can be separate
|
|
67
141
|
- **Post from CLI** — `fedbox post "Hello world"`
|
|
68
142
|
- **Follow anyone** — `fedbox follow @user@mastodon.social`
|
|
69
143
|
- **View timeline** — `fedbox timeline`
|
|
@@ -72,19 +146,6 @@ Restart your server, and you're federated! Search for `@yourname@abc123.ngrok.io
|
|
|
72
146
|
- **HTTP Signature verification** — Secure federation
|
|
73
147
|
- **Rate limiting** — Protection against abuse
|
|
74
148
|
- **Persistent storage** — SQLite database
|
|
75
|
-
- **Beautiful profile page** — Dark theme, shows your posts
|
|
76
|
-
|
|
77
|
-
## How It Works
|
|
78
|
-
|
|
79
|
-
Fedbox uses [microfed](https://github.com/micro-fed/microfed.org) for ActivityPub primitives:
|
|
80
|
-
|
|
81
|
-
- **Profile** — Your actor/identity
|
|
82
|
-
- **Inbox** — Receive follows, likes, boosts, posts
|
|
83
|
-
- **Outbox** — Your posts
|
|
84
|
-
- **WebFinger** — So others can find you
|
|
85
|
-
- **HTTP Signatures** — Secure signed requests
|
|
86
|
-
|
|
87
|
-
Data is stored in SQLite (`data/fedbox.db`).
|
|
88
149
|
|
|
89
150
|
## Configuration
|
|
90
151
|
|
|
@@ -97,12 +158,33 @@ After `fedbox init`, you'll have a `fedbox.json`:
|
|
|
97
158
|
"summary": "Hello, Fediverse!",
|
|
98
159
|
"port": 3000,
|
|
99
160
|
"domain": null,
|
|
161
|
+
"apServer": null,
|
|
162
|
+
"nostrPubkey": null,
|
|
163
|
+
"avatar": null,
|
|
100
164
|
"publicKey": "...",
|
|
101
165
|
"privateKey": "..."
|
|
102
166
|
}
|
|
103
167
|
```
|
|
104
168
|
|
|
105
|
-
|
|
169
|
+
| Field | Description |
|
|
170
|
+
|-------|-------------|
|
|
171
|
+
| `domain` | Your public domain (for federation) |
|
|
172
|
+
| `apServer` | External AP server URL (for separated mode) |
|
|
173
|
+
| `nostrPubkey` | 64-char hex Nostr pubkey |
|
|
174
|
+
| `avatar` | Avatar filename in `public/` |
|
|
175
|
+
|
|
176
|
+
## How It Works
|
|
177
|
+
|
|
178
|
+
Fedbox uses [microfed](https://github.com/micro-fed/microfed.org) for ActivityPub primitives:
|
|
179
|
+
|
|
180
|
+
- **Profile** — Your actor/identity with JSON-LD
|
|
181
|
+
- **Inbox** — Receive follows, likes, boosts, posts
|
|
182
|
+
- **Outbox** — Your posts
|
|
183
|
+
- **WebFinger** — So others can find you
|
|
184
|
+
- **HTTP Signatures** — Secure signed requests
|
|
185
|
+
- **Nodeinfo** — Server discovery
|
|
186
|
+
|
|
187
|
+
Data is stored in SQLite (`data/fedbox.db`).
|
|
106
188
|
|
|
107
189
|
## Requirements
|
|
108
190
|
|
package/lib/profile-server.js
CHANGED
|
@@ -38,6 +38,13 @@ function buildActor(baseUrl) {
|
|
|
38
38
|
const profileUrl = `${baseUrl}/${config.username}`
|
|
39
39
|
const actorId = `${profileUrl}#me`
|
|
40
40
|
|
|
41
|
+
// If apServer is configured, point inbox/outbox there
|
|
42
|
+
// Otherwise, use local URLs (for standalone mode)
|
|
43
|
+
const apBase = config.apServer || baseUrl
|
|
44
|
+
const apProfileUrl = config.apServer
|
|
45
|
+
? `${config.apServer}/${config.username}`
|
|
46
|
+
: profileUrl
|
|
47
|
+
|
|
41
48
|
const actor = {
|
|
42
49
|
'@context': [
|
|
43
50
|
'https://www.w3.org/ns/activitystreams',
|
|
@@ -49,20 +56,24 @@ function buildActor(baseUrl) {
|
|
|
49
56
|
preferredUsername: config.username,
|
|
50
57
|
name: config.displayName,
|
|
51
58
|
summary: config.summary ? `<p>${config.summary}</p>` : '',
|
|
52
|
-
inbox: `${
|
|
53
|
-
outbox: `${
|
|
54
|
-
followers: `${
|
|
55
|
-
following: `${
|
|
59
|
+
inbox: `${apProfileUrl}/inbox`,
|
|
60
|
+
outbox: `${apProfileUrl}/outbox`,
|
|
61
|
+
followers: `${apProfileUrl}/followers`,
|
|
62
|
+
following: `${apProfileUrl}/following`,
|
|
56
63
|
endpoints: {
|
|
57
|
-
sharedInbox: `${
|
|
64
|
+
sharedInbox: `${apBase}/inbox`
|
|
58
65
|
},
|
|
59
|
-
publicKey
|
|
66
|
+
// publicKey lives on the profile (identity), not AP server
|
|
67
|
+
publicKey: config.publicKey ? {
|
|
60
68
|
id: `${profileUrl}#main-key`,
|
|
61
69
|
owner: actorId,
|
|
62
70
|
publicKeyPem: config.publicKey
|
|
63
|
-
}
|
|
71
|
+
} : undefined
|
|
64
72
|
}
|
|
65
73
|
|
|
74
|
+
// Remove publicKey if not set (profile-only mode)
|
|
75
|
+
if (!actor.publicKey) delete actor.publicKey
|
|
76
|
+
|
|
66
77
|
if (config.avatar) {
|
|
67
78
|
actor.icon = {
|
|
68
79
|
type: 'Image',
|
package/lib/server.js
CHANGED