From afaa102ea3bc41af3b114bc97faa8ca36f36046a Mon Sep 17 00:00:00 2001 From: Supernova Date: Sat, 15 Aug 2020 16:44:20 +0000 Subject: [PATCH] Add environment variable to set Onion-Location header --- routes/main.js | 9 +++++++++ template.env | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/routes/main.js b/routes/main.js index 62f5f49..4e38e39 100644 --- a/routes/main.js +++ b/routes/main.js @@ -36,6 +36,15 @@ md.use(require("markdown-it-anchor")); md.use(require("markdown-it-table-of-contents"), { "includeLevel": [2, 3], "listType": "ol" }); md.use(require('markdown-it-title')); + +if(process.env.ONION_URL) +{ + router.get('/*', (req, res, next) => { + res.header('Onion-Location', process.env.ONION_URL); + next(); + }); +} + router.get('/', (req, res) => { res.render('index') }); diff --git a/template.env b/template.env index af846aa..57981aa 100644 --- a/template.env +++ b/template.env @@ -16,3 +16,7 @@ # Expected format: "XXXXXXXXXXXXXXXXXXXXX" # If none is provided (default), Twitter accounts are not verified #TWITTER_API_AUTH= + +# Tor Onion URL +# The full http:// onion url to add as an 'Onion-Location' header +#ONION_URL=