@evanp/activitypub-bot 0.26.0 → 0.26.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/actorstorage.js
CHANGED
|
@@ -72,8 +72,8 @@ export class ActorStorage {
|
|
|
72
72
|
page: first
|
|
73
73
|
}),
|
|
74
74
|
last: this.#formatter.format({ username, collection: property, page: 1 }),
|
|
75
|
-
published: createdAt,
|
|
76
|
-
updated: updatedAt
|
|
75
|
+
published: (new Date(createdAt)).toISOString(),
|
|
76
|
+
updated: (new Date(updatedAt)).toISOString()
|
|
77
77
|
})
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -49,6 +49,9 @@ export class HTTPSignatureAuthenticator {
|
|
|
49
49
|
try {
|
|
50
50
|
const keyId = this.#signer.keyId(signature)
|
|
51
51
|
const ok = await this.#remoteKeyStorage.getPublicKey(keyId)
|
|
52
|
+
if (!ok) {
|
|
53
|
+
throw createHttpError(400, 'public key not found')
|
|
54
|
+
}
|
|
52
55
|
let owner = ok.owner
|
|
53
56
|
let publicKeyPem = ok.publicKeyPem
|
|
54
57
|
let result = await this.#signer.validate(publicKeyPem, signature, method, originalUrl, headers)
|
package/lib/objectstorage.js
CHANGED
|
@@ -76,13 +76,15 @@ export class ObjectStorage {
|
|
|
76
76
|
let totalItems = 0
|
|
77
77
|
let first = 1
|
|
78
78
|
let createdAt = null
|
|
79
|
+
let updatedAt = null
|
|
79
80
|
const row = await this.#connection.query(
|
|
80
|
-
'SELECT first, createdAt AS createdat FROM collections WHERE id = ? AND property = ?',
|
|
81
|
+
'SELECT first, createdAt AS createdat, updatedAt AS updatedat FROM collections WHERE id = ? AND property = ?',
|
|
81
82
|
{ replacements: [id, property] }
|
|
82
83
|
)
|
|
83
84
|
if (row[0].length > 0) {
|
|
84
85
|
first = row[0][0].first
|
|
85
86
|
createdAt = row[0][0].createdat
|
|
87
|
+
updatedAt = row[0][0].updatedat
|
|
86
88
|
}
|
|
87
89
|
const count = await this.#connection.query(
|
|
88
90
|
'SELECT COUNT(*) AS count FROM pages WHERE id = ? AND property = ?',
|
|
@@ -95,14 +97,14 @@ export class ObjectStorage {
|
|
|
95
97
|
assert.ok(totalItems >= 0, 'totalItems must be greater than or equal to 0')
|
|
96
98
|
assert.equal(typeof first, 'number', 'first must be a number')
|
|
97
99
|
assert.ok(first >= 1, 'first must be greater than or equal to 1')
|
|
98
|
-
return [totalItems, first, createdAt]
|
|
100
|
+
return [totalItems, first, createdAt, updatedAt]
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
async getCollection (id, property) {
|
|
102
104
|
assert.ok(this.#connection, 'ObjectStorage not initialized')
|
|
103
105
|
assert.ok(id, 'id is required')
|
|
104
106
|
assert.ok(property, 'property is required')
|
|
105
|
-
const [totalItems, first, createdAt] = await this.#collectionInfo(
|
|
107
|
+
const [totalItems, first, createdAt, updatedAt] = await this.#collectionInfo(
|
|
106
108
|
id,
|
|
107
109
|
property
|
|
108
110
|
)
|
|
@@ -122,7 +124,8 @@ export class ObjectStorage {
|
|
|
122
124
|
totalItems,
|
|
123
125
|
first: `${id}/${property}/${first}`,
|
|
124
126
|
last: `${id}/${property}/1`,
|
|
125
|
-
published: createdAt,
|
|
127
|
+
published: (new Date(createdAt)).toISOString(),
|
|
128
|
+
updated: (new Date(updatedAt)).toISOString(),
|
|
126
129
|
[inverse]: id
|
|
127
130
|
})
|
|
128
131
|
assert.ok(collection, 'collection is required')
|