mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
🍣 bug fixes
This commit is contained in:
parent
619d66d6aa
commit
4295dbe1fe
1 changed files with 87 additions and 82 deletions
|
@ -246,16 +246,18 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
|
|||
let urlHrefCache: string | null = null
|
||||
while (true) {
|
||||
await sleep(500)
|
||||
const url: URL = new URL(location.href);
|
||||
|
||||
const url: URL = new URL(location.href)
|
||||
await (async () => {
|
||||
const source = await getSourceByUrl(new URL(location.href))
|
||||
if (!source) continue
|
||||
if (!source) return
|
||||
|
||||
try {
|
||||
if (settings.redirect) {
|
||||
const target = (await getTargetsBySources(source))[source.id]
|
||||
if (!target) continue
|
||||
if (url.href === urlHrefCache) continue
|
||||
if (!target) return
|
||||
console.log(url.href, urlHrefCache)
|
||||
if (url.href === urlHrefCache) return
|
||||
|
||||
const lbryURL = getLbryUrlByTarget(target)
|
||||
|
||||
|
@ -274,6 +276,7 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
|
|||
location.replace(lbryURL)
|
||||
}
|
||||
else {
|
||||
console.log('open', lbryURL.href)
|
||||
openNewTab(lbryURL, document.hasFocus())
|
||||
|
||||
if (window.history.length === 1) window.close()
|
||||
|
@ -337,6 +340,8 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
|
|||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
})()
|
||||
|
||||
urlHrefCache = url.href
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue