Closed darkred closed 4 years ago
Hi, so I checked and it seems it's not the only change needed (as you suspected as well)..
notice the following, it's using location.origin
for building the URL to get notifications. Which doesn't work on gist.github.com
.
https://github.com/tanmayrajani/notifications-preview-github/blob/master/extension/github-notifications-preview.js#L16
Thank you for responding and for identifying that problem. Could you please tell me how to build the extension locally, in order to make sure that the extension works, before I add the commit to this PR ?
I noticed the same problem today for the local build but didn't have enough time at my hand to figure out and fix. If you can, see if you're able to fix that first. Maybe @fregante can help as well? As a last resort, you'll still be able to build and import the dist folder for now?
Maybe @fregante can help as well?
For reference, here is how I do Load Unpacked
the "Extension" folder in Google Chrome, and the errors I get:
I get Unrecognized manifest key 'applications
..extension
folder, open manifest.json
and remove the "applications"
key Then, if I try to Load Unpacked
the "extension" folder again
I now get Uncaught SyntaxError: Cannot use import statement outside a module
at options-storage.js:1
As a last resort, you'll still be able to build and import the dist folder for now?
How do I do that? Which dist folder do you mean?
see if you're able to fix that first.
I'll try
The extension needs to be built first:
npm install
npm run build
Then loaded from the new dist
folder that has been generated, not extension
I noticed the same problem today for the local build
It seems to work correctly for me and on GitHub Actions. You might just need to delete node_modules
Thank you very much @fregante .
It works fine with your instructions (I also opened manifest.json
and removed the "applications"
key in the dist
folder).
Now regarding the issue that @tanmayrajani kindly described:
I can only think of changing in https://github.com/tanmayrajani/notifications-preview-github/blob/master/extension/github-notifications-preview.js#L16 the location.origin
to fixed https://github.com
but the extension still doesn't work:
if I open e.g. https://gist.github.com/discover, I get this error Uncaught (in promise) TypeError: Failed to fetch
:
because of "Cross-Origin Read Blocking (CORB)":
which leads to Uncaught (in promise) TypeError: Cannot read property 'textContent' of null
, i.e.:
Sorry I can't be of any more help.
I also opened
manifest.json
and removed the"applications"
key in thedist
folder).
That's not necessary. Chrome complains but it still works
because of "Cross-Origin Read Blocking (CORB)":
Ugh, that's an annoying problem and that probably means it's not possible.
In my npmhub
extension we fixed that by moving the fetch to the background
page (https://github.com/npmhub/npmhub/issues/92), however this is not possible here: we need the current page’s cookies and those are not available in the background
page.
AFAIK, there are only 3 solutions:
Access-Control-Allow-Origin
header (heh, it won't happen)request
-related permissions to be able to add the header ourselves: https://stackoverflow.com/a/54835157/288906 but it's not worth it because it causes "This extension can see all your web activity"Other than that, I don't see a solution, but feel free to keep looking for one.
I'll close this PR in the meanwhile, it's not enough
Currently the extension is not working in gist.github.com pages, i.e. there's no notification number in the blue bubble nor pop-over on hover.
This PR adds
https://gist.github.com/*
in the extension's manifest.json. (I hope this change is all that's needed, because I couldn't get the loaded unpacked extension to work, I was getting errors)Test URL: https://gist.github.com/discover
Thank you