Add onion location

This commit is contained in:
Cadence Ember 2020-06-19 17:45:51 +12:00
parent 64ab9cfcee
commit a13daa7ced
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412
7 changed files with 22 additions and 10 deletions

10
package-lock.json generated
View File

@ -2738,8 +2738,8 @@
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg=="
},
"pinski": {
"version": "github:cloudrac3r/pinski#b062547bc0dcebb82c3aa7da36c13988a68b8acc",
"from": "github:cloudrac3r/pinski#b062547bc0dcebb82c3aa7da36c13988a68b8acc",
"version": "github:cloudrac3r/pinski#7152d86dbf40d8dd9448f9a918d3e6fb76428c6a",
"from": "github:cloudrac3r/pinski#7152d86dbf40d8dd9448f9a918d3e6fb76428c6a",
"requires": {
"mime": "^2.4.4",
"pug": "^2.0.3",
@ -3129,9 +3129,9 @@
"dev": true
},
"sass": {
"version": "1.26.7",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.26.7.tgz",
"integrity": "sha512-xgNazdkr6yvgHEfNaOjKtZzhDZmKYMCmoRKMPrTDo7YvjaITIzU2DDYsIUuN/atAg7/JOxPeCQHH7TtCo5Tq2g==",
"version": "1.26.8",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.26.8.tgz",
"integrity": "sha512-yvtzyrKLGiXQu7H12ekXqsfoGT/aTKeMDyVzCB675k1HYuaj0py63i8Uf4SI9CHXj6apDhpfwbUr3gGOjdpu2Q==",
"requires": {
"chokidar": ">=2.0.0 <4.0.0"
}

View File

@ -19,7 +19,7 @@
"mixin-deep": "^2.0.1",
"node-dir": "^0.1.17",
"node-fetch": "^2.6.0",
"pinski": "github:cloudrac3r/pinski#b062547bc0dcebb82c3aa7da36c13988a68b8acc",
"pinski": "github:cloudrac3r/pinski#7152d86dbf40d8dd9448f9a918d3e6fb76428c6a",
"pug": "^2.0.4",
"semver": "^7.2.1",
"sharp": "^0.25.2",

View File

@ -20,6 +20,9 @@ let constants = {
port: 10407,
// You MUST read /src/site/pug/privacy.pug.template before changing has_privacy_policy!
has_privacy_policy: false,
// If your instance is also available as an onion site, add the onion URL here.
// It should look something like "http://3gldbgtv5e4god56.onion" (no trailing slash).
onion_location: "http://3gldbgtv5e4god56.onion",
// Things that server owners _could_ change if they want to.
tor: {

View File

@ -21,7 +21,8 @@ module.exports = [
rssEnabled: constants.feeds.enabled,
allUnblocked: history.testNoneBlocked() || assistantSwitcher.displaySomeUnblocked(),
torAvailable: switcher.canUseTor(),
hasPrivacyPolicy: constants.has_privacy_policy
hasPrivacyPolicy: constants.has_privacy_policy,
onionLocation: constants.onion_location
})
}
},

View File

@ -28,7 +28,7 @@ let commit = ""
// Set up inner versioning
const displayVersions = ["1.0", "1.1", "1.2", "1.3", "1.4"]
const displayVersions = ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5"]
const versions = new Map(displayVersions.map(v => [v, semver.coerce(v)]))
const features = [
"PAGE_PROFILE",
@ -78,6 +78,11 @@ const innerMap = new Map()
canonicalOrigin: constants.website_origin
}
})
addVersion("1.5", {
settings: {
onionLocation: constants.onion_location
}
})
}
module.exports = [

View File

@ -1,4 +1,4 @@
//- Needs rssEnabled, allUnblocked, torAvailable, hasPrivacyPolicy
//- Needs rssEnabled, allUnblocked, torAvailable, hasPrivacyPolicy, onionLocation
doctype html
html
@ -36,6 +36,8 @@ html
h2 About this instance
ul
if onionLocation
li: a(href=onionLocation) Onion site available
li: a(href=settingsReferrer) Settings
if hasPrivacyPolicy
li: a(href="/privacy") Privacy policy

View File

@ -22,7 +22,8 @@ const pinski = new Pinski({
"Feature-Policy": deniedFeatures.map(feature => `${feature} 'none'`).join("; "),
"Referrer-Policy": "strict-origin",
"X-Content-Type-Options": "nosniff"
}
},
onionLocation: constants.onion_location
})
subdirs("pug", async (err, dirs) => {