1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-22 16:17:29 +00:00

Disable feed validation, add setting to enable

This commit is contained in:
Cadence Fish 2020-02-18 20:42:36 +13:00
parent 6d7e089dae
commit 21ec920516
No known key found for this signature in database
GPG Key ID: 81015DF9AA8607E1
4 changed files with 14 additions and 11 deletions

View File

@ -24,7 +24,8 @@ let constants = {
allow_user_from_reel: "preferForRSS", // one of: "never", "fallback", "prefer", "onlyPreferSaved", "preferForRSS" allow_user_from_reel: "preferForRSS", // one of: "never", "fallback", "prefer", "onlyPreferSaved", "preferForRSS"
settings: { settings: {
rss_enabled: true rss_enabled: true,
display_feed_validation_buttons: false
}, },
caching: { caching: {

View File

@ -58,7 +58,8 @@ module.exports = [
if (typeof page === "number" && !isNaN(page) && page >= 1) { if (typeof page === "number" && !isNaN(page) && page >= 1) {
await user.timeline.fetchUpToPage(page - 1) await user.timeline.fetchUpToPage(page - 1)
} }
return render(200, "pug/user.pug", {url, user, constants, website_origin: constants.website_origin}) const {website_origin, settings: {display_feed_validation_buttons}} = constants
return render(200, "pug/user.pug", {url, user, constants, website_origin, display_feed_validation_buttons})
}).catch(error => { }).catch(error => {
if (error === constants.symbols.NOT_FOUND || error === constants.symbols.ENDPOINT_OVERRIDDEN) { if (error === constants.symbols.NOT_FOUND || error === constants.symbols.ENDPOINT_OVERRIDDEN) {
return render(404, "pug/friendlyerror.pug", { return render(404, "pug/friendlyerror.pug", {

View File

@ -1,9 +1,10 @@
mixin feed_link(name, urlPart, username, contentType) mixin feed_link(name, urlPart, username, contentType, display_feed_validation_buttons)
span span
a(rel="alternate" type=contentType href=`/u/${username}/${urlPart}.xml`) a(rel="alternate" type=contentType href=`/u/${username}/${urlPart}.xml`)
= name = name
sup.validate-feed if display_feed_validation_buttons
- sup.validate-feed
let params = new URLSearchParams() -
params.set("url", `${website_origin}/u/${username}/${urlPart}.xml`) let params = new URLSearchParams()
a(href="https://validator.w3.org/feed/check.cgi?"+params.toString() title="Validate this feed") v! params.set("url", `${website_origin}/u/${username}/${urlPart}.xml`)
a(href="https://validator.w3.org/feed/check.cgi?"+params.toString() title="Validate this feed") v!

View File

@ -1,4 +1,4 @@
//- Needs user, url, constants, website_origin //- Needs user, url, constants, website_origin, display_feed_validation_buttons
include includes/timeline_page.pug include includes/timeline_page.pug
include includes/next_page_button.pug include includes/next_page_button.pug
@ -44,8 +44,8 @@ html
div.profile-counter #[span(data-numberformat=user.followedBy).count #{numberFormat(user.followedBy)}] followed by div.profile-counter #[span(data-numberformat=user.followedBy).count #{numberFormat(user.followedBy)}] followed by
div.links div.links
if constants.settings.rss_enabled if constants.settings.rss_enabled
+feed_link("RSS", "rss", user.data.username, "application/rss+xml") +feed_link("RSS", "rss", user.data.username, "application/rss+xml", display_feed_validation_buttons)
+feed_link("Atom", "atom", user.data.username, "application/atom+xml") +feed_link("Atom", "atom", user.data.username, "application/atom+xml", display_feed_validation_buttons)
a(rel="noreferrer noopener" href=`https://www.instagram.com/${user.data.username}`) instagram.com a(rel="noreferrer noopener" href=`https://www.instagram.com/${user.data.username}`) instagram.com
- const hasPosts = !user.data.is_private && user.timeline.pages.length && user.timeline.pages[0].length - const hasPosts = !user.data.is_private && user.timeline.pages.length && user.timeline.pages[0].length