|
|
@ -11,6 +11,7 @@ const VenueChannelStatus = mongoose.model('VenueChannelStatus'); |
|
|
|
|
|
|
|
const https = require('https'); |
|
|
|
const fetch = require('node-fetch'); // jshint ignore:line
|
|
|
|
const UserAgent = require('user-agents'); |
|
|
|
|
|
|
|
const striptags = require('striptags'); |
|
|
|
const slug = require('slug'); |
|
|
@ -32,6 +33,7 @@ class VenueService extends SiteService { |
|
|
|
this.httpsAgent = new https.Agent({ |
|
|
|
rejectUnauthorized: false, |
|
|
|
}); |
|
|
|
this.userAgent = new UserAgent(); |
|
|
|
|
|
|
|
this.populateVenueChannel = [ |
|
|
|
{ |
|
|
@ -192,6 +194,10 @@ class VenueService extends SiteService { |
|
|
|
this.log.info('fetching Shing channel feed', { slug: channel.slug, requestUrl }); |
|
|
|
const response = await fetch(requestUrl, { |
|
|
|
agent: this.httpsAgent, |
|
|
|
headers: { |
|
|
|
'user-agent': this.userAgent.toString(), |
|
|
|
'Accept-Language': 'en-US', |
|
|
|
}, |
|
|
|
}); |
|
|
|
if (!response.ok) { |
|
|
|
throw new SiteError(500, `Failed to fetch Shing channel feed: ${response.statusText}`); |
|
|
@ -209,7 +215,13 @@ class VenueService extends SiteService { |
|
|
|
const requestUrl = `https://${this.soapboxDomain}/channel/${channel.slug}/status`; |
|
|
|
this.log.info('fetching Shing channel status', { slug: channel.slug, requestUrl }); |
|
|
|
|
|
|
|
const response = await fetch(requestUrl, { agent: this.httpsAgent }); |
|
|
|
const response = await fetch(requestUrl, { |
|
|
|
agent: this.httpsAgent, |
|
|
|
headers: { |
|
|
|
'user-agent': this.userAgent.toString(), |
|
|
|
'Accept-Language': 'en-US', |
|
|
|
}, |
|
|
|
}); |
|
|
|
if (!response.ok) { |
|
|
|
throw new SiteError(500, `Failed to fetch channel status: ${response.statusText}`); |
|
|
|
} |
|
|
|