|
@@ -23,10 +23,11 @@ async function initialize() {
|
|
|
const node = await IPFS.create();
|
|
|
const node_info = await node.id();
|
|
|
console.log('ipfs node id: ' + node_info.id);
|
|
|
+ const pinList = document.createElement('ul');
|
|
|
const fileReader = new FileReader();
|
|
|
fileReader.onload = async function() {
|
|
|
const pin = await node.add(fileReader.result);
|
|
|
- console.log("https://ipfs.io/ipfs/" + pin.cid.toString());
|
|
|
+ pinList.appendChild(create_pin_tag(node, pin.cid));
|
|
|
};
|
|
|
const fileSelector = document.createElement('input');
|
|
|
fileSelector.type = 'file';
|
|
@@ -34,7 +35,6 @@ async function initialize() {
|
|
|
fileReader.readAsBinaryString(fileSelector.files[0]);
|
|
|
};
|
|
|
document.body.appendChild(fileSelector);
|
|
|
- const pinList = document.createElement('ul');
|
|
|
for await(const { cid, type } of node.pin.ls()) {
|
|
|
if(type != 'indirect') {
|
|
|
pinList.appendChild(create_pin_tag(node, cid));
|