@evanp/activitypub-bot 0.43.2 → 0.44.2
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/CHANGELOG.md +27 -0
- package/lib/app.js +2 -0
- package/lib/digester.js +2 -1
- package/lib/keystorage.js +10 -0
- package/lib/routes/nodeinfo.js +61 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,33 @@ and this project adheres to
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.44.2] - 2026-04-23
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- cleanup server actor keys in tests
|
|
17
|
+
- looser count comparison for keystorage.count() test
|
|
18
|
+
|
|
19
|
+
## [0.44.1] - 2026-04-23
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Missing `nodeinfo` files
|
|
24
|
+
|
|
25
|
+
## [0.44.0] - 2026-04-22
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Add `nodeinfo` route with minimal required information
|
|
30
|
+
|
|
31
|
+
## [0.43.3] - 2026-04-22
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- `Digest:` header uses uppercase name for algorithm. It's supposed to be
|
|
36
|
+
case-insensitive per RFC 3230, but some software compares it case-sensitive
|
|
37
|
+
against uppercase.
|
|
38
|
+
|
|
12
39
|
## [0.43.2] - 2026-04-22
|
|
13
40
|
|
|
14
41
|
### Fixed
|
package/lib/app.js
CHANGED
|
@@ -32,6 +32,7 @@ import webfingerRouter from './routes/webfinger.js'
|
|
|
32
32
|
import sharedInboxRouter from './routes/sharedinbox.js'
|
|
33
33
|
import profileRouter from './routes/profile.js'
|
|
34
34
|
import proxyRouter from './routes/proxy.js'
|
|
35
|
+
import nodeinfoRouter from './routes/nodeinfo.js'
|
|
35
36
|
import { BotContext } from './botcontext.js'
|
|
36
37
|
import { Transformer } from './microsyntax.js'
|
|
37
38
|
import { HTTPSignatureAuthenticator } from './httpsignatureauthenticator.js'
|
|
@@ -301,6 +302,7 @@ export async function makeApp ({ databaseUrl, origin, bots, logLevel = 'silent',
|
|
|
301
302
|
app.use('/', profileRouter)
|
|
302
303
|
app.use('/', webfingerRouter)
|
|
303
304
|
app.use('/', proxyRouter)
|
|
305
|
+
app.use('/', nodeinfoRouter)
|
|
304
306
|
|
|
305
307
|
// These should check HTTP Signature if provided
|
|
306
308
|
|
package/lib/digester.js
CHANGED
|
@@ -9,7 +9,8 @@ export class Digester {
|
|
|
9
9
|
async digest (body) {
|
|
10
10
|
const digest = crypto.createHash('sha256')
|
|
11
11
|
digest.update(body)
|
|
12
|
-
|
|
12
|
+
// NB: uppercase required by some ActivityPub processors
|
|
13
|
+
return `SHA-256=${digest.digest('base64')}`
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
async contentDigest (body) {
|
package/lib/keystorage.js
CHANGED
|
@@ -38,6 +38,16 @@ export class KeyStorage {
|
|
|
38
38
|
return privateKey
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
async count () {
|
|
42
|
+
const [rows] = await this.#connection.query(
|
|
43
|
+
'SELECT COUNT(*) as key_count FROM new_keys'
|
|
44
|
+
)
|
|
45
|
+
assert.ok(rows)
|
|
46
|
+
assert.ok(rows.length > 0)
|
|
47
|
+
|
|
48
|
+
return Number(rows[0].key_count)
|
|
49
|
+
}
|
|
50
|
+
|
|
41
51
|
async #getKeys (username) {
|
|
42
52
|
assert.equal(typeof username, 'string')
|
|
43
53
|
assert.ok(username !== '*')
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
5
|
+
import { Router } from 'express'
|
|
6
|
+
|
|
7
|
+
import { ProblemDetailsError } from '../errors.js'
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
10
|
+
const __dirname = path.dirname(__filename)
|
|
11
|
+
|
|
12
|
+
const packageName = 'activitypub-bot'
|
|
13
|
+
|
|
14
|
+
const { version: packageVersion } = JSON.parse(
|
|
15
|
+
fs.readFileSync(path.join(__dirname, '..', '..', 'package.json'), 'utf8')
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const router = Router()
|
|
19
|
+
|
|
20
|
+
const VERSIONS = ['2.0']
|
|
21
|
+
|
|
22
|
+
router.get('/.well-known/nodeinfo', async (req, res, next) => {
|
|
23
|
+
const { origin } = req.app.locals
|
|
24
|
+
res.status(200).json({
|
|
25
|
+
links: VERSIONS.map(v => {
|
|
26
|
+
return {
|
|
27
|
+
rel: `http://nodeinfo.diaspora.software/ns/schema/${v}`,
|
|
28
|
+
href: `${origin}/nodeinfo/${v}`
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
router.get('/nodeinfo/:nodeinfoVersion', async (req, res, next) => {
|
|
35
|
+
const { nodeinfoVersion } = req.params
|
|
36
|
+
const { keyStorage } = req.app.locals
|
|
37
|
+
if (!VERSIONS.includes(nodeinfoVersion)) {
|
|
38
|
+
throw new ProblemDetailsError(404, 'unsupported nodeinfo version')
|
|
39
|
+
}
|
|
40
|
+
res.status(200).json({
|
|
41
|
+
version: nodeinfoVersion,
|
|
42
|
+
software: {
|
|
43
|
+
name: packageName,
|
|
44
|
+
version: packageVersion
|
|
45
|
+
},
|
|
46
|
+
protocols: ['activitypub'],
|
|
47
|
+
services: {
|
|
48
|
+
inbound: [],
|
|
49
|
+
outbound: []
|
|
50
|
+
},
|
|
51
|
+
openRegistrations: false,
|
|
52
|
+
usage: {
|
|
53
|
+
users: {
|
|
54
|
+
total: await keyStorage.count()
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
metadata: {}
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
export default router
|