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

Show IPFS Actions on DNSLink Sites #694

Merged
merged 4 commits into from
Mar 12, 2019
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Mar 12, 2019

cc #689

When we introduced option to opt-out from redirect per site (#687 ) it came with a side effect of removing IPFS context actions.

This PR:

  • Adds context actions on DNSLink sites (when redirect is disabled)
    Peek 2019-03-12 13-56

    This adds context actions such as "Copy IPFS path", "Copy CID", "Pin" to DNSLink websites without redirect.

    It includes refactoring of ipfsPathValidator to expose high level resolvers used in various places by the Companion:

    • resolveToPublicUrl: always return a meaningful, publicly accessible URL that can be accessed without the need of IPFS client.
    • resolveToIpfsPath: return a valid IPFS path that can be accessed with IPFS client.
    • resolveToImmutableIpfsPath: same as resolveToIpfsPath, but the path is always immutable /ipfs/
    • resolveToCid: returns direct CID without anything else
  • Adds a bunch of tests
  • Tweaks behavior of pin/unpin via browser action menu

    In the past we closed menu after toggling pin status, but now we have a nice visual toggle switch and other uses of the switch do not close the menu, so we unified behavior and toggle action no longer closes the popup menu.

  • Works around missing dnslink resolver under js-ipfs

    js-ipfs v0.34 does not support DNSLinks in ipfs*resolve methods yet: Resolving DNSLink Paths: /ipns/<fqdn> js-ipfs#1918
    This temporary workaround detects known errors and falls back to using path from DNSLink cache. It won't be as fresh as original, but at least resolv will work.

This adds context actions such as "Copy IPFS path", "Copy CID", "Pin"
to DNSLink websites without redirect.

It includes refactoring of ipfsPathValidator to expose high level
resolvers:

- resolveToPublicUrl: always return a meaningful, publicly accessible
URL that can be accessed without the need of IPFS client.
- resolveToIpfsPath: return a valid IPFS path that can be accessed with
IPFS client.
- resolveToImmutableIpfsPath: same as resolveToIpfsPath, but the path is
always immutable /ipfs/
- resolveToCid: returnis direct CID without anything else
js-ipfs v0.34 does not support DNSLinks in ipfs*resolve methods:
ipfs/js-ipfs#1918

This temporary workaround detects known errors and falls back to
using path from DNSLink cache. It won't be as fresh as original,
but at least resolv will work.
In past we closed menu after toggling pin status, but now we have nice
visual toggle switch and other uses of the switch do not close the menu.

To unify the UX pin/unpin will keep the menu open.
@lidel lidel requested a review from a team March 12, 2019 13:07
@ghost ghost assigned lidel Mar 12, 2019
@ghost ghost added the status/in-progress In progress label Mar 12, 2019
Copy link

@ericronne ericronne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have this running locally, so i can't play with it, but my only note would be to consider applying the colors from #692, to match the browser extension. Thx!

@lidel
Copy link
Member Author

lidel commented Mar 12, 2019

@ericronne yes, it will have correct colors (when #692 is merged)

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.

2 participants