-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: View on Gateway context action on IPFS pages
This adds new item to Active Tab section of menu in browser action that enables user to open existing IPFS resource at Public or Custom Gateway (depends on redirect status).
- Loading branch information
Showing
7 changed files
with
59 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict' | ||
|
||
const browser = require('webextension-polyfill') | ||
const { findValueForContext } = require('./context-menus') | ||
const { pathAtHttpGateway } = require('./ipfs-path') | ||
|
||
function createInspector (notify, ipfsPathValidator, getState) { | ||
return { | ||
async viewOnGateway (context, contextType) { | ||
const url = await findValueForContext(context, contextType) | ||
const ipfsPath = ipfsPathValidator.resolveToIpfsPath(url) | ||
const gateway = getState().pubGwURLString | ||
const gatewayUrl = pathAtHttpGateway(ipfsPath, gateway) | ||
await browser.tabs.create({ url: gatewayUrl }) | ||
} | ||
// TODO: view in WebUI's Files | ||
// TODO: view in WebUI's IPLD Explorer | ||
} | ||
} | ||
|
||
module.exports = createInspector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters