Adds PDF export via config

This commit is contained in:
geekyd 2017-10-25 19:19:37 +05:30
parent c794412714
commit d63e6780eb
6 changed files with 22 additions and 8 deletions

View file

@ -127,6 +127,10 @@
"HMD_IMGUR_CLIENTID": {
"description": "Imgur API client id",
"required": false
},
"HMD_ALLOW_PDF_EXPORT": {
"description": "Enable or disable PDF exports",
"required": false
}
},
"addons": [

View file

@ -94,5 +94,6 @@ module.exports = {
tlsca: undefined
},
email: true,
allowemailregister: true
allowemailregister: true,
allowpdfexport: true
}

View file

@ -69,5 +69,6 @@ module.exports = {
tlsca: process.env.HMD_LDAP_TLS_CA
},
email: toBooleanConfig(process.env.HMD_EMAIL),
allowemailregister: toBooleanConfig(process.env.HMD_ALLOW_EMAIL_REGISTER)
allowemailregister: toBooleanConfig(process.env.HMD_ALLOW_EMAIL_REGISTER),
allowpdfexport: toBooleanConfig(process.env.HMD_ALLOW_PDF_EXPORT)
}

View file

@ -1,3 +1,4 @@
'use strict'
const fs = require('fs')
@ -90,6 +91,7 @@ config.isEmailEnable = config.email
config.isGitHubEnable = config.github.clientID && config.github.clientSecret
config.isGitLabEnable = config.gitlab.clientID && config.gitlab.clientSecret
config.isLDAPEnable = config.ldap.url
config.isPDFExportEnable = config.allowpdfexport
// generate correct path
config.sslcapath = path.join(appRootPath, config.sslcapath)
@ -106,7 +108,7 @@ config.errorpath = path.join(appRootPath, config.errorpath)
config.prettypath = path.join(appRootPath, config.prettypath)
config.slidepath = path.join(appRootPath, config.slidepath)
// maek config readonly
// make config readonly
config = deepFreeze(config)
module.exports = config

View file

@ -69,6 +69,7 @@ function showIndex (req, res, next) {
ldap: config.isLDAPEnable,
email: config.isEmailEnable,
allowemailregister: config.allowemailregister,
allowpdfexport: config.allowpdfexport,
signin: req.isAuthenticated(),
infoMessage: req.flash('info'),
errorMessage: req.flash('error')
@ -98,7 +99,8 @@ function responseHackMD (res, note) {
google: config.isGoogleEnable,
ldap: config.isLDAPEnable,
email: config.isEmailEnable,
allowemailregister: config.allowemailregister
allowemailregister: config.allowemailregister,
allowpdfexport: config.allowpdfexport
})
}

View file

@ -70,8 +70,10 @@
</li>
<li role="presentation"><a role="menuitem" class="ui-download-raw-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> <%= __('Raw HTML') %></a>
</li>
<% if(allowpdfexport) {%>
<li role="presentation"><a role="menuitem" class="ui-download-pdf-beta" tabindex="-1" href="#" target="_self"><i class="fa fa-file-pdf-o fa-fw"></i> PDF (Beta)</a>
</li>
<% } %>
<li class="divider"></li>
<li role="presentation"><a role="menuitem" class="ui-help" href="#" data-toggle="modal" data-target=".help-modal"><i class="fa fa-question-circle fa-fw"></i> Help</a>
</li>
@ -169,8 +171,10 @@
</li>
<li role="presentation"><a role="menuitem" class="ui-download-raw-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> <%= __('Raw HTML') %></a>
</li>
<% if(allowpdfexport) {%>
<li role="presentation"><a role="menuitem" class="ui-download-pdf-beta" tabindex="-1" href="#" target="_self"><i class="fa fa-file-pdf-o fa-fw"></i> PDF (Beta)</a>
</li>
<% } %>
</ul>
</li>
</ul>