no1b4me's picture
Upload 5037 files
95f4e64 verified
raw
history blame contribute delete
510 Bytes
const fetch = require('node-fetch')
const DEFAULT_API_URL = 'https://api.strem.io'
module.exports = function publishToCentral(addonURL, apiURL) {
apiURL = apiURL || DEFAULT_API_URL
return fetch(apiURL+'/api/addonPublish', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ transportUrl: addonURL, transportName: 'http' })
})
.then(function(res) { return res.json() })
.then(function(resp) {
if (resp.error) throw resp.error
return resp.result
})
}