lbry.tech/app/helpers/publish-meme.js

34 lines
650 B
JavaScript
Raw Normal View History

2018-08-18 00:22:19 +02:00
"use strict";
// P A C K A G E
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
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;
}
};