@evanp/activitypub-bot 0.27.1 → 0.28.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/lib/routes/server.js +25 -30
- package/lib/urlformatter.js +1 -1
- package/package.json +2 -2
package/lib/routes/server.js
CHANGED
|
@@ -4,37 +4,32 @@ import as2 from '../activitystreams.js'
|
|
|
4
4
|
const router = express.Router()
|
|
5
5
|
|
|
6
6
|
router.get('/', async (req, res) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
res.format({
|
|
30
|
-
html: async () => {
|
|
31
|
-
const { indexFileName } = req.app.locals
|
|
32
|
-
res.sendFile(indexFileName)
|
|
33
|
-
},
|
|
34
|
-
'application/activity+json': sendJson,
|
|
35
|
-
'application/ld+json': sendJson,
|
|
36
|
-
json: sendJson
|
|
7
|
+
const { indexFileName } = req.app.locals
|
|
8
|
+
res.type('html')
|
|
9
|
+
res.sendFile(indexFileName)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
router.get('/actor', async (req, res) => {
|
|
13
|
+
const homepage = `${req.protocol}://${req.get('host')}/`
|
|
14
|
+
const { formatter } = req.app.locals
|
|
15
|
+
const server = await as2.import({
|
|
16
|
+
'@context': [
|
|
17
|
+
'https://www.w3.org/ns/activitystreams',
|
|
18
|
+
'https://w3id.org/security/v1'
|
|
19
|
+
],
|
|
20
|
+
id: formatter.format({ server: true }),
|
|
21
|
+
type: 'Service',
|
|
22
|
+
publicKey: formatter.format({ server: true, type: 'publickey' }),
|
|
23
|
+
url: {
|
|
24
|
+
type: 'Link',
|
|
25
|
+
mediaType: 'text/html',
|
|
26
|
+
href: homepage
|
|
27
|
+
}
|
|
37
28
|
})
|
|
29
|
+
const body = await server.export({ useOriginalContext: true })
|
|
30
|
+
res.status(200)
|
|
31
|
+
res.type(as2.mediaType)
|
|
32
|
+
res.json(body)
|
|
38
33
|
})
|
|
39
34
|
|
|
40
35
|
router.get('/publickey', async (req, res) => {
|
package/lib/urlformatter.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evanp/activitypub-bot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.2",
|
|
4
4
|
"description": "server-side ActivityPub bot framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"optionalDependencies": {
|
|
56
56
|
"mysql2": "^3.9.1",
|
|
57
57
|
"pg": "^8.16.3",
|
|
58
|
-
"sqlite3": "^
|
|
58
|
+
"sqlite3": "^6.0.1"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"node": "^20 || ^22 || ^24 || ^25"
|