Skip to content

Commit

Permalink
refactor: replace upload with import terminology (#829)
Browse files Browse the repository at this point in the history
* language: replace upload with import terminology
* update privacy policy language and last updated date

Following up on the changes made in #810. 
This replaces references to `upload` with `import` 

Closes #817
  • Loading branch information
colinfruit authored and lidel committed Dec 11, 2019
1 parent ed36f4e commit 9730b81
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 72 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ The Browser Action pop-up provides handy toggles for often used operations.
### IPFS Status and Context Actions

- IPFS API and Gateway status
- Add local (quick upload) or remote files (context menu) to IPFS with option to preserve filename
- Add local (quick import) or remote files (context menu) to IPFS with option to preserve filename
- Easy access to [WebUI](https://github.com/ipfs/webui/) and add-on Preferences
- Toggle redirection to local gateway (automatic by default, manual mode can be enabled in Preferences)
- Additional actions for pages loaded from IPFS
Expand Down Expand Up @@ -226,7 +226,7 @@ We are also available at the [#ipfs](https://webchat.freenode.net/?channels=ipfs

Questions specific to this browser companion can be asked directly at [`#ipfs-in-web-browsers`](https://webchat.freenode.net/?channels=ipfs-in-web-browsers)

#### Upload via Right-Click Does Not Work in Firefox
#### Import via Right-Click Does Not Work in Firefox

See [this workaround](https://github.com/ipfs/ipfs-companion/issues/227).

Expand Down
52 changes: 26 additions & 26 deletions add-on/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"message": "The number of other IPFS nodes you can connect to",
"description": "A label tooltip in Node status section of Browser Action pop-up (panel_statusSwarmPeersTitle)"
},
"panel_quickUpload": {
"panel_quickImport": {
"message": "Share files via IPFS",
"description": "A menu item in Browser Action pop-up (panel_quickUpload)"
"description": "A menu item in Browser Action pop-up (panel_quickImport)"
},
"panel_openWebui": {
"message": "Open Web UI",
Expand Down Expand Up @@ -183,13 +183,13 @@
"message": "Automatic Mode: Public Gateway will be used as a fallback",
"description": "A message in system notification (notify_apiOfflineAutomaticModeMsg)"
},
"notify_uploadErrorTitle": {
"message": "Unable to upload via IPFS API",
"description": "A title of system notification (notify_uploadErrorTitle)"
"notify_importErrorTitle": {
"message": "Unable to import via IPFS API",
"description": "A title of system notification (notify_importErrorTitle)"
},
"notify_uploadTrackingProtectionErrorMsg": {
"notify_importTrackingProtectionErrorMsg": {
"message": "Try disabling Tracking Protection (press ctrl+shift+j for more details)",
"description": "(notify_uploadTrackingProtectionErrorMsg)"
"description": "(notify_importTrackingProtectionErrorMsg)"
},
"notify_inlineMsg": {
"message": "$1",
Expand Down Expand Up @@ -491,41 +491,41 @@
"message": "Browser extension that simplifies access to IPFS resources",
"description": "Extension description in the Manifest file (manifest_extensionDescription)"
},
"quickUpload_subhead_peers": {
"quickImport_subhead_peers": {
"message": "Connected to $1 peers",
"description": "Partial info stats beneath the header on the share files page (quickUpload_subhead_peers)"
"description": "Partial info stats beneath the header on the share files page (quickImport_subhead_peers)"
},
"quickUpload_pick_file_button": {
"quickImport_pick_file_button": {
"message": "Pick a file",
"description": "Text on the 'pick a file' button (quickUpload_pick_file_button)"
"description": "Text on the 'pick a file' button (quickImport_pick_file_button)"
},
"quickUpload_or": {
"quickImport_or": {
"message": "or",
"description": "seperates the pick a file button from the drop message (quickUpload_or)"
"description": "seperates the pick a file button from the drop message (quickImport_or)"
},
"quickUpload_drop_it_here": {
"quickImport_drop_it_here": {
"message": "drop it here to share",
"description": "Partial info stats beneath the header on the share files page (quickUpload_drop_it_here)"
"description": "Partial info stats beneath the header on the share files page (quickImport_drop_it_here)"
},
"quickUpload_state_uploading": {
"message": "Upload in progress..",
"description": "Status label on the share files page (quickUpload_state_uploading)"
"quickImport_state_importing": {
"message": "Import in progress..",
"description": "Status label on the share files page (quickImport_state_importing)"
},
"quickUpload_state_buffering": {
"quickImport_state_buffering": {
"message": "(buffering, please wait)",
"description": "Status label on the share files page (quickUpload_state_buffering)"
"description": "Status label on the share files page (quickImport_state_buffering)"
},
"quickUpload_options_show": {
"quickImport_options_show": {
"message": "import options",
"description": "Button on the share files page (quickUpload_options_show)"
"description": "Button on the share files page (quickImport_options_show)"
},
"quickUpload_options_importDir": {
"quickImport_options_importDir": {
"message": "Path to store imported files",
"description": "Textbox label on the share files page (quickUpload_options_importDir)"
"description": "Textbox label on the share files page (quickImport_options_importDir)"
},
"quickUpload_options_openViaWebUI": {
"quickImport_options_openViaWebUI": {
"message": "Open in Web UI",
"description": "Checkbox label on the share files page (quickUpload_options_openViaWebUI)"
"description": "Checkbox label on the share files page (quickImport_options_openViaWebUI)"
},
"page_proxyAcl_title": {
"message": "Manage Permissions",
Expand Down
10 changes: 5 additions & 5 deletions add-on/src/lib/ipfs-companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ module.exports = async function init () {
}
}

// Context Menu Uploader
// Context Menu Importer
// -------------------------------------------------------------------

async function onAddFromContext (context, contextType, options) {
Expand Down Expand Up @@ -307,15 +307,15 @@ module.exports = async function init () {
result = await ipfsImportHandler.importFiles(data, options, importDir)
}
} catch (error) {
console.error('Error in upload to IPFS context menu', error)
console.error('Error in import to IPFS context menu', error)
if (error.message === 'NetworkError when attempting to fetch resource.') {
notify('notify_uploadErrorTitle', 'notify_uploadTrackingProtectionErrorMsg')
console.warn('IPFS upload often fails because remote file can not be downloaded due to Tracking Protection. See details at: https://github.com/ipfs/ipfs-companion/issues/227')
notify('notify_importErrorTitle', 'notify_importTrackingProtectionErrorMsg')
console.warn('IPFS import often fails because remote file can not be downloaded due to Tracking Protection. See details at: https://github.com/ipfs/ipfs-companion/issues/227')
browser.tabs.create({
url: 'https://github.com/ipfs/ipfs-companion/issues/227'
})
} else {
notify('notify_uploadErrorTitle', 'notify_inlineErrorMsg', `${error.message}`)
notify('notify_importErrorTitle', 'notify_inlineErrorMsg', `${error.message}`)
}
return
}
Expand Down
4 changes: 2 additions & 2 deletions add-on/src/popup/browser-action/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function browserActionPage (state, emit) {
const onPin = () => emit('pin')
const onUnPin = () => emit('unPin')

const onQuickUpload = () => emit('quickUpload')
const onQuickImport = () => emit('quickImport')
const onOpenWebUi = () => emit('openWebUi')
const onOpenPrefs = () => emit('openPrefs')
const onToggleGlobalRedirect = () => emit('toggleGlobalRedirect')
Expand All @@ -25,7 +25,7 @@ module.exports = function browserActionPage (state, emit) {

const headerProps = Object.assign({ onToggleActive, onOpenPrefs }, state)
const activeTabActionsProps = Object.assign({ onViewOnGateway, onToggleSiteRedirect, onCopy, onPin, onUnPin }, state)
const opsProps = Object.assign({ onQuickUpload, onOpenWebUi, onToggleGlobalRedirect }, state)
const opsProps = Object.assign({ onQuickImport, onOpenWebUi, onToggleGlobalRedirect }, state)

return html`
<div class="sans-serif" style="text-rendering: optimizeLegibility;">
Expand Down
6 changes: 3 additions & 3 deletions add-on/src/popup/browser-action/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ module.exports = (state, emitter) => {
}
}

emitter.on('quickUpload', () => {
browser.tabs.create({ url: browser.extension.getURL('dist/popup/quick-upload.html') })
emitter.on('quickImport', () => {
browser.tabs.create({ url: browser.extension.getURL('dist/popup/quick-import.html') })
window.close()
})

Expand Down Expand Up @@ -254,7 +254,7 @@ module.exports = (state, emitter) => {
} else {
state.gatewayAddress = status.pubGwURLString
}
// Upload requires access to the background page (https://github.com/ipfs-shipyard/ipfs-companion/issues/477)
// Import requires access to the background page (https://github.com/ipfs-shipyard/ipfs-companion/issues/477)
state.isApiAvailable = state.active && !!(await getBackgroundPage()) && !browser.extension.inIncognitoContext // https://github.com/ipfs-shipyard/ipfs-companion/issues/243
state.swarmPeers = !state.active || status.peerCount === -1 ? null : status.peerCount
state.isIpfsOnline = state.active && status.peerCount > -1
Expand Down
10 changes: 5 additions & 5 deletions add-on/src/popup/browser-action/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ module.exports = function tools ({
ipfsNodeType,
isIpfsOnline,
isApiAvailable,
onQuickUpload,
onQuickImport,
onOpenWebUi
}) {
const activeQuickUpload = active && isIpfsOnline && isApiAvailable
const activeQuickImport = active && isIpfsOnline && isApiAvailable
const activeWebUI = active && isIpfsOnline && ipfsNodeType !== 'embedded'

return html`
<div>
${navHeader('panel_toolsSectionHeader')}
<div class="fade-in pv1 bb b--black-10">
${navItem({
text: browser.i18n.getMessage('panel_quickUpload'),
text: browser.i18n.getMessage('panel_quickImport'),
style: 'b',
disabled: !activeQuickUpload,
onClick: onQuickUpload
disabled: !activeQuickImport,
onClick: onQuickImport
})}
${navItem({
text: browser.i18n.getMessage('panel_openWebui'),
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="quick-upload.css">
<link rel="stylesheet" href="quick-import.css">
</head>

<body>
<div id="root"></div>
<script src="/dist/bundles/uiCommons.bundle.js"></script>
<script src="/dist/bundles/uploadPage.bundle.js"></script>
<script src="/dist/bundles/importPage.bundle.js"></script>
</body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const logo = require('./logo')
const drop = require('drag-and-drop-files')
const fileReaderPullStream = require('pull-file-reader')

document.title = browser.i18n.getMessage('panel_quickUpload')
document.title = browser.i18n.getMessage('panel_quickImport')

const app = choo()

app.use(quickUploadStore)
app.route('*', quickUploadPage)
app.use(quickImportStore)
app.route('*', quickImportPage)
app.mount('#root')

function quickUploadStore (state, emitter) {
function quickImportStore (state, emitter) {
state.message = ''
state.peerCount = ''
state.ipfsNodeType = 'external'
Expand Down Expand Up @@ -71,7 +71,7 @@ async function processFiles (state, emitter, files) {
}
const { ipfsCompanion } = await browser.runtime.getBackgroundPage()
const ipfsImportHandler = ipfsCompanion.ipfsImportHandler
const uploadTab = await browser.tabs.getCurrent()
const importTab = await browser.tabs.getCurrent()
const streams = files2streams(files)
emitter.emit('render')
const options = {
Expand All @@ -85,7 +85,7 @@ async function processFiles (state, emitter, files) {
result = await ipfsImportHandler.importFiles(streams, options, importDir)
} catch (err) {
console.error('Failed to import files to IPFS', err)
ipfsCompanion.notify('notify_uploadErrorTitle', 'notify_inlineErrorMsg', `${err.message}`)
ipfsCompanion.notify('notify_importErrorTitle', 'notify_inlineErrorMsg', `${err.message}`)
throw err
}
state.progress = 'Completed'
Expand All @@ -100,11 +100,11 @@ async function processFiles (state, emitter, files) {
} else {
await ipfsImportHandler.openFilesAtWebUI(importDir)
}
// close upload tab as it will be replaced with a new tab with uploaded content
await browser.tabs.remove(uploadTab.id)
// close import tab as it will be replaced with a new tab with imported content
await browser.tabs.remove(importTab.id)
} catch (err) {
console.error('Unable to perform import', err)
// keep upload tab and display error message in it
// keep import tab and display error message in it
state.message = 'Unable to import to IPFS:'
state.progress = `${err}`
emitter.emit('render')
Expand Down Expand Up @@ -139,22 +139,22 @@ function files2streams (files) {
return streams
}

function quickUploadOptions (state, emit) {
function quickImportOptions (state, emit) {
const onExpandOptions = (e) => { state.expandOptions = true; emit('render') }
const onDirectoryChange = (e) => { state.userChangedImportDir = true; state.importDir = e.target.value }
const onOpenViaWebUIChange = (e) => { state.userChangedOpenViaWebUI = true; state.openViaWebUI = e.target.checked }
const displayOpenWebUI = state.ipfsNodeType !== 'embedded'

if (state.expandOptions) {
return html`
<div id='quickUploadOptions' class='sans-serif mt3 f6 lh-copy light-gray no-user-select'>
<div id='quickImportOptions' class='sans-serif mt3 f6 lh-copy light-gray no-user-select'>
${displayOpenWebUI ? html`<label for='openViaWebUI' class='flex items-center db relative mt1 pointer'>
<input id='openViaWebUI' type='checkbox' onchange=${onOpenViaWebUIChange} checked=${state.openViaWebUI} />
<span class='mark db flex items-center relative mr2 br2'></span>
${browser.i18n.getMessage('quickUpload_options_openViaWebUI')}
${browser.i18n.getMessage('quickImport_options_openViaWebUI')}
</label>` : null}
<label for='importDir' class='flex items-center db relative mt1 pointer'>
${browser.i18n.getMessage('quickUpload_options_importDir')}
${browser.i18n.getMessage('quickImport_options_importDir')}
<span class='mark db flex items-center relative mr2 br2'></span>
<input id='importDir' class='w-40 bg-transparent aqua monospace br1 ba b--aqua pa2' type='text' oninput=${onDirectoryChange} value=${state.importDir} />
</label>
Expand All @@ -163,12 +163,12 @@ function quickUploadOptions (state, emit) {
}
return html`
<button class='mt3 f6 lh-copy link bn bg-transparent moon-gray dib pa0 pointer' style='color: #6ACAD1' onclick=${onExpandOptions}>
${browser.i18n.getMessage('quickUpload_options_show')} »
${browser.i18n.getMessage('quickImport_options_show')} »
</button>
`
}

function quickUploadPage (state, emit) {
function quickImportPage (state, emit) {
const onFileInputChange = (e) => emit('fileInputChange', e)
const { peerCount } = state

Expand All @@ -183,31 +183,31 @@ function quickUploadPage (state, emit) {
})}
<div class="pl3">
<h1 class="f2 fw5 ma0">
${browser.i18n.getMessage('panel_quickUpload')}
${browser.i18n.getMessage('panel_quickImport')}
</h1>
<p class="f3 fw2 lh-copy ma0 light-gray">
${browser.i18n.getMessage('quickUpload_subhead_peers', [peerCount])}
${browser.i18n.getMessage('quickImport_subhead_peers', [peerCount])}
</p>
</div>
</header>
<label for="quickUploadInput" class='db relative mt5 hover-inner-shadow pointer' style="border:solid 2px #6ACAD1">
<input class="db pointer w-100 h-100 top-0 o-0" type="file" id="quickUploadInput" multiple onchange=${onFileInputChange} />
<label for="quickImportInput" class='db relative mt5 hover-inner-shadow pointer' style="border:solid 2px #6ACAD1">
<input class="db pointer w-100 h-100 top-0 o-0" type="file" id="quickImportInput" multiple onchange=${onFileInputChange} />
<div class='dt dim' style='padding-left: 100px; height: 300px'>
<div class='dtc v-mid'>
<span class="f3 link dim br1 ph4 pv3 dib white" style="background: #6ACAD1">
${browser.i18n.getMessage('quickUpload_pick_file_button')}
${browser.i18n.getMessage('quickImport_pick_file_button')}
</span>
<span class='f3'>
<emph class='underline pl3 pr2 moon-gray'>
${browser.i18n.getMessage('quickUpload_or')}
${browser.i18n.getMessage('quickImport_or')}
</emph>
${browser.i18n.getMessage('quickUpload_drop_it_here')}
${browser.i18n.getMessage('quickImport_drop_it_here')}
</span>
<p class='f4 db'>${state.message}<span class='code db absolute fr pv2'>${state.progress}</span></p>
</div>
</div>
</label>
${quickUploadOptions(state, emit)}
${quickImportOptions(state, emit)}
</div>
</div>
`
Expand Down
4 changes: 2 additions & 2 deletions docs/privacy-policy.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# **IPFS Companion Privacy Policy**

<em>First Posted: 2019-02-15<br/>
Last Update: 2019-02-20</em> ([change history](https://github.com/ipfs-shipyard/ipfs-companion/commits/master/docs/privacy-policy.md))
Last Update: 2019-12-10</em> ([change history](https://github.com/ipfs-shipyard/ipfs-companion/commits/master/docs/privacy-policy.md))

The IPFS Companion browser extension is owned by Protocol Labs Inc. and created
by the IPFS Project. We know you care about how your personal data is used and
Expand Down Expand Up @@ -29,7 +29,7 @@ None. We don’t collect your Personal Data, period.
We do not collect, rent, store or sell your Personal Data to anyone. However
because IPFS Companion is a web extension that provides access to the real-time,
peer-to-peer IPFS Network (which is a public platform for which anyone may join
and participate) the data that you add or upload to the IPFS Network using IPFS
and participate) the data that you import to the IPFS Network using IPFS
Companion is then publicly available and accessible to everyone participating in
IPFS Network.

Expand Down
2 changes: 1 addition & 1 deletion test/functional/lib/ipfs-import.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { expect } = require('chai')
const { useFakeTimers } = require('sinon')
const browser = require('sinon-chrome')

describe('quick-upload.js', function () {
describe('ipfs-import.js', function () {
let createIpfsImportHandler
let ipfsImportHandler
let clock
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const uiConfig = merge(commonConfig, {
entry: {
browserAction: './add-on/src/popup/browser-action/index.js',
pageAction: './add-on/src/popup/page-action/index.js',
uploadPage: './add-on/src/popup/quick-upload.js',
importPage: './add-on/src/popup/quick-import.js',
optionsPage: './add-on/src/options/options.js',
proxyAclManagerPage: './add-on/src/pages/proxy-acl/index.js',
proxyAclDialog: './add-on/src/pages/proxy-access-dialog/index.js',
Expand Down

0 comments on commit 9730b81

Please sign in to comment.