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",
|
2018-09-24 19:55:01 +02:00
|
|
|
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200/image" : `https://${process.env.DAEMON_URL}/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);
|
|
|
|
});
|
|
|
|
});
|