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
|
let urlHrefCache: string | null = null
|
||||||
while (true) {
|
while (true) {
|
||||||
await sleep(500)
|
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))
|
const source = await getSourceByUrl(new URL(location.href))
|
||||||
if (!source) continue
|
if (!source) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (settings.redirect) {
|
if (settings.redirect) {
|
||||||
const target = (await getTargetsBySources(source))[source.id]
|
const target = (await getTargetsBySources(source))[source.id]
|
||||||
if (!target) continue
|
if (!target) return
|
||||||
if (url.href === urlHrefCache) continue
|
console.log(url.href, urlHrefCache)
|
||||||
|
if (url.href === urlHrefCache) return
|
||||||
|
|
||||||
const lbryURL = getLbryUrlByTarget(target)
|
const lbryURL = getLbryUrlByTarget(target)
|
||||||
|
|
||||||
|
@ -274,6 +276,7 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
|
||||||
location.replace(lbryURL)
|
location.replace(lbryURL)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log('open', lbryURL.href)
|
||||||
openNewTab(lbryURL, document.hasFocus())
|
openNewTab(lbryURL, document.hasFocus())
|
||||||
|
|
||||||
if (window.history.length === 1) window.close()
|
if (window.history.length === 1) window.close()
|
||||||
|
@ -337,6 +340,8 @@ import { getExtensionSettingsAsync, getSourcePlatfromSettingsFromHostname, getTa
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
urlHrefCache = url.href
|
urlHrefCache = url.href
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue