Page MenuHomePhabricator

[Cashtab] Remove remote code from extension
ClosedPublic

Authored by bytesofman on Dec 8 2023, 12:58.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCa816a0d8d272: [Cashtab] Remove remote code from extension
Summary

2.0.1 did not pass review bc chrome store does not allow remote code. The remote code, sideshift, is not actually used in the extension (for this reason). However it is still in index.html and should not be for the extension.

Test Plan

npm run extension, confirm that "SIDESHIFT" does not appear anywhere in extension/dist/index.html

npm run build, confirm 'SIDESHIFT" does appear in build/index.html

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cashtab/extension/public/index.html vs cashtab/public/index.html

image.png (327×627 px, 42 KB)

Fabien requested changes to this revision.Dec 8 2023, 19:44
Fabien added a subscriber: Fabien.

Now you have to maintain it in 2 different places.
AFAICT there is a single line that should be removed (the part with the settings does not call any external code), you should just generate the extension index by filtering the main one for this single line.
This means that every update to the main index will remain in the extension one.

This revision now requires changes to proceed.Dec 8 2023, 19:44

use env var to avoid file duplication

Now you have to maintain it in 2 different places.
AFAICT there is a single line that should be removed (the part with the settings does not call any external code), you should just generate the extension index by filtering the main one for this single line.
This means that every update to the main index will remain in the extension one.

I've been trying to get env-variable conditional building to work in the extension for awhile, as the same concept applies to the other currently-duplicated files, but kept running into issues.

Seems to actually work now.

https://github.com/facebook/create-react-app/issues/3112

Issue was that I missed this caveat,

https://create-react-app.dev/docs/adding-custom-environment-variables/

"Apart from a few built-in variables (NODE_ENV and PUBLIC_URL), variable names must start with REACT_APP_ to work."

Will remove the other extension file duplication in separate diffs (e.g. disable google analytics for the extension).

Much better !

"Apart from a few built-in variables (NODE_ENV and PUBLIC_URL), variable names must start with REACT_APP_ to work."

Seriously...

This revision is now accepted and ready to land.Dec 10 2023, 09:41