use datePivot more places
This commit is contained in:
parent
53a6c9489f
commit
e668b1f7f3
|
@ -1,6 +1,7 @@
|
|||
import path from 'path'
|
||||
import AWS from 'aws-sdk'
|
||||
import { PassThrough } from 'stream'
|
||||
import { datePivot } from '../../../lib/time'
|
||||
const { spawn } = require('child_process')
|
||||
const encodeS3URI = require('node-s3-url-encode')
|
||||
|
||||
|
@ -28,7 +29,7 @@ export default async function handler (req, res) {
|
|||
aws.headObject({
|
||||
Bucket: bucketName,
|
||||
Key: s3PathPUT,
|
||||
IfModifiedSince: new Date(new Date().getTime() - 15 * 60000)
|
||||
IfModifiedSince: datePivot(new Date(), { minutes: -15 })
|
||||
}).promise().then(() => {
|
||||
// this path is cached so return it
|
||||
res.writeHead(302, { Location: bucketUrl + s3PathGET }).end()
|
||||
|
|
|
@ -5,6 +5,7 @@ import { lnurlPayDescriptionHashForUser } from '../../../../lib/lnurl'
|
|||
import serialize from '../../../../api/resolvers/serial'
|
||||
import { schnorr } from '@noble/curves/secp256k1'
|
||||
import { createHash } from 'crypto'
|
||||
import { datePivot } from '../../../../lib/time'
|
||||
|
||||
export default async ({ query: { username, amount, nostr } }, res) => {
|
||||
const user = await models.user.findUnique({ where: { name: username } })
|
||||
|
@ -36,7 +37,7 @@ export default async ({ query: { username, amount, nostr } }, res) => {
|
|||
}
|
||||
|
||||
// generate invoice
|
||||
const expiresAt = new Date(new Date().setMinutes(new Date().getMinutes() + 1))
|
||||
const expiresAt = datePivot(new Date(), { minutes: 1 })
|
||||
const invoice = await createInvoice({
|
||||
description,
|
||||
description_hash: descriptionHash,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import models from '../../api/models'
|
||||
import getSSRApolloClient from '../../api/ssrApollo'
|
||||
import { CREATE_WITHDRAWL } from '../../fragments/wallet'
|
||||
import { datePivot } from '../../lib/time'
|
||||
|
||||
export default async ({ query }, res) => {
|
||||
if (!query.k1) {
|
||||
|
@ -19,7 +20,7 @@ export default async ({ query }, res) => {
|
|||
where: {
|
||||
k1: query.k1,
|
||||
createdAt: {
|
||||
gt: new Date(new Date().setHours(new Date().getHours() - 1))
|
||||
gt: datePivot(new Date(), { hours: -1 })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue