@live-change/secret-link-service 0.9.204 → 0.9.205
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/index.js +8 -4
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -53,7 +53,8 @@ definition.event({
|
|
|
53
53
|
definition.event({
|
|
54
54
|
name: 'linkExpired',
|
|
55
55
|
execute({ link }) {
|
|
56
|
-
|
|
56
|
+
const past = new Date(Date.now() - 60 * 1000)
|
|
57
|
+
return Link.update(link, { expire: past })
|
|
57
58
|
}
|
|
58
59
|
})
|
|
59
60
|
|
|
@@ -92,9 +93,12 @@ definition.trigger({
|
|
|
92
93
|
},
|
|
93
94
|
waitForEvents: true,
|
|
94
95
|
async execute({ authentication }, context, emit) {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const rows = await Link.indexRangeGet('byAuthentication', authentication) || []
|
|
97
|
+
const nowMs = Date.now()
|
|
98
|
+
for (const row of rows) {
|
|
99
|
+
if (new Date(row.expire).getTime() > nowMs) {
|
|
100
|
+
emit({ type: 'linkExpired', link: row.id })
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
103
|
const link = app.generateUid()
|
|
100
104
|
const secretCode = randomString(config.secretCodeLength || 16)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/secret-link-service",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.205",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@live-change/framework": "^0.9.
|
|
25
|
+
"@live-change/framework": "^0.9.205",
|
|
26
26
|
"nodemailer": "^6.7.2"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ef195e51ea283e56d891b11da5d5f586691507db"
|
|
29
29
|
}
|