-
Notifications
You must be signed in to change notification settings - Fork 38
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
ipfs for image assets #173
Changes from 2 commits
89d8b88
bf5e478
b2a525c
49f7ab9
adb111a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,14 @@ emit = ($item, item) -> | |
$item.append "<img class=thumbnail src=\"#{item.url}\"> <p>#{resolve.resolveLinks(item.text)}</p>" | ||
|
||
bind = ($item, item) -> | ||
$item.dblclick -> editor.textEditor $item, item | ||
$item.find('img').dblclick -> dialog.open item.text, this | ||
$item.dblclick -> | ||
editor.textEditor $item, item | ||
url = item.url | ||
if item.ipfs? | ||
$.get "http://localhost:8080/ipfs/#{item.ipfs}", -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is likely to be slow. The Firefox plugin checks for the local gateway by polling it using the IPFS API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I initiate the get when the page is rendered. I don't expect a result until the user double-clicks to enlarge the image. If ipfs is slow one can try later, then it will be fast because images are stored in the local node. |
||
url = "http://localhost:8080/ipfs/#{item.ipfs}" | ||
$item.find('img').dblclick (event) -> | ||
event.stopPropagation() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This long-standing omission caused both dblclick handers to run. |
||
dialog.open item.text, "<img style=\"width:100%\" src=\"#{url}\">" | ||
|
||
module.exports = {emit, bind} |
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 wonder if this is the best way of doing this - surely if the item is stored on ipfs the
item.url
will be a gateway address! Worth looking at the browser IPFS gateway plugins for inspiration, the Firefox on looks for ULRs that match the patternhttps?://<public_gateway>/(ipfs|ipns)/$RESOURCE
where by default<public_gateway>
isipfs.io gateway.ipfs.io ipfs.pics
.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.
The item url will be for the postcard image, a dataurl. Folks who want nothing to do with ipfs will get the same old postcards they use to get. Those who like ipfs will run local nodes and get fabulous service unavailable from public gateways.