---
add-on/src/popup/quick-upload.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/add-on/src/popup/quick-upload.js b/add-on/src/popup/quick-upload.js
index 17f269f8d..02682d352 100644
--- a/add-on/src/popup/quick-upload.js
+++ b/add-on/src/popup/quick-upload.js
@@ -138,7 +138,7 @@ function formatUploadDirectory (path) {
// needed to handle date symbols in the import directory
const now = new Date()
const dateSymbols = [/%Y/g, /%M/g, /%D/g, /%h/g, /%m/g, /%s/g]
- const symbolReplacements = [now.getFullYear(), now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()]
+ const symbolReplacements = [now.getFullYear(), now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()].map(n => String(n).padStart(2, "0"))
dateSymbols.forEach((symbol, i) => { path = path.replace(symbol, symbolReplacements[i]) })
return path
}
From 5e85a93fd1a0473e6e98108cbed28d2ee6b75253 Mon Sep 17 00:00:00 2001
From: colinfruit <17092461+colinfruit@users.noreply.github.com>
Date: Mon, 25 Nov 2019 21:57:12 -0500
Subject: [PATCH 19/28] remove wrapWithDirectory option
---
add-on/_locales/en/messages.json | 4 ----
add-on/src/popup/quick-upload.js | 11 ++---------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/add-on/_locales/en/messages.json b/add-on/_locales/en/messages.json
index 908a9b66e..f1022bfce 100644
--- a/add-on/_locales/en/messages.json
+++ b/add-on/_locales/en/messages.json
@@ -487,10 +487,6 @@
"message": "Path to store imported files",
"description": "Textbox label on the share files page (quickUpload_options_uploadDir)"
},
- "quickUpload_options_wrapWithDirectory": {
- "message": "Wrap single files in a directory to preserve their filenames.",
- "description": "Checkbox label on the share files page (quickUpload_options_wrapWithDirectory)"
- },
"quickUpload_options_openViaWebUI": {
"message": "Open in Web UI",
"description": "Checkbox label on the share files page (quickUpload_options_openViaWebUI)"
diff --git a/add-on/src/popup/quick-upload.js b/add-on/src/popup/quick-upload.js
index 02682d352..11d56c6a7 100644
--- a/add-on/src/popup/quick-upload.js
+++ b/add-on/src/popup/quick-upload.js
@@ -21,7 +21,6 @@ function quickUploadStore (state, emitter) {
state.peerCount = ''
state.ipfsNodeType = 'external'
state.expandOptions = false
- state.wrapWithDirectory = true
state.openViaWebUI = true
state.uploadDir = ''
state.userChangedUploadDir = false
@@ -67,7 +66,7 @@ async function processFiles (state, emitter, files) {
const uploadTab = await browser.tabs.getCurrent()
const streams = files2streams(files)
emitter.emit('render')
- const wrapFlag = (state.wrapWithDirectory || streams.length > 1)
+ const wrapFlag = streams.length > 1
const options = {
wrapWithDirectory: wrapFlag
}
@@ -138,7 +137,7 @@ function formatUploadDirectory (path) {
// needed to handle date symbols in the import directory
const now = new Date()
const dateSymbols = [/%Y/g, /%M/g, /%D/g, /%h/g, /%m/g, /%s/g]
- const symbolReplacements = [now.getFullYear(), now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()].map(n => String(n).padStart(2, "0"))
+ const symbolReplacements = [now.getFullYear(), now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()].map(n => String(n).padStart(2, '0'))
dateSymbols.forEach((symbol, i) => { path = path.replace(symbol, symbolReplacements[i]) })
return path
}
@@ -163,7 +162,6 @@ function files2streams (files) {
function quickUploadOptions (state, emit) {
const onExpandOptions = (e) => { state.expandOptions = true; emit('render') }
- const onWrapWithDirectoryChange = (e) => { state.wrapWithDirectory = e.target.checked }
const onDirectoryChange = (e) => { state.userChangedUploadDir = true; state.uploadDir = e.target.value }
const onOpenViaWebUIChange = (e) => { state.openViaWebUI = e.target.checked }
const displayOpenWebUI = state.ipfsNodeType !== 'embedded'
@@ -171,11 +169,6 @@ function quickUploadOptions (state, emit) {
if (state.expandOptions) {
return html`
-
${displayOpenWebUI ? html`
` : null}
-
`
From 05ac606d6ac45c664de78f12e4f5359981455524 Mon Sep 17 00:00:00 2001
From: colinfruit <17092461+colinfruit@users.noreply.github.com>
Date: Tue, 26 Nov 2019 18:45:43 -0500
Subject: [PATCH 21/28] trim double slashes from import directory
---
add-on/src/popup/quick-upload.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/add-on/src/popup/quick-upload.js b/add-on/src/popup/quick-upload.js
index 692d77617..b5f8d3a73 100644
--- a/add-on/src/popup/quick-upload.js
+++ b/add-on/src/popup/quick-upload.js
@@ -134,6 +134,8 @@ function file2buffer (file) {
function formatImportDirectory (path) {
path = path.replace(/\/$|$/, '/')
+ path = path.replace(/(\/)\/+/g, '$1')
+
// needed to handle date symbols in the import directory
const now = new Date()
const dateSymbols = [/%Y/g, /%M/g, /%D/g, /%h/g, /%m/g, /%s/g]
From 31ebb13f3287e879927f19dcbdb461a467730d6f Mon Sep 17 00:00:00 2001
From: colinfruit <17092461+colinfruit@users.noreply.github.com>
Date: Tue, 26 Nov 2019 19:45:43 -0500
Subject: [PATCH 22/28] add file import section on options page
---
add-on/_locales/en/messages.json | 6 +++-
add-on/src/options/forms/experiments-form.js | 21 -----------
add-on/src/options/forms/file-import-form.js | 38 ++++++++++++++++++++
add-on/src/options/page.js | 6 +++-
4 files changed, 48 insertions(+), 23 deletions(-)
create mode 100644 add-on/src/options/forms/file-import-form.js
diff --git a/add-on/_locales/en/messages.json b/add-on/_locales/en/messages.json
index 8817d7394..0dcd79f82 100644
--- a/add-on/_locales/en/messages.json
+++ b/add-on/_locales/en/messages.json
@@ -215,6 +215,10 @@
"message": "IPFS Node",
"description": "A section header on the Preferences screen (option_header_nodeType)"
},
+ "option_header_fileImport": {
+ "message": "File Import",
+ "description": "A section header on the Preferences screen (option_header_fileImport)"
+ },
"option_ipfsNodeType_title": {
"message": "IPFS Node Type",
"description": "An option title on the Preferences screen (option_ipfsNodeType_title)"
@@ -432,7 +436,7 @@
"description": "An option title on the Preferences screen (option_importDir_title)"
},
"option_importDir_description": {
- "message": "Customize the directory used for uploading files to MFS.",
+ "message": "Customize the directory used for imported files.",
"description": "An option description on the Preferences screen (option_importDir_description)"
},
"option_resetAllOptions_title": {
diff --git a/add-on/src/options/forms/experiments-form.js b/add-on/src/options/forms/experiments-form.js
index 92ab1a516..6c1d95376 100644
--- a/add-on/src/options/forms/experiments-form.js
+++ b/add-on/src/options/forms/experiments-form.js
@@ -15,7 +15,6 @@ function experimentsForm ({
detectIpfsPathHeader,
ipfsProxy,
logNamespaces,
- importDir,
onOptionChange,
onOptionsReset
}) {
@@ -154,26 +153,6 @@ function experimentsForm ({
onchange=${onOptionChange('logNamespaces')}
value=${logNamespaces} />