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

Add window.ipfs.enable(opts) (Bulk Permission Prompt) #619

Merged
merged 9 commits into from
Jan 7, 2019

Commits on Dec 10, 2018

  1. feat: scaffolding for window.ipfs.enable

    This simply changes the flow and API for getting IPFS proxy instance,
    does not implement UX nor decrease the size of injected content script.
    lidel committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    4e6f65d View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2018

  1. feat: window.ipfs.enable()

    This change adds async `enable` function that takes optional list of commands
    to grant access to via user prompt.
    
    The goal is to move away from synchronous way of accessing API instance
    and provide UX incentive to use `window.ipfs.enable` instead.
    
    When called without any arguments, command will just return API instance
    equal to the old `window.ipfs` or throw an error if IPFS Proxy is
    disabled in Preferences.
    
    When called  with options object `{ commands: ['id','peers'] }`
    access rights for specified commands will be validated:
    
    - if any of the commands is denied or blocked, function will throw
    - if any of the commands require user approval, user will be presented
    with a single prompt dialog that lists all requested permissions and URL
    that requests them
      - if user approves, ACLs are saved and future calls will not trigger
      prompt
      - if user denies, ACLs are saved and an error is thrown for current
      and all future executions (unless user removed scope from blacklist)
    
    TODO (to be addressed in future commits)
    
    - add deprecation warning to API calls executed on `window.ipfs`
    - improve UX of permission dialog
    - add ability to return `ipfsx` version fo the API
    - disable `window.ipfs` injection via manifest in Chromium
    - stop exposing methods on `window.ipfs`
        - minimize the size of content script responsible for `window.ipfs`
        - lazy-init IPFS Proxy client on first call to `window.ipfs.enable()`
    lidel committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    b0110a0 View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2018

  1. fix(build): regenerate yarn.lock

    - also switch to terser-webpack-plugin
    lidel committed Dec 13, 2018
    Configuration menu
    Copy the full SHA
    fb27d28 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2018

  1. chore: pre-api-whitelist → pre-command

    acl and api looked too similar and made code hard to follow,
    ipfs api core uses 'command' term to identify each endpoint
    so we follow that practice here
    lidel committed Dec 14, 2018
    Configuration menu
    Copy the full SHA
    a8db570 View commit details
    Browse the repository at this point in the history

Commits on Dec 16, 2018

  1. refactor(window.ipfs): backward-compatible errors

    To avoid breaking changes we should deprecate old error codes first.
    
    This commit:
    - restores `permission` attribute and adds a deprecation
    warning when it is accessed.
    - adds error `code` to simplify error handling and alight convention
    with js-ipfs
    - updates docs
    lidel committed Dec 16, 2018
    Configuration menu
    Copy the full SHA
    19a9577 View commit details
    Browse the repository at this point in the history
  2. feat(window.ipfs): opt-in ipfsx experiment

    This adds an opt-in ipfsx experiment.
    In short, if `experiments:{ipfsx:true}` is passed `window.ipfs.enable`
    will return IPFS API instance wrapped in ipfsx prototype from
    https://github.com/ipfs-shipyard/ipfsx
    
    ```
    let ipfs = await window.ipfs.enable({
        commands: ['add','files.addPullStream'],
        experiments: { ipfsx: true }
    })
    ```
    lidel committed Dec 16, 2018
    Configuration menu
    Copy the full SHA
    b633eb4 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2019

  1. Configuration menu
    Copy the full SHA
    690ad80 View commit details
    Browse the repository at this point in the history
  2. fix(privacy): remove ACL whitelist for window.ipfs

    This change means no command can be run without explicit approval from
    the user.
    
    Rationale can be found in
    #619 (comment)
    lidel committed Jan 3, 2019
    Configuration menu
    Copy the full SHA
    756b177 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2019

  1. Configuration menu
    Copy the full SHA
    f3e9c6c View commit details
    Browse the repository at this point in the history