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

25 lines
567 B
JavaScript
Raw Normal View History

2018-08-18 00:22:19 +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-21 00:44:50 +02:00
module.exports = exports = publishMetadata => new Promise((resolve, reject) => request({ // eslint-disable-line
body: {
authorization: process.env.LBRY_DAEMON_ACCESS_TOKEN,
metadata: publishMetadata
},
json: true,
method: "PUT",
2018-09-24 19:55:01 +02:00
url: `${process.env.NODE_ENV === "development" ? "http://localhost:5200/publish" : `https://${process.env.DAEMON_URL}/publish` }`
2018-08-21 00:44:50 +02:00
}, (error, response, body) => {
if (error) resolve(error);
resolve(body);
}));