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
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ var data = {
version: config.version,
GOOGLE_API_KEY: config.google.clientSecret,
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) {
Expand Down
20 changes: 20 additions & 0 deletions lib/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,26 @@ config.isLDAPEnable = config.ldap.url
config.isSAMLEnable = config.saml.idpSsoUrl
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
config.sslcapath.forEach(function (capath, i, array) {
array[i] = path.resolve(appRootPath, capath)
Expand Down
4 changes: 3 additions & 1 deletion public/js/lib/common/constant.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ window.urlpath = '<%- urlpath %>'
window.debug = <%- debug %>
window.version = '<%- version %>'

window.allowedUploadMimeTypes = <%- JSON.stringify(allowedUploadMimeTypes) %>

window.GOOGLE_API_KEY = '<%- GOOGLE_API_KEY %>'
window.GOOGLE_CLIENT_ID = '<%- GOOGLE_CLIENT_ID %>'
window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>'
window.DROPBOX_APP_KEY = '<%- DROPBOX_APP_KEY %>'
13 changes: 4 additions & 9 deletions public/vendor/inlineAttachment/inline-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@
/**
* Allowed MIME types
*/
allowedTypes: [
'image/jpeg',
'image/png',
'image/jpg',
'image/gif'
],
allowedTypes: window.allowedUploadMimeTypes,

/**
* Text which will be inserted when dropping or pasting a file.
Expand Down Expand Up @@ -304,7 +299,7 @@
if (this.settings.onFileUploadResponse.call(this, xhr) !== false) {
var result = JSON.parse(xhr.responseText),
filename = result[this.settings.jsonFieldName];

if (result && filename) {
var replacements = [];
var string = this.settings.progressText.replace(this.filenameTag, id);
Expand Down Expand Up @@ -415,7 +410,7 @@
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
Expand All @@ -432,4 +427,4 @@ var ID = function () {
// Convert it to base 36 (numbers + letters), and grab the first 9 characters
// after the decimal.
return '_' + Math.random().toString(36).substr(2, 9);
};
};