Skip to content

Commit

Permalink
fix(pageAction): Copy Public Gateway URL
Browse files Browse the repository at this point in the history
- closes #217
- hides IPFS actions when WebUI is opened
  • Loading branch information
lidel committed Mar 18, 2017
1 parent 3c7148b commit b2525ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion add-on/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "IPFS Gateway Redirect (Development Channel)",
"version" : "2.0.0alpha2",
"version" : "2.0.0alpha3",

"description": "Access IPFS resources via custom HTTP2IPFS gateway",
"homepage_url": "https://github.com/lidel/ipfs-firefox-addon",
Expand Down
10 changes: 5 additions & 5 deletions add-on/src/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ function updateContextMenus () {

function onUpdatedTab (tabId, changeInfo, tab) {
if (tab && tab.url) {
const ipfsContext = window.IsIpfs.url(tab.url)
const ipfsContext = window.IsIpfs.url(tab.url) && !tab.url.startsWith(state.apiURLString)
if (ipfsContext) {
browser.pageAction.show(tab.id)
} else {
Expand Down Expand Up @@ -408,17 +408,17 @@ function onStorageChange (changes, area) { // eslint-disable-line no-unused-vars
// debug info
// console.info(`Storage key "${key}" in namespace "${area}" changed. Old value was "${change.oldValue}", new value is "${change.newValue}".`)
if (key === 'ipfsApiUrl') {
state.apiURLString = change.newValue
state.apiURL = new URL(state.apiURLString)
state.apiURL = new URL(change.newValue)
state.apiURLString = state.apiURL.toString()
ipfs = initIpfsApi(state.apiURLString)
browser.alarms.create(ipfsApiStatusUpdateAlarm, {})
} else if (key === 'ipfsApiPollMs') {
browser.alarms.clear(ipfsApiStatusUpdateAlarm).then(() => {
createIpfsApiStatusUpdateAlarm(change.newValue)
})
} else if (key === 'customGatewayUrl') {
state.gwURLString = change.newValue
state.gwURL = new URL(state.gwURLString)
state.gwURL = new URL(change.newValue)
state.gwURLString = state.gwURL.toString()
} else if (key === 'useCustomGateway') {
state.redirect = change.newValue
browser.alarms.create(ipfsRedirectUpdateAlarm, {})
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/popup/page-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function initPageAction () {
return browser.runtime.getBackgroundPage()
.then(bg => {
copyPublicGwAddress.onclick = () => {
const publicGwAddress = new URL(currentTab.url.replace(bg.state.gwURLString, 'https://ipfs.io')).toString()
const publicGwAddress = new URL(currentTab.url.replace(bg.state.gwURLString, 'https://ipfs.io/')).toString()
copyTextToClipboard(publicGwAddress)
bg.notify('Copied Public URL', publicGwAddress) // TODO: i18
window.close()
Expand Down

0 comments on commit b2525ba

Please sign in to comment.