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.2k stars 51 forks source link

Unable to install Google Classroom #247

Closed pesader closed 1 year ago

pesader commented 1 year ago

Description

I've tried to install Google Classroom as a web app, but got the following error:

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

Steps to Reproduce

  1. Go to https://classroom.google.com/u/0/h
  2. Sign in to a Google account
  3. Open the FirefoxPWA menu
  4. Click on 'Install Web App'
  5. See error

Additional Information

This looks like an "upstream" problem in the Google Classroom manifest itself, like we saw in issues #236 and #71. Is there a way to download the manifest so I can a look at it? I'd like to help debugging this so we can understand where the problem is coming from.

Affected Websites

Environment

filips123 commented 1 year ago

You can view the manifest URL using Firefox DevTools. Press F12, go to the Application tab and to Manifest. However, what Firefox will display as parsed values might be different from what PWAsForFirefox will see (and it is different in this case) because PWAsForFirefox will do its own request. You can then use curl to download the manifest with the same user-agent as PWAsForFirefox, which should be the same as what PWAsForFirefox receives. In this case: curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0 PWAsForFirefox/2.1.2" "https://classroom.google.com/u/0/_/ClassroomUi/manifest.json".

I've already checked why parsing fails with Google Classroom. It looks like Google Classroom requires you to be logged in in order to access the manifest. Because PWAsForFirefox is a separate program, it cannot access your normal cookies, so Google Classroom thinks you are not logged in and returns an error page instead of the manifest.

I don't know why Google decided to implement it this way. Unless Google allows accessing manifest without login, I don't think this can be solved. However, you can still install Google Classroom if you uncheck the manifest option when installing.

black7375 commented 1 year ago

How about having fallback when failing?

filips123 commented 1 year ago

I thought about doing this, but then the problem could be that even potential actual issues/errors in manifest parsing would silently be ignored and wouldn't be fixed. And if the manifest is completely valid but couldn't be parsed due to some bug, this could mean the user would get a slightly worse experience (like different icons and an app name, no protocol handlers, etc.) without knowing what causes it.

The solution could be to display something like "This may be a problem with the web app manifest. Please try to disable manifest parsing and install the web app again." when some manifest-related errors occur. But I'll have to check which errors can be caused by a broken manifest.

Also, I could create a list of known problematic websites so users know why something doesn't work.

black7375 commented 1 year ago

Yes, I think it's better to ask if you want to force installation with parsing failure message.