Skip to content

Commit ae5ae58

Browse files
authored
Merge pull request #488 from ipfs-shipyard/fix/private-window-sharing-in-ff
fix: disable sharing action when upload is not possible Closes #477 by disabling Upload action when access to required backend is not possible (eg. in Private Mode in Firefox).
2 parents b0d5d06 + 8f2a719 commit ae5ae58

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

add-on/src/popup/browser-action/operations.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ module.exports = function operations ({
99
ipfsNodeType,
1010
isIpfsOnline,
1111
redirectEnabled,
12+
uploadEnabled,
1213
onQuickUpload,
1314
onOpenWebUi,
1415
onOpenPrefs,
1516
onToggleRedirect
1617
}) {
1718
return html`
1819
<div class="fade-in pv1">
19-
${isIpfsOnline ? (
20+
${isIpfsOnline && uploadEnabled ? (
2021
navItem({
2122
text: browser.i18n.getMessage('panel_quickUpload'),
2223
bold: true,

add-on/src/popup/browser-action/store.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ module.exports = (state, emitter) => {
2121
gatewayAddress: null,
2222
swarmPeers: null,
2323
gatewayVersion: null,
24-
redirectEnabled: false
24+
redirectEnabled: false,
25+
uploadEnabled: false
2526
})
2627

2728
let port
@@ -201,6 +202,8 @@ module.exports = (state, emitter) => {
201202
state.ipfsNodeType = status.ipfsNodeType
202203
state.ipfsApiUrl = options.ipfsApiUrl
203204
state.redirectEnabled = options.useCustomGateway
205+
// Upload requires access to the background page (https://github.com/ipfs-shipyard/ipfs-companion/issues/477)
206+
state.uploadEnabled = !!(await browser.runtime.getBackgroundPage())
204207
state.swarmPeers = status.peerCount === -1 ? 0 : status.peerCount
205208
state.isIpfsOnline = status.peerCount > -1
206209
state.gatewayVersion = status.gatewayVersion ? status.gatewayVersion : null

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5554,7 +5554,7 @@ level-js@^2.2.4:
55545554
typedarray-to-buffer "~1.0.0"
55555555
xtend "~2.1.2"
55565556

5557-
"level-js@github:timkuijsten/level.js#idbunwrapper":
5557+
level-js@timkuijsten/level.js#idbunwrapper:
55585558
version "2.2.3"
55595559
resolved "https://codeload.github.com/timkuijsten/level.js/tar.gz/18e03adab34c49523be7d3d58fafb0c632f61303"
55605560
dependencies:

0 commit comments

Comments
 (0)