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" "electron-reload": "^1.2.5"
}, },
"lbrySettings": { "lbrySettings": {
"lbrynetSDKVersion": "0.30.4", "lbrynetSDKVersion": "0.32.1",
"lbrynetSDKUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vSDKVER/lbrynet-OSNAME.zip", "lbrynetSDKUrlTemplate": "https://github.com/lbryio/lbry/releases/download/vSDKVER/lbrynet-OSNAME.zip",
"lbrynetSDKDir": "dist/sdk", "lbrynetSDKDir": "dist/sdk",
"lbrynetSDKFileName": "lbrynet" "lbrynetSDKFileName": "lbrynet"

View file

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

View file

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