Skip to content

Commit b0d5d06

Browse files
authored
Merge pull request #487 from ipfs-shipyard/feat/new-js-ipfs
Support for upload wrapping when embedded node is used - switch to js-ipfs v0.29 - enable wrapping UI when embedded node is used
2 parents 6768dbc + c38ac36 commit b0d5d06

File tree

3 files changed

+471
-474
lines changed

3 files changed

+471
-474
lines changed

add-on/src/popup/quick-upload.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ function quickUploadStore (state, emitter) {
9696
}
9797
progressHandler(0, totalSize, state, emitter)
9898
emitter.emit('render')
99-
// TODO: update flag below after wrapping support is released with new js-ipfs
100-
// TODO: also enable multiple file selection in <input type=file> (blocked for js-ipfs for now)
101-
const wrapFlag = (state.wrapWithDirectory || files.length > 1) && state.ipfsNodeType !== 'embedded'
99+
const wrapFlag = (state.wrapWithDirectory || files.length > 1)
102100
const uploadOptions = {
103101
progress: (len) => progressHandler(len, totalSize, state, emitter),
104102
wrapWithDirectory: wrapFlag,
@@ -123,6 +121,7 @@ function quickUploadOptions (state, emit) {
123121
const onExpandOptions = (e) => { state.expandOptions = true; emit('render') }
124122
const onWrapWithDirectoryChange = (e) => { state.wrapWithDirectory = e.target.checked }
125123
const onPinUploadChange = (e) => { state.pinUpload = e.target.checked }
124+
const isPinningSupported = state.ipfsNodeType === 'external'
126125
if (state.expandOptions) {
127126
return html`
128127
<div id='quickUploadOptions' class='sans-serif mt3 f6 lh-copy light-gray no-user-select'>
@@ -131,11 +130,13 @@ function quickUploadOptions (state, emit) {
131130
<span class='mark db flex items-center relative mr2 br2'></span>
132131
${browser.i18n.getMessage('quickUpload_options_wrapWithDirectory')}
133132
</label>
133+
${isPinningSupported ? (html`
134134
<label for='pinUpload' class='flex items-center db relative mt1 pointer'>
135135
<input id='pinUpload' type='checkbox' onchange=${onPinUploadChange} checked=${state.pinUpload} />
136136
<span class='mark db flex items-center relative mr2 br2'></span>
137137
${browser.i18n.getMessage('quickUpload_options_pinUpload')}
138-
</label>
138+
</label>`)
139+
: null}
139140
</div>
140141
`
141142
}
@@ -169,7 +170,7 @@ function quickUploadPage (state, emit) {
169170
</div>
170171
</header>
171172
<label for="quickUploadInput" class='db relative mt5 hover-inner-shadow' style="border:solid 2px #6ACAD1">
172-
<input class="db pointer w-100 h-100 top-0 o-0" type="file" id="quickUploadInput" ${state.ipfsNodeType === 'external' ? 'multiple' : null} onchange=${onFileInputChange} />
173+
<input class="db pointer w-100 h-100 top-0 o-0" type="file" id="quickUploadInput" multiple onchange=${onFileInputChange} />
173174
<div class='dt dim' style='padding-left: 100px; height: 300px'>
174175
<div class='dtc v-mid'>
175176
<span class="f3 link dim br1 ph4 pv3 dib white" style="background: #6ACAD1">
@@ -185,8 +186,7 @@ function quickUploadPage (state, emit) {
185186
</div>
186187
</div>
187188
</label>
188-
<!-- TODO: enable wrapping in embedded node after js-ipfs release -->
189-
${state.ipfsNodeType === 'external' ? quickUploadOptions(state, emit) : null}
189+
${quickUploadOptions(state, emit)}
190190
</div>
191191
</div>
192192
`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"file-type": "8.0.0",
9696
"filereader-pull-stream": "1.0.0",
9797
"filesize": "3.6.1",
98-
"ipfs": "0.28.2",
98+
"ipfs": "0.29.0",
9999
"ipfs-api": "22.0.0",
100100
"ipfs-css": "0.5.0",
101101
"ipfs-postmsg-proxy": "2.16.1",

0 commit comments

Comments
 (0)