Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
canLookupURL (requestUrl) {
// skip URLs that could produce infinite recursion or weird loops
const state = getState()
return state.dnslinkPolicy &&
requestUrl.startsWith('http') &&
!IsIpfs.url(requestUrl) &&
!requestUrl.startsWith(state.apiURLString) &&
!requestUrl.startsWith(state.gwURLString)
},
function interceptor (details) {
var parsedUrl = url.parse(details.url)
if (isIPFSUrl(details.url) && parsedUrl.host.indexOf(settings.host) === -1) {
const node = `${settings.host}:${settings.port}`
parsedUrl.protocol = 'http:'
parsedUrl.host = node
parsedUrl.hostname = node
const localUrl = url.format(parsedUrl)
console.log('redirected', details.url, 'to', node)
return { redirectUrl: localUrl }
}
}
isIpfsPageActionsContext (url) {
return Boolean(url && !url.startsWith(getState().apiURLString) && (
IsIpfs.url(url) ||
IsIpfs.subdomain(url) ||
dnslinkResolver.cachedDnslink(new URL(url).hostname)
))
},
chrome.tabs.query({ currentWindow: true, active: true }, (tabs) => {
if (!isIPFSUrl(tabs[0].url)) {
return
}
const pageUrl = tabs[0].url
const { hash } = parseUrl(pageUrl)
this.setState({
isIpfsPage: true,
pageUrl,
pageHash: hash
})
chrome.runtime.sendMessage({ method: 'pin.list' }, (response) => {
const err = response[0]
const res = response[1]