@evanp/activitypub-bot 0.45.2 → 0.45.3
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 +6 -0
- package/lib/botcontext.js +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/botcontext.js
CHANGED
|
@@ -10,6 +10,8 @@ const AS2_TYPES = [
|
|
|
10
10
|
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
|
11
11
|
]
|
|
12
12
|
|
|
13
|
+
const AS2_NS = 'https://www.w3.org/ns/activitystreams#'
|
|
14
|
+
|
|
13
15
|
const WF_NS = 'https://purl.archive.org/socialweb/webfinger#'
|
|
14
16
|
|
|
15
17
|
const THREAD_PROP = 'https://purl.archive.org/socialweb/thread#thread'
|
|
@@ -558,7 +560,13 @@ export class BotContext {
|
|
|
558
560
|
} else if (obj.summary) {
|
|
559
561
|
return obj.summary.get()
|
|
560
562
|
} else if (obj.type) {
|
|
561
|
-
|
|
563
|
+
const type = (Array.isArray(obj.type))
|
|
564
|
+
? obj.type[0]
|
|
565
|
+
: obj.type
|
|
566
|
+
const shortType = (type.startsWith(AS2_NS))
|
|
567
|
+
? type.slice(AS2_NS.length)
|
|
568
|
+
: type
|
|
569
|
+
return `a(n) ${shortType}`
|
|
562
570
|
} else {
|
|
563
571
|
return 'an object'
|
|
564
572
|
}
|