filips123 / PWAsForFirefox

A tool to install, manage and use Progressive Web Apps (PWAs) in Mozilla Firefox
https://pwasforfirefox.filips.si
Mozilla Public License 2.0
2.23k stars 51 forks source link

Installation of some PWAs prompts an error #318

Closed Aleksandra0056 closed 1 year ago

Aleksandra0056 commented 1 year ago

Description

I think, that they can't be installed with the “Use the manifest for determining app properties” option enabled.

Error message: Failed to parse web app manifest: expected value at line 1 column 1

Additional Information

Similar issue: https://github.com/filips123/PWAsForFirefox/issues/275

Affected Websites

https://apps.microsoft.com/https://www.messenger.com/

Environment

filips123 commented 1 year ago

I can also reproduce this issue. I think it's similar to some problems with other sites (#315, #247), where websites respond with some random error page instead of the manifest when they see an unknown user agent. In this case, Microsoft responds with some HTML page for the "The request is blocked" error, and Messenger also with some HTML page that I haven't checked yet.

I'll check what I can do about this. In my opinion, websites shouldn't be doing this and it's completely their fault that they provide invalid manifests when they see unknown word in the user agent. I know such errors can be annoying, so I'll check if I can fix them, probably next week. Otherwise, I'll probably just create a list of known broken websites.

Also, sometimes I really don't understand some web developers. I try to be "responsible" by adding PWAsForFirefox to the user agent header, but considering it appears to cause so many problems, I might just remove it...

ItsRogueRen commented 1 year ago

Bringing this error back up as now Crunchyroll (https://www.crunchyroll.com) is doing it when previously it worked just fine (and in fact on my desktop where a PWA is already installed, it continues to work just fine). However I cannot create a new PWA of it on my laptop running the same OS as my desktop (Nobara Linux, based on Fedora 38).

Error is the same one previous issues have mentioned of "Failed to parse web app manifest: expected value at line 1 column 1"

filips123 commented 12 months ago

It seems requests made to crunchyroll.com from the native program are blocked by Cloudflare's protection page. What's interesting is that I tried doing basically the same request with curl, and it worked fine there, so maybe they're doing some more "advanced" detection that can differentiate between reqwest (HTTP client that PWAsForFirefox uses) and some other clients.

Because of this, this probably can't be fixed unless the website changes their detection algorithm.

You can try to disable "Use the manifest for determining app properties" when installing the website. Then, you will'be able to install it. However, requests for icons will still hit the same protection page, so icon probably won't work, unless you set your own.

ItsRogueRen commented 12 months ago

It seems requests made to crunchyroll.com from the native program are blocked by Cloudflare's protection page. What's interesting is that I tried doing basically the same request with curl, and it worked fine there, so maybe they're doing some more "advanced" detection that can differentiate between reqwest (HTTP client that PWAsForFirefox uses) and some other clients.

Because of this, this probably can't be fixed unless the website changes their detection algorithm.

You can try to disable "Use the manifest for determining app properties" when installing the website. Then, you will'be able to install it. However, requests for icons will still hit the same protection page, so icon probably won't work, unless you set your own.

That's a suitable workaround then, what kind of images are supported for the icons when setting your own?

filips123 commented 12 months ago

Most common formats are supported (such as PNG, JPG, ICO, GIF, SVG). It's recommended to be a square icon around 128x128 px in size, although this isn't strictly required. However, one requirement is that the icon should be on an accessible URL. So, the easiest way to get Crunchyroll icon would be to search if there is already any suitable icon available online. Maybe this will be fine.

You can also try to reinstall Crunchyroll with the manifest option enabled in the future, as those "protections" can change, so it's possible that it will get unblocked in the future.