mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
...
This commit is contained in:
parent
bb0dc3c4f4
commit
3692ccba89
2 changed files with 4 additions and 2 deletions
|
@ -52,8 +52,9 @@ async function put(url: string | null, id: string): Promise<void> {
|
||||||
return await new Promise((resolve, reject) => {
|
return await new Promise((resolve, reject) => {
|
||||||
const store = db?.transaction("store", "readwrite").objectStore("store")
|
const store = db?.transaction("store", "readwrite").objectStore("store")
|
||||||
if (!store) return resolve()
|
if (!store) return resolve()
|
||||||
const request = store.put({ value: url, expireAt: !url ? new Date(Date.now() + 1 * 60 * 60 * 1000) : new Date(Date.now() + 15 * 24 * 60 * 60 * 1000) }, id)
|
const expireAt = !url ? new Date(Date.now() + 1 * 60 * 60 * 1000) : new Date(Date.now() + 15 * 24 * 60 * 60 * 1000)
|
||||||
console.log('caching', id, url)
|
const request = store.put({ value: url, expireAt }, id)
|
||||||
|
console.log('caching', id, url, 'until:', expireAt)
|
||||||
request.addEventListener('success', () => resolve())
|
request.addEventListener('success', () => resolve())
|
||||||
request.addEventListener('error', () => reject(request.error))
|
request.addEventListener('error', () => reject(request.error))
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { resolveById, YtIdResolverDescriptor } from '../common/yt/urlResolve'
|
import { resolveById, YtIdResolverDescriptor } from '../common/yt/urlResolve'
|
||||||
|
|
||||||
async function resolveYT(descriptor: YtIdResolverDescriptor) {
|
async function resolveYT(descriptor: YtIdResolverDescriptor) {
|
||||||
const lbryProtocolUrl: string | null = (await resolveById([descriptor]).then(a => a[0])) ?? null
|
const lbryProtocolUrl: string | null = (await resolveById([descriptor]).then(a => a[0])) ?? null
|
||||||
if (!lbryProtocolUrl) return null
|
if (!lbryProtocolUrl) return null
|
||||||
|
|
Loading…
Add table
Reference in a new issue