2018-08-18 00:22:19 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// P A C K A G E
|
|
|
|
|
2018-11-21 22:57:43 +01:00
|
|
|
const got = require("got");
|
|
|
|
|
|
|
|
// U T I L
|
|
|
|
|
|
|
|
const queryUrl = `${process.env.NODE_ENV === "development" ? "http://localhost:5200/publish" : `https://${process.env.DAEMON_URL}/publish`}`;
|
2018-08-18 00:22:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// E X P O R T
|
|
|
|
|
2018-11-21 22:57:43 +01:00
|
|
|
module.exports = exports = async(publishMetadata) => {
|
|
|
|
const options = {
|
|
|
|
body: {
|
|
|
|
authorization: process.env.LBRY_DAEMON_ACCESS_TOKEN,
|
|
|
|
metadata: publishMetadata
|
|
|
|
},
|
|
|
|
json: true,
|
|
|
|
method: "PUT"
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
|
|
|
const response = await got(queryUrl, options);
|
|
|
|
return response.body; // eslint-disable-line padding-line-between-statements
|
|
|
|
} catch (error) {
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
};
|