mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-22 08:07:30 +00:00
Slightly improve blocked detection
This commit is contained in:
parent
ca1c965021
commit
8c8808e1dc
@ -16,6 +16,12 @@ class AssistantSwitcher {
|
||||
return this.assistants.filter(assistant => assistant.available()).sort((a, b) => (a.lastRequest - b.lastRequest))
|
||||
}
|
||||
|
||||
displaySomeUnblocked() {
|
||||
return this.assistants.some(assistant =>
|
||||
[constants.symbols.assistant_statuses.NONE, constants.symbols.assistant_statuses.OK].includes(assistant.lastRequestStatus)
|
||||
)
|
||||
}
|
||||
|
||||
requestUser(username) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const assistants = this.getAvailableAssistants()
|
||||
|
@ -1,6 +1,6 @@
|
||||
const constants = require("../../lib/constants")
|
||||
const switcher = require("../../lib/utils/torswitcher")
|
||||
const {fetchUser, getOrFetchShortcode, userRequestCache, history} = require("../../lib/collectors")
|
||||
const {fetchUser, getOrFetchShortcode, userRequestCache, history, assistantSwitcher} = require("../../lib/collectors")
|
||||
const {render, redirect, getStaticURL} = require("pinski/plugins")
|
||||
const {pugCache} = require("../passthrough")
|
||||
const {getSettings} = require("./utils/getsettings")
|
||||
@ -17,7 +17,7 @@ module.exports = [
|
||||
return render(200, "pug/home.pug", {
|
||||
settings,
|
||||
rssEnabled: constants.feeds.enabled,
|
||||
allUnblocked: history.testNoneBlocked(),
|
||||
allUnblocked: history.testNoneBlocked() || assistantSwitcher.displaySomeUnblocked(),
|
||||
torAvailable: switcher.canUseTor(),
|
||||
hasPrivacyPolicy: constants.has_privacy_policy
|
||||
})
|
||||
|
@ -41,7 +41,10 @@ html
|
||||
li: a(href="/privacy") Privacy policy
|
||||
else
|
||||
li Owner has not written a privacy policy
|
||||
li Instance is #{allUnblocked ? "not blocked" : "blocked"}
|
||||
if allUnblocked
|
||||
li Instance is not blocked
|
||||
else
|
||||
li: a(href="https://github.com/cloudrac3r/bibliogram/wiki/Rate-limits#working-around") Instance is partially blocked
|
||||
li RSS feeds are #{rssEnabled ? "enabled" : "disabled"}
|
||||
|
||||
h2 External links
|
||||
|
Loading…
Reference in New Issue
Block a user