mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2025-12-16 03:08:47 +00:00
Add Tor status to home and stats
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const constants = require("../../lib/constants")
|
||||
const switcher = require("../../lib/utils/torswitcher")
|
||||
const {fetchUser, getOrFetchShortcode, userRequestCache, history} = require("../../lib/collectors")
|
||||
const {render, redirect} = require("pinski/plugins")
|
||||
const {pugCache} = require("../passthrough")
|
||||
@@ -8,7 +9,8 @@ module.exports = [
|
||||
route: "/", methods: ["GET"], code: async () => {
|
||||
return render(200, "pug/home.pug", {
|
||||
rssEnabled: constants.settings.rss_enabled,
|
||||
allUnblocked: history.testNoneBlocked()
|
||||
allUnblocked: history.testNoneBlocked(),
|
||||
torAvailable: switcher.canUseTor()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,6 +3,7 @@ const child_process = require("child_process")
|
||||
const md = require("mixin-deep")
|
||||
const constants = require("../../lib/constants")
|
||||
const {history} = require("../../lib/collectors")
|
||||
const switcher = require("../../lib/utils/torswitcher")
|
||||
const {redirect} = require("pinski/plugins")
|
||||
|
||||
function reply(statusCode, content) {
|
||||
@@ -27,7 +28,7 @@ let commit = ""
|
||||
|
||||
// Set up inner versioning
|
||||
|
||||
const displayVersions = ["1.0", "1.1", "1.2"]
|
||||
const displayVersions = ["1.0", "1.1", "1.2", "1.3"]
|
||||
const versions = new Map(displayVersions.map(v => [v, semver.coerce(v)]))
|
||||
const features = [
|
||||
"PAGE_PROFILE",
|
||||
@@ -61,6 +62,11 @@ const innerMap = new Map()
|
||||
rssEnabled: constants.settings.rss_enabled
|
||||
}
|
||||
})
|
||||
addVersion("1.3", {
|
||||
settings: {
|
||||
torAvailable: switcher.canUseTor() // server.js holds on loading this file until tor state is known, so this is fine
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
|
||||
Reference in New Issue
Block a user