hymbz / ComicReadScript

为漫画站增加双页阅读模式及优化使用体验。
https://comic-read.pages.dev/
GNU Affero General Public License v3.0
620 stars 25 forks source link

[Bug]: PWA "Comic Read not istalled" error when using ?url=<archive url> #113

Closed EnergoStalin closed 12 months ago

EnergoStalin commented 12 months ago

If i understand correctly from what you said when you implemented this feature. Such

https://comic-read.pages.dev/?url=https%3A%2F%2Fc6.kemono.party%2Fdata%2F03%2F57%2F03577a30cb1b7d80bd6911021e7e33cfd2a6e30912585d3580d245ade0ae375a.zip

link should start download immediately. Or there's a browser limitation where i should click on the page first before script being able to download? Anyway in such case error message is not helpful i think.

Sorry for didn't testing it earlier.

Here's the snippet for kemono.paty to convert all .zip links to PWA links i'm using

Array.from(document.querySelectorAll("a")).filter(e => e.href.endsWith(".zip")).forEach(e => {
    e.textContent = e.textContent.replace("Download", "ComicReadPWA")
    e.removeAttribute("download")

    e.href = `https://comic-read.pages.dev/?url=${encodeURIComponent(e.href)}`
    e.target = "_blank"
})

Through "Enter URL" works as expected and setting the same link in window location

EnergoStalin commented 12 months ago

problem in target="_blank"

EnergoStalin commented 12 months ago

Script loading later than PWA performing first check when using ?url= API. If opening in current tab it's already loaded i guess so it's not a problem. Probably need some delay to let script load first before processing ?url= in PWA.

hymbz commented 12 months ago

Is there any error message? I tried the link and it seems to be working fine.

You don't need to click on the page, just wait a few seconds after opening it and you will see the download button change to "downloading" style.

EnergoStalin commented 12 months ago

I can reproduce it opening this https://comic-read.pages.dev/?url=https%3A%2F%2Fc6.kemono.party%2Fdata%2F03%2F57%2F03577a30cb1b7d80bd6911021e7e33cfd2a6e30912585d3580d245ade0ae375a.zip with middle click(new tab) opening in the same tab works perfect

image

Got this in yandex(chromium) and firefox browsers

EnergoStalin commented 12 months ago

Maybe not perfect seems very inconsistent now it even don't work in the same tab.

EnergoStalin commented 12 months ago

Fresh browser profile reproducible

hymbz commented 12 months ago

Successfully reproduced, I will fix it later.

hymbz commented 12 months ago

Already updated.

EnergoStalin commented 12 months ago

Works perfectly now thanks!