Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 1.8.2, May 20th, 2017
==================================

- Closes #152 (You can now disable Gravatar)
- Closes #129 (Adds logo support)
- Fixes #216 ()
- Always uses local jQuery and not Google's
- Adds favicon support

Version 1.8.1, May 17th, 2017
==================================

Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ Configuration options reference

This will be showed on the upper left corner of all the pages, in the main toolbar

#### application.logo (string: "")

Supply the full URL to an image to be shown as the logo of your wiki. It will appear on the left of the page title in the navigation bar. Just set the `application.title` to an empty string to only show the Logo image. Please note that Jingo does not resize the image in any way (you can do it yourself using a custom CSS of course)

#### application.favicon (string: "")

Supply the full URL to an image to be shown as the favicon of your wiki. Please note that Jingo will try to get the mime type of the image from its extension (this can easily fail for a lot of reasons)

#### application.repository (string: "")

Absolute path for your documents repository (mandatory).
Expand Down Expand Up @@ -337,13 +345,15 @@ Configuration options reference

#### features.markitup (boolean: false)

Whether to enable Markitup or not
DEPRECATED: markitup support has been removed as of version 1.8.0

#### features.codemirror (boolean: true)

Whether to enable Codemirror or not.

Please note that you cannot enable both editors at the same time.
#### features.gravatar (boolean: true)

Whether to enable gravatar support or not

#### server.hostname

Expand Down
30 changes: 28 additions & 2 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ module.exports.initialize = function (config) {
get user () {
return req.user
},
get appTitle () {
return config.get('application').title
get appBrand () {
var appTitle = config.get('application').title || ''
var appLogo = config.get('application').logo || ''
if (appLogo !== '') {
appLogo = '<img src="' + appLogo + '" alt="Logo">'
}
return appLogo + ' ' + appTitle
},
get proxyPath () {
return config.getProxyPath()
Expand All @@ -65,6 +70,21 @@ module.exports.initialize = function (config) {
get authentication () {
return config.get('authentication')
},
get faviconMimeType () {
if (!this.hasFavicon()) {
return ''
}
var favicon = config.get('application').favicon.trim()
var match = favicon.match(/\.([0-9a-z]+)$/i)
return match ? 'image/' + match[1] : 'image/png'
},
get faviconUrl () {
if (!this.hasFavicon()) {
return ''
}
return config.get('application').favicon.trim()
},

isAnonymous: function () {
return !req.user
},
Expand All @@ -74,6 +94,12 @@ module.exports.initialize = function (config) {
gravatar: function (email) {
return gravatar
},
hasGravatar: function () {
return config.get('features').gravatar && req.user && req.user.email && req.user.email !== 'jingouser'
},
hasFavicon: function () {
return config.get('application').favicon && config.get('application').favicon.trim().length > 0
},
get isAjax () {
return req.headers['x-requested-with'] && req.headers['x-requested-with'] === 'XMLHttpRequest'
}
Expand Down
5 changes: 4 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ module.exports = (function () {

application: {
title: 'Jingo',
logo: '',
favicon: '',
repository: '',
docSubdir: '',
remote: '',
Expand Down Expand Up @@ -102,7 +104,8 @@ module.exports = (function () {

features: {
markitup: false,
codemirror: true
codemirror: true,
gravatar: true
},

server: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jingo",
"version": "1.8.1",
"version": "1.8.2",
"description": "A nodejs based wiki engine",
"author": "Claudio Cicali <claudio.cicali@gmail.com>",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions routes/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function _getPagesNew (req, res) {
delete req.session.formData

res.render('create', {
title: 'Jingo – Create page ' + title,
title: app.locals.config.get('application').title + ' – Create page ' + title,
pageTitle: title,
pageName: page ? page.wikiname : ''
})
Expand Down Expand Up @@ -250,7 +250,7 @@ function _getPagesEdit (req, res) {
delete req.session.formData

res.render('edit', {
title: 'Jingo – Edit page ' + page.title,
title: app.locals.config.get('application').title + ' – Edit page ' + page.title,
page: page,
warning: warning
})
Expand Down
12 changes: 6 additions & 6 deletions views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ include mixins/links
- if (!isAjax)
doctype html
html
head
head(profile=hasFavicon() ? "http://www.w3.org/2005/10/profile" : "")
meta(charset="utf-8")
if hasFavicon()
link(rel="icon", type=faviconMimeType, href=faviconUrl)
meta(name="generator", content="jingo " + jingoVersion)
meta(name="viewport", content="width=device-width, initial-scale=1")
title= title
Expand All @@ -22,7 +24,7 @@ include mixins/links
.navbar.navbar-inverse.navbar-fixed-top
.container-fluid
.navbar-header
+anchor("/", appTitle).navbar-brand
+anchor("/", appBrand).navbar-brand
if canSearch()
form(action=`${proxyPath}/search`).navbar-form.search.navbar-left
.input-group.input-group-sm.search
Expand All @@ -35,7 +37,7 @@ include mixins/links
+anchor('/login?destination', 'logged in')#login(title='Access login page')
else
p.user
if user.email && user.email != 'jingouser'
if hasGravatar()
img(src=gravatar().url(user.email, {s:24}))
b &nbsp;#{user.displayName}&nbsp;
+anchor('/logout')(title='Become anonymous')
Expand All @@ -62,9 +64,7 @@ include mixins/links
.col-md-8.with-footer
.content !{_footer}

script(src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js")
script.
window.jQuery || document.write("<sc" + "ript src='#{proxyPath}/vendor/jquery.min.js'></scr" + "ipt>");
script(src=proxyPath + "/vendor/jquery.min.js")
+asset("/vendor/bootstrap/js/bootstrap.min.js")
+asset("/js/app.js")
script.
Expand Down
4 changes: 2 additions & 2 deletions views/mixins/links.pug
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mixin anchor(url, name)
a(href=`${proxyPath}${url}`)&attributes(attributes)= name
mixin anchor(url, text)
a(href=`${proxyPath}${url}`)&attributes(attributes) !{text}
block

mixin asset(url)
Expand Down
2 changes: 0 additions & 2 deletions views/preview.pug
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@

#content!=content