From f7237647b32ffe25991a51a3f7740384ce18cc46 Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 31 Jan 2017 02:26:56 -0500 Subject: Improve handling base config option --- lib/serve.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib') 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'), ' ', -- cgit v1.2.3