-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: preserve file name, support sharing multiple files #479
Conversation
Implements #349 (for now only for external node)
This is a simple workaround that encourages factor-bundle to do a more even split that keeps .js files under 4MB limit.
Multiple files can be selected using Ctrl/Shift modifier.
"Preserve the filename when adding a single item" is good wording for the label, but it leads to the question, when would I not want that? I vote for just doing the right thing here (wrap) and not troubling the user with the decision, as per ipfs/ipfs-gui#15 (comment) I don't think wrapping by default would harm anyone here. "Recursively Pin added data"... I think we just do this for all data the user adds. I don't see any harm in doing this and not asking the user. |
@olizilla Yeah it may be just me 🙃, but I often share ephemeral images and text snippets that don't need a name (or have an ugly one that I'd have to change before sharing) nor persistence (I don't' care to keep it alive forever). I agree, the defaults are sane, but I really want to give power user an option to opt-out without need of using commandline, so I just collapsed them under a tiny |
@lidel ok well, you are our archetype power user, and if it helps you, then I'm for it. Collapsing it by default is a good idea, best of both. |
"Upload options" is good and clear. |
I'll give this a try now |
@lidel i'll see if I can track down why the labels are missing on chrome. |
@lidel ah, the chrome label issue went away after a rebuild. meh. Now the labels are hidden by default, I'm thinking they can be more informative like
|
Switched to pure CSS checkmark that should look the same everywhere, updated labels. @olizilla please check if it does not 🔥 on mac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 minor tweaks and good to go. One query about the file opener loop.
add-on/src/lib/ipfs-companion.js
Outdated
'url': url | ||
}) | ||
console.info('[ipfs-companion] successfully stored', path) | ||
console.log('uploadResultHandler.file-' + result.indexOf(file), file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug logging or add [ipfs-companion]
prefix
add-on/src/lib/ipfs-companion.js
Outdated
console.log('uploadResultHandler.file-' + result.indexOf(file), file) | ||
// open the wrapping directory (or the CID if wrapping was disabled) | ||
if (result.length === 1 || file.path === '' || file.path === file.hash) { | ||
await browser.tabs.create({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected behaviour here? If i add a single file and let it be wrapped, I'm seeing it open the directory not the file. If i add multiple, it shows the directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct.
If wrapping is enabled or you are uploading more than one file, it will always open wrapping directory (the default).
If wrapping is disabled and a single file is uploaded, it will be opened directly. (requires explicit opt-in from user via upload options).
I feel it is a good default for now:
- Most of users want to keep file names and as a side effect will get a branded directory listing provided by gateway
(Until we integrate ideas from https://github.com/tableflip/share-via-ipfs via separate PRs) - Uploaded file can be a
.zip
file and browser can't show that.
(Opening the file itself will just close the tab and start the download, which makes it difficult for user to copy the URL) - Mobile users are not forced to download the data, they just get directory listing and decide what do do with it (open the specific file, copy link to directory, copy direct link to file etc)
add-on/src/popup/quick-upload.js
Outdated
` | ||
} | ||
return html` | ||
<button class='f6 link dim bn bg-transparent moon-gray dib pa0 pointer ma0' style='color: #6ACAD1' onclick=${onExpandOptions}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an mt3
here to get the same vertical space when the button transitions to the options.
This PR implements #349 by switching to the latest
js-ipfs-api
which enables support forwrapWithDirectory
option inipfs.files.add
.UI Preview
I did not want to do a redesign so just added options at the bottom:
Not sure if these labels are clear enough, any suggestions?
TODO before merge
Add
Fix
FILE_TOO_LARGE
error frommozilla/addons-linter
caused by the size of the latestjs-ipfs-api
Optional (can be a separate PR)