Commit 55914991 authored by Melroy van den Berg's avatar Melroy van den Berg
Browse files

Do not use class members in async functions!

parent 1326d2d9
Pipeline #3224 passed with stage
in 9 seconds
......@@ -22,23 +22,18 @@ class RSSFeed {
/**
* Repair defaults
* @param {Object} lbry - LBRY object
* @param {String} URL - Feed URL
* @param {String} URL - Feed URL prefix
*/
constructor (lbry, URL) {
this.feedUrl = URL + '/channel/'
this.feedUrlPrefix = URL + '/channel'
this.lbry = lbry
this.feedOptions = {
description: 'Follow your LBRY channels using your favorite RSS reader!',
link: this.feedUrl,
generator: ' '
}
}
/**
* Retrieve the (RSS) Feed, based on a given channel
* @param {String} channelName - Name of the channel in LBRY
* @param {Boolean} useHttpsProtocol Use a website instead of the lbry:// protocol
* @param {String} httpURL eg. https://lbry.tv or https://odysee.com/
* @param {Boolean} useHttpsProtocol Use a website link instead of the lbry:// protocol in the links
* @param {String} httpURL eg. https://odysee.com
* @return Promose - Return a promise resolve (on the then), when we found items
*/
async getFeed (channelName, useHttpsProtocol, httpURL) {
......@@ -51,13 +46,18 @@ class RSSFeed {
// Replaces ':' with '#'
searchChannelName = searchChannelName.replace(':', '#')
const title = 'LBRY ' + searchChannelName + ' Channel Feed'
const odyseeLink = useHttpsProtocol ? 'odysee/' : ''
const options = this.feedOptions
options.title = title
options.link = this.feedUrl + odyseeLink + channelName
options.feedLinks = {
atom: this.feedUrl + odyseeLink + channelName + '/atom',
json: this.feedUrl + odyseeLink + channelName + '/json'
const odyseeUrlPart = useHttpsProtocol ? 'odysee/' : ''
const link = this.feedUrlPrefix + '/' + odyseeUrlPart + channelName
const options = {
title: title,
description: 'Follow your favorite LBRY channels using RSS!',
link: link,
feedLinks: {
atom: link + '/atom',
json: link + '/json'
},
generator: 'RSS LBRY Feed: https://gitlab.melroy.org/melroy/lbry-channel-feed'
}
const feed = new Feed(options)
const result = await this.lbry.search(searchChannelName)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment