-
Notifications
You must be signed in to change notification settings - Fork 324
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
Add pin function #29
Add pin function #29
Conversation
@@ -8,6 +8,7 @@ var cm = require('sdk/context-menu'); | |||
var prefs = require('sdk/simple-prefs').prefs; | |||
var ioservice = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService); | |||
var gui = require('./gui.js'); | |||
var tabs = require("sdk/tabs"); |
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.
We probably want single quotes here:
https://travis-ci.org/lidel/ipfs-firefox-addon/jobs/96923547#L790
:)
Thanks! Looks very good, feel free to work on it 👍 My thoughts:
|
FYI I merged other pull request (#28) and you probably will need to rebase your changes on top of current master. |
function pin(address) { | ||
let IPFS_API_URI = 'http://' + prefs.customGatewayHost + ':5001/api/v0'; | ||
let uri = ioservice.newURI(IPFS_API_URI+'/pin/add?arg='+address, null, null); | ||
tabs.open(uri.spec); |
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.
I think opening this in a Sidebar would be less-intrusive for a user (as a quick UX fix).
Ideally, we would want to parse the response and display some kind of notification instead.
As for the ToggleButton improvements, this is what I have in mind: The popup panel would have all items from the context menu (copy link, pin resource etc) + on/off switch for entire plugin (current onClick behaviour). |
Closing this one, will continue in #30 |
Please do not merge this, I just opened this to start a discussion. We could come up with a much better ux for pinning / unpinning I think:
All of these require better code:
And probably want to not hard-code the :5001 port for the daemon (make it the default, allow for override like for the gateway)
Anyway, is this a feature people would like me to work on more?