Merge pull request #691 from SISheogorath/feature/upload
Allow more detailed configuration of upload mime types
This commit is contained in:
commit
584f1c5249
4 changed files with 29 additions and 11 deletions
3
app.js
3
app.js
|
@ -35,7 +35,8 @@ var data = {
|
||||||
version: config.version,
|
version: config.version,
|
||||||
GOOGLE_API_KEY: config.google.clientSecret,
|
GOOGLE_API_KEY: config.google.clientSecret,
|
||||||
GOOGLE_CLIENT_ID: config.google.clientID,
|
GOOGLE_CLIENT_ID: config.google.clientID,
|
||||||
DROPBOX_APP_KEY: config.dropbox.appKey
|
DROPBOX_APP_KEY: config.dropbox.appKey,
|
||||||
|
allowedUploadMimeTypes: config.allowedUploadMimeTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
ejs.renderFile(constpath, data, {}, function (err, str) {
|
ejs.renderFile(constpath, data, {}, function (err, str) {
|
||||||
|
|
|
@ -97,6 +97,26 @@ config.isLDAPEnable = config.ldap.url
|
||||||
config.isSAMLEnable = config.saml.idpSsoUrl
|
config.isSAMLEnable = config.saml.idpSsoUrl
|
||||||
config.isPDFExportEnable = config.allowpdfexport
|
config.isPDFExportEnable = config.allowpdfexport
|
||||||
|
|
||||||
|
// figure out mime types for image uploads
|
||||||
|
switch (config.imageUploadType) {
|
||||||
|
case 'imgur':
|
||||||
|
config.allowedUploadMimeTypes = [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/png',
|
||||||
|
'image/jpg',
|
||||||
|
'image/gif'
|
||||||
|
]
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
config.allowedUploadMimeTypes = [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/png',
|
||||||
|
'image/jpg',
|
||||||
|
'image/gif',
|
||||||
|
'image/svg+xml'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
// generate correct path
|
// generate correct path
|
||||||
config.sslcapath.forEach(function (capath, i, array) {
|
config.sslcapath.forEach(function (capath, i, array) {
|
||||||
array[i] = path.resolve(appRootPath, capath)
|
array[i] = path.resolve(appRootPath, capath)
|
||||||
|
|
|
@ -3,6 +3,8 @@ window.urlpath = '<%- urlpath %>'
|
||||||
window.debug = <%- debug %>
|
window.debug = <%- debug %>
|
||||||
window.version = '<%- version %>'
|
window.version = '<%- version %>'
|
||||||
|
|
||||||
|
window.allowedUploadMimeTypes = <%- JSON.stringify(allowedUploadMimeTypes) %>
|
||||||
|
|
||||||
window.GOOGLE_API_KEY = '<%- GOOGLE_API_KEY %>'
|
window.GOOGLE_API_KEY = '<%- GOOGLE_API_KEY %>'
|
||||||
window.GOOGLE_CLIENT_ID = '<%- GOOGLE_CLIENT_ID %>'
|
window.GOOGLE_CLIENT_ID = '<%- GOOGLE_CLIENT_ID %>'
|
||||||
window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>'
|
window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>'
|
|
@ -141,12 +141,7 @@
|
||||||
/**
|
/**
|
||||||
* Allowed MIME types
|
* Allowed MIME types
|
||||||
*/
|
*/
|
||||||
allowedTypes: [
|
allowedTypes: window.allowedUploadMimeTypes,
|
||||||
'image/jpeg',
|
|
||||||
'image/png',
|
|
||||||
'image/jpg',
|
|
||||||
'image/gif'
|
|
||||||
],
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text which will be inserted when dropping or pasting a file.
|
* Text which will be inserted when dropping or pasting a file.
|
||||||
|
|
Loading…
Reference in a new issue