|
@@ -5,10 +5,21 @@ const IPFS = require('ipfs');
|
|
|
|
|
|
function create_pin_tag(node, cid) {
|
|
|
const item = document.createElement('li');
|
|
|
- const link = document.createElement('a');
|
|
|
- link.href = "https://dweb.link/ipfs/" + cid.toString();
|
|
|
- link.innerText = cid.toString();
|
|
|
- item.appendChild(link);
|
|
|
+ // > If you can't decide between CIDv0 and CIDv1, consider choosing CIDv1
|
|
|
+ // > for your new project [...]. This is more future-proof and safe for use
|
|
|
+ // > in browser contexts.
|
|
|
+ // https://docs.ipfs.tech/concepts/content-addressing/#identifier-formats
|
|
|
+ Object.entries({
|
|
|
+ 'CID v1': cid.toV1().toString(),
|
|
|
+ 'CID v0': cid.toV0().toString(),
|
|
|
+ }).forEach(([label, cid_string]) => {
|
|
|
+ item.appendChild(document.createTextNode(label + ": "));
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = "https://ipfs.io/ipfs/" + cid_string;
|
|
|
+ link.innerText = cid_string.toString();
|
|
|
+ item.appendChild(link);
|
|
|
+ item.appendChild(document.createElement('br'));
|
|
|
+ });
|
|
|
const unpinButton = document.createElement('button');
|
|
|
unpinButton.innerText = 'unpin';
|
|
|
unpinButton.onclick = async function() {
|