File size: 510 Bytes
95f4e64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
		})
}