UNPKG

stremio-addon-sdk

Version:

An SDK for making and publishing Stremio add-ons

18 lines (15 loc) 510 B
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 }) }