ipfs-companion icon indicating copy to clipboard operation
ipfs-companion copied to clipboard

feat: support ipfs daemon --offline

Open BrianBelhumeur opened this issue 4 years ago • 4 comments

This is a fix for https://github.com/ipfs-shipyard/ipfs-companion/issues/790

When the IPFS daemon is running in offline mode, pinning should still be enabled in the extension.

This fix functions by replacing isIpfsOnline with isApiAvailable to allow pinning actions in the Tools menu and in-page context menu.

BrianBelhumeur avatar Oct 23 '20 07:10 BrianBelhumeur

Thank you @BrianBelhumeur! Your comments from https://github.com/ipfs-shipyard/ipfs-companion/issues/790#issuecomment-715046792 were really useful and prompted me to refactor a few things (added them to this PR):

  • a7793c7 added a way to differentiate between "api is down" and "there are no peers but api is up" states and switched codebase to work better in offline mode
  • 53ca68c detects offline mode and tries to precache webui into the store by prefetching it from public gateway, which partially unblocks import operations (they open in webui, and that final step fails right now)
    • remaining fix needs to happen in ipfs-webui, which right now does not work correctly in --offline mode: https://github.com/ipfs-shipyard/ipfs-webui/issues/853#issuecomment-715470040
    • let's park this PR for now and see if we can fix it upstream easily
      • if not, then we may change the code responsible for import, and open imported file from gateway instead via webui

lidel avatar Oct 23 '20 17:10 lidel

@lidel Thanks for all the help! I looked through the commits you provided... makes sense. Looks like the online/offline issue affects several parts of the code.

Happy to park until there's a resolution to https://github.com/ipfs-shipyard/ipfs-webui/issues/853

BrianBelhumeur avatar Oct 24 '20 06:10 BrianBelhumeur

There appear to be quite a few conflicts to getting this merged. I'm not terribly familiar with Javascript, so how bad are these conflicts that we're looking at?

I'll just quickly mention that I'll often run IPFS with --offline purely out of paranoia and instead use it as a personal archive, so I'm fairly excited to see this issue resolved.

boomshroom avatar Apr 21 '21 20:04 boomshroom

IIRC this is blocked by https://github.com/ipfs/ipfs-webui/issues/853#issuecomment-715470040 This PR is pretty stale, so when that webui issue is resolved we will most likely create a new PR here.

lidel avatar Apr 22 '21 00:04 lidel