Redesign disabled feed system
This commit is contained in:
@@ -39,9 +39,36 @@ let constants = {
|
||||
|
||||
allow_user_from_reel: "preferForRSS", // one of: "never", "fallback", "prefer", "onlyPreferSaved", "preferForRSS"
|
||||
|
||||
feeds: {
|
||||
// Whether feeds are enabled.
|
||||
enabled: true,
|
||||
// Whether to display links to feeds on pages.
|
||||
display_links: true,
|
||||
// Whether to display the `v!` link to validate a feed.
|
||||
display_validation_links: false,
|
||||
// This feed message field allows you to insert a custom message into all RSS feeds to inform users of important changes,
|
||||
// such as feeds being disabled forever on that instance.
|
||||
feed_message: {
|
||||
enabled: false,
|
||||
// If the feed message is enabled, then `id` MUST be supplied.
|
||||
// Please set it to `bibliogram:feed_announcement/your.domain/1`
|
||||
// replacing `your.domain` with the address of your own domain,
|
||||
// and incrementing `1` every time you make a new announcement (to make sure the IDs are unique).
|
||||
id: "",
|
||||
// The timestamp that you disabled feeds at. For example, if you disabled feeds forever starting at 2020-04-01T12:00:00 UTC,
|
||||
// you should set this to 1585742400000.
|
||||
timestamp: 0,
|
||||
// The title of the feed item.
|
||||
title: "Important message from Bibliogram",
|
||||
// The text of the message.
|
||||
message: "There is an important message about feeds on this Bibliogram instance. Please visit this link to read the message: ",
|
||||
// The link address.
|
||||
link: "https://your.domain/feedannouncement"
|
||||
},
|
||||
feed_disabled_max_age: 2*24*60*60 // 2 days
|
||||
},
|
||||
|
||||
settings: {
|
||||
rss_enabled: true,
|
||||
display_feed_validation_buttons: false,
|
||||
enable_updater_page: false
|
||||
},
|
||||
|
||||
@@ -132,6 +159,8 @@ let constants = {
|
||||
}
|
||||
},
|
||||
|
||||
additional_routes: [],
|
||||
|
||||
database_version: 3
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ const config = require("../../../config")
|
||||
const TimelineEntry = require("./TimelineEntry")
|
||||
const InstaCache = require("../cache")
|
||||
const collectors = require("../collectors")
|
||||
const {getFeedSetup} = require("../utils/feed")
|
||||
require("../testimports")(constants, collectors, TimelineEntry, InstaCache)
|
||||
|
||||
/** @param {any[]} edges */
|
||||
@@ -55,24 +56,8 @@ class Timeline {
|
||||
}
|
||||
|
||||
async fetchFeed() {
|
||||
// we likely cannot use full_name here - reel fallback would make the feed title inconsistent, leading to confusing experience
|
||||
const usedName = `@${this.user.data.username}`
|
||||
const feed = new Feed({
|
||||
title: usedName,
|
||||
description: this.user.data.biography,
|
||||
id: `bibliogram:user/${this.user.data.username}`,
|
||||
link: `${constants.website_origin}/u/${this.user.data.username}`,
|
||||
feedLinks: {
|
||||
rss: `${constants.website_origin}/u/${this.user.data.username}/rss.xml`,
|
||||
atom: `${constants.website_origin}/u/${this.user.data.username}/atom.xml`
|
||||
},
|
||||
image: constants.website_origin+this.user.proxyProfilePicture,
|
||||
updated: new Date(this.user.cachedAt),
|
||||
author: {
|
||||
name: usedName,
|
||||
link: `${constants.website_origin}/u/${this.user.data.username}`
|
||||
}
|
||||
})
|
||||
const setup = getFeedSetup(this.user.data.username, this.user.data.biography, constants.website_origin+this.user.proxyProfilePicture, new Date(this.user.cachedAt))
|
||||
const feed = new Feed(setup)
|
||||
const page = this.pages[0] // only get posts from first page
|
||||
await Promise.all(page.map(item =>
|
||||
item.fetchFeedData().then(feedData => feed.addItem(feedData))
|
||||
|
||||
@@ -245,7 +245,7 @@ class TimelineEntry extends TimelineBaseMethods {
|
||||
Readers should display the description as HTML rather than using the media enclosure.
|
||||
enclosure: {
|
||||
url: this.data.display_url,
|
||||
type: "image/jpeg" //TODO: can instagram have PNGs? everything is JPEG according to https://medium.com/@autolike.it/how-to-avoid-low-res-thumbnails-on-instagram-android-problem-bc24f0ed1c7d
|
||||
type: "image/jpeg" // Instagram only has JPEGs as far as I can tell
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
23
src/lib/utils/feed.js
Normal file
23
src/lib/utils/feed.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const constants = require("../constants")
|
||||
|
||||
function getFeedSetup(username, description, image, updated) {
|
||||
const usedName = `@${username}`
|
||||
return {
|
||||
title: usedName,
|
||||
description,
|
||||
id: `bibliogram:user/${username}`,
|
||||
link: `${constants.website_origin}/u/${username}`,
|
||||
feedLinks: {
|
||||
rss: `${constants.website_origin}/u/${username}/rss.xml`,
|
||||
atom: `${constants.website_origin}/u/${username}/atom.xml`
|
||||
},
|
||||
image,
|
||||
updated,
|
||||
author: {
|
||||
name: usedName,
|
||||
link: `${constants.website_origin}/u/${username}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.getFeedSetup = getFeedSetup
|
||||
Reference in New Issue
Block a user