gdocwiki icon indicating copy to clipboard operation
gdocwiki copied to clipboard

Browser extension should work in Firefox (and Safari, etc)

Open gregwebs opened this issue 3 years ago • 6 comments

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?

gregwebs avatar Jul 06 '21 01:07 gregwebs

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

gregwebs avatar Jul 06 '21 17:07 gregwebs

I guess we need some special CSP attribute.

breezewish avatar Jul 08 '21 02:07 breezewish

Actually, the CSP warnings seem to be there without the extension as well. Still, I have no idea why the oauth token refresh fails.

gregwebs avatar Jul 08 '21 07:07 gregwebs

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

gregwebs avatar Jul 08 '21 17:07 gregwebs

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)

SunRunAway avatar Oct 28 '21 11:10 SunRunAway

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.

gregwebs avatar Nov 01 '21 13:11 gregwebs