mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-10-31 21:47:29 +00:00
Show instance state on homepage
This commit is contained in:
parent
3108c68fd5
commit
4426c2f206
@ -32,6 +32,13 @@ class RequestHistory {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
testNoneBlocked() {
|
||||
for (const value of this.store.values()) {
|
||||
if (value.lastRequestSuccessful === false) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RequestHistory
|
||||
|
@ -1,9 +1,17 @@
|
||||
const constants = require("../../lib/constants")
|
||||
const {fetchUser, getOrFetchShortcode, requestCache} = require("../../lib/collectors")
|
||||
const {fetchUser, getOrFetchShortcode, requestCache, history} = require("../../lib/collectors")
|
||||
const {render, redirect} = require("pinski/plugins")
|
||||
const {pugCache} = require("../passthrough")
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
route: "/", methods: ["GET"], code: async () => {
|
||||
return render(200, "pug/home.pug", {
|
||||
rssEnabled: constants.settings.rss_enabled,
|
||||
allUnblocked: history.testNoneBlocked()
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
route: `/u`, methods: ["GET"], code: async ({url}) => {
|
||||
if (url.searchParams.has("u")) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
//- Needs rssEnabled, allUnblocked
|
||||
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
@ -31,6 +33,11 @@ html
|
||||
p.
|
||||
Bibliogram does #[em not] allow you to anonymously post, like, comment, follow, or view private profiles.
|
||||
It does not preserve deleted posts.
|
||||
h2 About this instance
|
||||
ul
|
||||
li Instance is #{allUnblocked ? "not blocked" : "blocked"}
|
||||
li RSS feeds are #{rssEnabled ? "enabled" : "disabled"}
|
||||
h2 External links
|
||||
ul.link-list
|
||||
-
|
||||
const links = [
|
||||
|
@ -1,5 +1,5 @@
|
||||
const {instance, pugCache, wss} = require("./passthrough")
|
||||
const {requestCache, timelineEntryCache} = require("../lib/collectors")
|
||||
const {requestCache, timelineEntryCache, history} = require("../lib/collectors")
|
||||
const constants = require("../lib/constants")
|
||||
const util = require("util")
|
||||
const repl = require("repl")
|
||||
|
@ -14,7 +14,6 @@ subdirs("pug", (err, dirs) => {
|
||||
//pinski.addRoute("/", "pug/index.pug", "pug")
|
||||
pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass")
|
||||
pinski.addPugDir("pug", dirs)
|
||||
pinski.addRoute("/", "pug/home.pug", "pug")
|
||||
pinski.addAPIDir("html/static/js/templates/api")
|
||||
pinski.addSassDir("sass")
|
||||
pinski.addAPIDir("api")
|
||||
|
Loading…
Reference in New Issue
Block a user