diff --git a/config.js b/config.js index 98c4341..c90d641 100644 --- a/config.js +++ b/config.js @@ -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" }, diff --git a/helpers/fetch-metadata.js b/helpers/fetch-metadata.js index fa24704..f5b07ba 100644 --- a/helpers/fetch-metadata.js +++ b/helpers/fetch-metadata.js @@ -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", diff --git a/helpers/upload-image.js b/helpers/upload-image.js index 7cb00a5..25dd75b 100644 --- a/helpers/upload-image.js +++ b/helpers/upload-image.js @@ -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); }); diff --git a/server.js b/server.js index 6224cdd..3801d81 100755 --- a/server.js +++ b/server.js @@ -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 => { diff --git a/views/partials/edit-link.js b/views/partials/edit-link.js index b92d967..d2755db 100644 --- a/views/partials/edit-link.js +++ b/views/partials/edit-link.js @@ -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: