mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Add Features: allowing wekan master to set where the attachments stored on server instead of mongodb
This commit is contained in:
parent
aa6a588376
commit
13a13e8eca
5 changed files with 33 additions and 15 deletions
|
|
@ -95,3 +95,4 @@ wekan-markdown
|
||||||
konecty:mongo-counter
|
konecty:mongo-counter
|
||||||
percolate:synced-cron
|
percolate:synced-cron
|
||||||
easylogic:summernote
|
easylogic:summernote
|
||||||
|
cfs:filesystem
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ cfs:collection@0.5.5
|
||||||
cfs:collection-filters@0.2.4
|
cfs:collection-filters@0.2.4
|
||||||
cfs:data-man@0.0.6
|
cfs:data-man@0.0.6
|
||||||
cfs:file@0.1.17
|
cfs:file@0.1.17
|
||||||
|
cfs:filesystem@0.1.2
|
||||||
cfs:gridfs@0.0.34
|
cfs:gridfs@0.0.34
|
||||||
cfs:http-methods@0.0.32
|
cfs:http-methods@0.0.32
|
||||||
cfs:http-publish@0.0.13
|
cfs:http-publish@0.0.13
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,9 @@ Template.cardAttachmentsPopup.events({
|
||||||
file.cardId = card._id;
|
file.cardId = card._id;
|
||||||
}
|
}
|
||||||
file.userId = Meteor.userId();
|
file.userId = Meteor.userId();
|
||||||
|
if (file.original) {
|
||||||
|
file.original.name = f.name;
|
||||||
|
}
|
||||||
const attachment = Attachments.insert(file);
|
const attachment = Attachments.insert(file);
|
||||||
|
|
||||||
if (attachment && attachment._id && attachment.isImage()) {
|
if (attachment && attachment._id && attachment.isImage()) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,23 @@
|
||||||
Attachments = new FS.Collection('attachments', {
|
const localFSStore = process.env.ATTACHMENTS_STORE_PATH;
|
||||||
stores: [
|
const storeName = 'attachments';
|
||||||
// XXX Add a new store for cover thumbnails so we don't load big images in
|
const defaultStoreOptions = {
|
||||||
// the general board view
|
beforeWrite: fileObj => {
|
||||||
new FS.Store.GridFS('attachments', {
|
if (!fileObj.isImage()) {
|
||||||
|
return {
|
||||||
|
type: 'application/octet-stream',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const Store = localFSStore
|
||||||
|
? new FS.Store.FileSystem(storeName, {
|
||||||
|
path: localFSStore,
|
||||||
|
...defaultStoreOptions,
|
||||||
|
})
|
||||||
|
: new FS.Store.GridFS(storeName, {
|
||||||
|
// XXX Add a new store for cover thumbnails so we don't load big images in
|
||||||
|
// the general board view
|
||||||
// If the uploaded document is not an image we need to enforce browser
|
// If the uploaded document is not an image we need to enforce browser
|
||||||
// download instead of execution. This is particularly important for HTML
|
// download instead of execution. This is particularly important for HTML
|
||||||
// files that the browser will just execute if we don't serve them with the
|
// files that the browser will just execute if we don't serve them with the
|
||||||
|
|
@ -12,16 +27,10 @@ Attachments = new FS.Collection('attachments', {
|
||||||
// XXX Should we use `beforeWrite` option of CollectionFS instead of
|
// XXX Should we use `beforeWrite` option of CollectionFS instead of
|
||||||
// collection-hooks?
|
// collection-hooks?
|
||||||
// We should use `beforeWrite`.
|
// We should use `beforeWrite`.
|
||||||
beforeWrite: fileObj => {
|
...defaultStoreOptions,
|
||||||
if (!fileObj.isImage()) {
|
});
|
||||||
return {
|
Attachments = new FS.Collection('attachments', {
|
||||||
type: 'application/octet-stream',
|
stores: [Store],
|
||||||
};
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,10 @@ DESCRIPTION_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="Accounts lockout unkn
|
||||||
DEFAULT_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="15"
|
DEFAULT_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="15"
|
||||||
KEY_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="accounts-lockout-unknown-users-failure-window"
|
KEY_ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW="accounts-lockout-unknown-users-failure-window"
|
||||||
|
|
||||||
|
DESCRIPTION_ATTACHMENTS_STORE_PATH="Allow wekan ower to specify where uploaded files to store on the server instead of the mongodb"
|
||||||
|
DEFAULT_ATTACHMENTS_STORE_PATH=""
|
||||||
|
KEY_ATTACHMENTS_STORE_PATH="attachments-store-path"
|
||||||
|
|
||||||
DESCRIPTION_MAX_IMAGE_PIXEL="Max image pixel: Allow to shrink attached/pasted image https://github.com/wekan/wekan/pull/2544"
|
DESCRIPTION_MAX_IMAGE_PIXEL="Max image pixel: Allow to shrink attached/pasted image https://github.com/wekan/wekan/pull/2544"
|
||||||
DEFAULT_MAX_IMAGE_PIXEL=""
|
DEFAULT_MAX_IMAGE_PIXEL=""
|
||||||
KEY_MAX_IMAGE_PIXEL="max-image-pixel"
|
KEY_MAX_IMAGE_PIXEL="max-image-pixel"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue