Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update js-ipfs-api, fixes #14 #15

Merged
merged 1 commit into from
Mar 19, 2017
Merged

Conversation

mateon1
Copy link
Contributor

@mateon1 mateon1 commented Mar 19, 2017

No description provided.

@fbaiodias
Copy link
Owner

fbaiodias commented Mar 19, 2017

I've just uploaded v0.1.0 to the chrome web store, should become available in the next 60 mins. Thanks @mateon1!

@mateon1
Copy link
Contributor Author

mateon1 commented Mar 19, 2017

This is unfortunate, I just checked the updated extension, and it seems that ipfs-api has a new dependency on protocol-buffers, which in turn depends on generate-function.
generate-function uses Function("..."), which triggers unsafe-eval in Chrome's extension CSP policy.

Oddly enough, this only triggers when using npm run build, but the extension works perfectly with npm run dev.

@lidel
Copy link

lidel commented Mar 19, 2017

I think this was always the case for browser bundle of ipfs-api.
I had to whitelist eval in Firefox WebExtension too.

@fbaiodias
Copy link
Owner

Oops, only tested with npm run dev. The dev version already had 'unsafe-eval' for the hot module loading if I'm not mistaken.

I'll whitelist in the prod version too then :)

fbaiodias added a commit that referenced this pull request Mar 19, 2017
Refer to discussion on #15
@AlexBeLi
Copy link

Very strange, not working for me. "Oh snap, it looks like your node is not running yet."
I use ipfs 0.4.7 from ipfs.io and Vivaldi
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.100 Safari/537.36 Vivaldi/1.8.770.32

@fbaiodias
Copy link
Owner

fbaiodias commented Mar 19, 2017

@AlexBeLi I've just installed Vivaldi and it seems to work for me with ipfs 0.4.7 😕
Can you tell me what's the version you've got installed? Is it 0.1.1? You can check it at vivaldi://extensions

@AlexBeLi
Copy link

AlexBeLi commented Mar 19, 2017

IPFS Station 0.1.1
Maybe something with my ipfs settings?

\.ipfs\config
{
  "API": {
    "HTTPHeaders": null
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001",
      "/ip6/::/udp/4001"
    ]
  },
 "Bootstrap": [
    ...
  ],
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "NoSync": false,
    "Params": null,
    "Path": "C:\\path-to-my-folder\\.ipfs\\datastore",
    "StorageGCWatermark": 90,
    "StorageMax": "10GB",
    "Type": "leveldb"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false,
      "Interval": 10
    }
  },
  "Gateway": {
    "HTTPHeaders": null,
    "PathPrefixes": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
   ...
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "SupernodeRouting": {
    "Servers": [
   ...
    ]
  },
  "Swarm": {
    "AddrFilters": null
  },
  "Tour": {
    "Last": ""
  },
  "Version": {
    "AutoUpdate": "minor",
    "Check": "error",
    "CheckDate": "0001-01-01T00:00:00Z",
    "CheckPeriod": "172800000000000",
    "Current": "0.3.11"
  }
}

in addon

ipfs node details
localhost
8080
5001
5000

@fbaiodias
Copy link
Owner

fbaiodias commented Mar 19, 2017

Try setting the CORS headers: ipfs config API.HTTPHeaders '{"Access-Control-Allow-Origin": ["*"]}' --json, and restarting the daemon.

@AlexBeLi
Copy link

>ipfs config API.HTTPHeaders '{"Access-Control-Allow-Origin": ["*"]}' --json
Error: Unknown Command "API.HTTPHeaders"

@fbaiodias
Copy link
Owner

Maybe try with the --json beforehand? ipfs config --json API.HTTPHeaders '{"Access-Control-Allow-Origin": ["*"]}'

Super weird, both ways work for me:
screen shot 2017-03-19 at 19 35 12

If if still doesn't work you can also try changing the config on the webui: http://127.0.0.1:5001/ipfs/QmPhnvn747LqwPYMJmQVorMaGbMSgA7mRRoyyZYz3DoZRQ/#/config

@AlexBeLi
Copy link

Thanks, It's work fine:)

@whyrusleeping
Copy link

@mateon1 @lidel if we get this issue fixed: mafintosh/protocol-buffers#18
we should be able to avoid the eval stuff, should make for a slightly nicer experience no?

@lidel
Copy link

lidel commented Mar 31, 2017

@whyrusleeping Removal of eval would speed up future reviews at Mozilla, for sure.
Right now we need special CSP exception (unsafe-eval) in add-on/manifest.json#L79, which triggers additional review at AMO:

WARNINGS:

Code           Message                                       Description                                                 File   Line   Column
MANIFEST_CSP   "content_security_policy" is defined in the   A custom content_security_policy needs additional review.                       
               manifest.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants