gdocwiki
gdocwiki copied to clipboard
Browser extension should work in Firefox (and Safari, etc)
I am not very familiar with browser extension development. I know there is work towards standardizing extension development. Mozilla recommends using a polyfill for standardization.
What is a good approach to making this work in Firefox?
Apparently many extensions just work in FireFox. This is not one of them. The initial setup of connecting to the wiki looks like it works. But the extension does not load properly when tested on a Google Doc. There are lots of CSP errors: Content Security Policy: Ignoring “'unsafe-inline'” within script-src: ‘strict-dynamic’ specified
And then more concretely this error appears:
gdocwiki:info Load gdocwiki token failed consola.browser.js:1
gdocwiki:info Error: XHR aborted: https://accounts.google.com/o/oauth2/token
onabort browser.js:24
request browser.js:23
request browser.js:11
_request client-oauth2.js:273
refresh client-oauth2.js:376
getStoredTokenAndRefresh oauth.ts:104
init oauth.ts:64
useToken oauth.ts:72
I guess we need some special CSP attribute.
Actually, the CSP warnings seem to be there without the extension as well. Still, I have no idea why the oauth token refresh fails.
Possibly try a different auth library that is more actively maintained.
- https://github.com/salte-auth/examples/blob/main/react/index.js
- https://github.com/salte-auth/google/blob/main/demo/index.ts
Can it be published by user script via Tampermonkey(https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/) and Safari(https://apps.apple.com/us/app/userscripts/id1463298887?mt=12)
Can it be published by user script via Tampermonkey(https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/) and Safari(https://apps.apple.com/us/app/userscripts/id1463298887?mt=12)
Maybe. The extension can be built from packages/browser-extension (yarn build) if anyone wants to try it out.