diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-01-31 02:26:56 -0500 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-01-31 02:26:56 -0500 |
commit | f7237647b32ffe25991a51a3f7740384ce18cc46 (patch) | |
tree | 4ea5d371c5b714a8e09c5497b7642b91ca5a35d4 /lib/serve.js | |
parent | c662791505f014d95b3db7961e9c476f9b695ed4 (diff) | |
download | patchfoo-f7237647b32ffe25991a51a3f7740384ce18cc46.tar.gz patchfoo-f7237647b32ffe25991a51a3f7740384ce18cc46.zip |
Improve handling base config option
Diffstat (limited to 'lib/serve.js')
-rw-r--r-- | lib/serve.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/serve.js b/lib/serve.js index df2b089..51a7a5d 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -20,7 +20,7 @@ module.exports = Serve var emojiDir = path.join(require.resolve('emoji-named-characters'), '../pngs') var appHash = hash([fs.readFileSync(__filename)]) -var urlIdRegex = /^(?:\/(([%&@]|%25)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3D)\.(?:sha256|ed25519))(?:\.([^?]*))?|(\/.*?))(?:\?(.*))?$/ +var urlIdRegex = /^(?:\/+(([%&@]|%25)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3D)\.(?:sha256|ed25519))(?:\.([^?]*))?|(\/.*?))(?:\?(.*))?$/ function hash(arr) { return arr.reduce(function (hash, item) { @@ -564,6 +564,7 @@ Serve.prototype.appendFooter = function () { Serve.prototype.wrapPage = function (title, searchQ) { var self = this + var render = self.app.render return pull( catchHTMLError(), self.appendFooter(), @@ -576,10 +577,10 @@ Serve.prototype.wrapPage = function (title, searchQ) { h('style', styles()) ), h('body', - h('nav.nav-bar', h('form', {action: '/search', method: 'get'}, - h('a', {href: '/public'}, 'public'), ' ', - h('a', {href: '/private'}, 'private') , ' ', - self.app.render.idLink(self.app.sbot.id, done()), ' ', + h('nav.nav-bar', h('form', {action: render.toUrl('/search'), method: 'get'}, + h('a', {href: render.toUrl('/public')}, 'public'), ' ', + h('a', {href: render.toUrl('/private')}, 'private') , ' ', + render.idLink(self.app.sbot.id, done()), ' ', h('input.search-input', {name: 'q', value: searchQ, placeholder: 'search', size: 16}) // h('a', {href: '/convos'}, 'convos'), ' ', |