1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-23 00:27:30 +00:00

Show instance state on homepage

This commit is contained in:
Cadence Fish 2020-02-01 21:17:10 +13:00
parent 3108c68fd5
commit 4426c2f206
No known key found for this signature in database
GPG Key ID: 81015DF9AA8607E1
5 changed files with 24 additions and 3 deletions

View File

@ -32,6 +32,13 @@ class RequestHistory {
} }
return result return result
} }
testNoneBlocked() {
for (const value of this.store.values()) {
if (value.lastRequestSuccessful === false) return false
}
return true
}
} }
module.exports = RequestHistory module.exports = RequestHistory

View File

@ -1,9 +1,17 @@
const constants = require("../../lib/constants") 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 {render, redirect} = require("pinski/plugins")
const {pugCache} = require("../passthrough") const {pugCache} = require("../passthrough")
module.exports = [ 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}) => { route: `/u`, methods: ["GET"], code: async ({url}) => {
if (url.searchParams.has("u")) { if (url.searchParams.has("u")) {

View File

@ -1,3 +1,5 @@
//- Needs rssEnabled, allUnblocked
doctype html doctype html
html html
head head
@ -31,6 +33,11 @@ html
p. p.
Bibliogram does #[em not] allow you to anonymously post, like, comment, follow, or view private profiles. Bibliogram does #[em not] allow you to anonymously post, like, comment, follow, or view private profiles.
It does not preserve deleted posts. 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 ul.link-list
- -
const links = [ const links = [

View File

@ -1,5 +1,5 @@
const {instance, pugCache, wss} = require("./passthrough") 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 constants = require("../lib/constants")
const util = require("util") const util = require("util")
const repl = require("repl") const repl = require("repl")

View File

@ -14,7 +14,6 @@ subdirs("pug", (err, dirs) => {
//pinski.addRoute("/", "pug/index.pug", "pug") //pinski.addRoute("/", "pug/index.pug", "pug")
pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass") pinski.addRoute("/static/css/main.css", "sass/main.sass", "sass")
pinski.addPugDir("pug", dirs) pinski.addPugDir("pug", dirs)
pinski.addRoute("/", "pug/home.pug", "pug")
pinski.addAPIDir("html/static/js/templates/api") pinski.addAPIDir("html/static/js/templates/api")
pinski.addSassDir("sass") pinski.addSassDir("sass")
pinski.addAPIDir("api") pinski.addAPIDir("api")