Image uploads work and this closes #135
This commit is contained in:
parent
7fce2c7873
commit
801068f200
5 changed files with 18 additions and 20 deletions
|
@ -5,7 +5,7 @@
|
|||
module.exports = exports = {
|
||||
ga: "UA-60403362-1",
|
||||
github: {
|
||||
branch: "new",
|
||||
branch: "master",
|
||||
linkText: "Edit this page on GitHub",
|
||||
repo: "lbryio/lbry.tech"
|
||||
},
|
||||
|
|
|
@ -58,17 +58,17 @@ module.exports = exports = (data, socket) => {
|
|||
|
||||
body.bid = 0.001; // Hardcoded publish amount
|
||||
body.description = dataDetails.description;
|
||||
body.file_path = process.env.LBRY_DAEMON_IMAGES_PATH + dataDetails.file_path; // TODO: Fix the internal image path in daemon (original comment, check to see if still true)
|
||||
body.file_path = dataDetails.file_path; // just base64 string
|
||||
body.language = dataDetails.language;
|
||||
body.license = dataDetails.license;
|
||||
body.name = dataDetails.name.replace(/\s/g, "") + randomString(10);
|
||||
body.nsfw = dataDetails.nsfw;
|
||||
body.title = dataDetails.title;
|
||||
|
||||
// TODO: Forget all this and upload to spee.ch
|
||||
|
||||
return uploadImage(body.file_path).then(uploadResponse => {
|
||||
if (uploadResponse.status !== "ok") return;
|
||||
// if (uploadResponse.status !== "ok") return;
|
||||
// console.log("————— RESPONSE");
|
||||
// console.log(uploadResponse);
|
||||
|
||||
body.file_path = uploadResponse.filename;
|
||||
body.filename = uploadResponse.filename;
|
||||
|
@ -77,8 +77,8 @@ module.exports = exports = (data, socket) => {
|
|||
// https://github.com/lbryio/lbry.tech/blob/legacy/content/.vuepress/components/Tour/Step2.vue
|
||||
// https://github.com/lbryio/lbry.tech/blob/legacy/server.js
|
||||
}).catch(uploadError => {
|
||||
// component.isLoading = false;
|
||||
// component.jsonData = JSON.stringify(uploadError, null, " ");
|
||||
// console.log("————— ERROR");
|
||||
// console.log(uploadError);
|
||||
|
||||
socket.send(JSON.stringify({
|
||||
"details": "Image upload failed",
|
||||
|
|
|
@ -10,19 +10,17 @@ const request = require("request-promise-native");
|
|||
|
||||
// E X P O R T
|
||||
|
||||
module.exports = exports = imageSource => new Promise((resolve, reject) => {
|
||||
request({
|
||||
body: imageSource,
|
||||
headers: {
|
||||
"Content-Type": "text/plain"
|
||||
module.exports = exports = imageSource => new Promise((resolve, reject) => { // eslint-disable-line
|
||||
return request({
|
||||
body: {
|
||||
authorization: process.env.LBRY_DAEMON_ACCESS_TOKEN,
|
||||
image: imageSource
|
||||
},
|
||||
method: "PUT",
|
||||
qs: {
|
||||
access_token: process.env.LBRY_DAEMON_ACCESS_TOKEN
|
||||
},
|
||||
url: "http://daemon.lbry.tech/images.php"
|
||||
json: true,
|
||||
method: "POST",
|
||||
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200/image" : "https://daemon.lbry.tech/image" }`
|
||||
}, (error, response, body) => {
|
||||
if (error) reject(error);
|
||||
if (error) resolve(error);
|
||||
body = JSON.parse(body);
|
||||
resolve(body);
|
||||
});
|
||||
|
|
|
@ -223,7 +223,7 @@ function generateMemeCreator(socket) {
|
|||
body: { authorization: "hi" },
|
||||
json: true,
|
||||
method: "GET",
|
||||
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200" : "http://daemon.lbry.tech"}`
|
||||
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200" : "https://daemon.lbry.tech"}`
|
||||
}).then(body => {
|
||||
console.log(body);
|
||||
}).catch(welp => {
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = exports = pagePath => {
|
|||
break;
|
||||
|
||||
case "/tour":
|
||||
githubUrl = `${githubUrl}/views/pages/tour.js`;
|
||||
githubUrl = `${githubUrl}/views/partials/tour.js`;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue