2018-08-08 01:15:34 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// P A C K A G E
|
|
|
|
|
|
|
|
const request = require("request-promise-native");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// E X P O R T
|
|
|
|
|
2018-08-16 22:43:49 +02:00
|
|
|
module.exports = exports = imageSource => new Promise((resolve, reject) => { // eslint-disable-line
|
|
|
|
return request({
|
|
|
|
body: {
|
|
|
|
authorization: process.env.LBRY_DAEMON_ACCESS_TOKEN,
|
|
|
|
image: imageSource
|
2018-08-08 01:15:34 +02:00
|
|
|
},
|
2018-08-16 22:43:49 +02:00
|
|
|
json: true,
|
|
|
|
method: "POST",
|
|
|
|
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200/image" : "https://daemon.lbry.tech/image" }`
|
2018-08-08 01:15:34 +02:00
|
|
|
}, (error, response, body) => {
|
2018-08-16 22:43:49 +02:00
|
|
|
if (error) resolve(error);
|
2018-08-08 01:15:34 +02:00
|
|
|
resolve(body);
|
|
|
|
});
|
|
|
|
});
|