get working

This commit is contained in:
Sean Yesmunt 2019-02-19 15:07:19 -05:00
parent 68e843dbc8
commit d1f56f40bc
3 changed files with 28 additions and 23 deletions

View file

@ -21,7 +21,7 @@
"electron-reload": "^1.2.5"
},
"lbrySettings": {
"lbrynetSDKVersion": "0.30.4",
"lbrynetSDKVersion": "0.32.1",
"lbrynetSDKUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vSDKVER/lbrynet-OSNAME.zip",
"lbrynetSDKDir": "dist/sdk",
"lbrynetSDKFileName": "lbrynet"

View file

@ -8,6 +8,10 @@
#resolve {
display: none;
}
img {
max-width: 600px;
}
</style>
<body>
<h1>Hello world</h1>

View file

@ -29,7 +29,7 @@ const imageWrapper = document.getElementById("image-wrapper");
resolveInput.addEventListener("input", e => {
const { value } = e.target;
const helpText = `Would resolve?? <b>lbry://${value}</b>`;
const helpText = `Would resolve <b>lbry://${value}</b>`;
help.innerHTML = helpText;
});
@ -41,32 +41,33 @@ resolveButton.addEventListener("click", () => {
}
claimData.innerText = "Loading...";
Lbry.resolve({ uri: `lbry://${value}` })
const url = `lbry://${value}`;
Lbry.resolve({ urls: url }) // This can be a list of urls
.then(res => {
claimData.innerText = JSON.stringify(res.claim, null, 2);
claimData.innerText = JSON.stringify(res[url].claim, null, 2);
})
.catch(error => {
claimData.innerText = JSON.stringify(error, null, 2);
});
});
getButton.addEventListener("click", () => {
const value = resolveInput.value;
if (!value) {
help.innerHTML = "You need to enter a name before getting the file.";
return;
}
// getButton.addEventListener("click", () => {
// const value = resolveInput.value;
// if (!value) {
// help.innerHTML = "You need to enter a name before getting the file.";
// return;
// }
claimData.innerText = "Loading...";
Lbry.get({ uri: `lbry://${value}` })
.then(res => {
// TODO: add simplest way to get an image and display it.
// Then add it to the page.
// claimData.innerText = "Loading...";
// Lbry.get({ uri: `lbry://${value}` })
// .then(res => {
// const filePath = res.download_path;
// const image = document.createElement("img");
// image.src = `${downloadDirectory}/${fileName}`
// image.src = filePath;
// imageWrapper.appendChild(image);
})
.catch(error => {
claimData.innerText = JSON.stringify(error, null, 2);
});
});
// claimData.innerText = null;
// })
// .catch(error => {
// claimData.innerText = JSON.stringify(error, null, 2);
// });
// });