mirror of
https://github.com/wekan/wekan.git
synced 2026-01-22 09:16:10 +01:00
merge master changes
This commit is contained in:
commit
5df5c7f5d7
401 changed files with 142692 additions and 15007 deletions
|
|
@ -1,26 +0,0 @@
|
|||
Meteor.startup(() => {
|
||||
// https://atmospherejs.com/lucasantoniassi/accounts-lockout
|
||||
// server
|
||||
|
||||
if (Meteor.isServer) {
|
||||
import { AccountsLockout } from 'meteor/wekan-accounts-lockout';
|
||||
|
||||
new AccountsLockout({
|
||||
knownUsers: {
|
||||
failuresBeforeLockout:
|
||||
process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE || 3,
|
||||
lockoutPeriod: process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD || 60,
|
||||
failureWindow:
|
||||
process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW || 15,
|
||||
},
|
||||
unknownUsers: {
|
||||
failuresBeforeLockout:
|
||||
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE || 3,
|
||||
lockoutPeriod:
|
||||
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD || 60,
|
||||
failureWindow:
|
||||
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW || 15,
|
||||
},
|
||||
}).startup();
|
||||
}
|
||||
});
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import AccountSettings from '../models/accountSettings';
|
||||
import TableVisibilityModeSettings from '../models/tableVisibilityModeSettings';
|
||||
import Actions from '../models/actions';
|
||||
|
|
@ -117,6 +118,7 @@ Migrations.add('lowercase-board-permission', () => {
|
|||
});
|
||||
});
|
||||
|
||||
/*
|
||||
// Security migration: see https://github.com/wekan/wekan/issues/99
|
||||
Migrations.add('change-attachments-type-for-non-images', () => {
|
||||
const newTypeForNonImage = 'application/octet-stream';
|
||||
|
|
@ -146,6 +148,8 @@ Migrations.add('card-covers', () => {
|
|||
Attachments.update({}, { $unset: { cover: '' } }, noValidateMulti);
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
Migrations.add('use-css-class-for-boards-colors', () => {
|
||||
const associationTable = {
|
||||
'#27AE60': 'nephritis',
|
||||
|
|
@ -713,7 +717,7 @@ Migrations.add('add-missing-created-and-modified', () => {
|
|||
modifiedAtTables.map(db =>
|
||||
db
|
||||
.rawCollection()
|
||||
.update(
|
||||
.updateMany(
|
||||
{ modifiedAt: { $exists: false } },
|
||||
{ $set: { modifiedAt: new Date() } },
|
||||
{ multi: true },
|
||||
|
|
@ -721,7 +725,7 @@ Migrations.add('add-missing-created-and-modified', () => {
|
|||
.then(() =>
|
||||
db
|
||||
.rawCollection()
|
||||
.update(
|
||||
.updateMany(
|
||||
{ createdAt: { $exists: false } },
|
||||
{ $set: { createdAt: new Date() } },
|
||||
{ multi: true },
|
||||
|
|
@ -768,7 +772,7 @@ Migrations.add('fix-incorrect-dates', () => {
|
|||
.rawCollection()
|
||||
.find({ $or: [{ createdAt: { $type: 1 } }, { updatedAt: { $type: 1 } }] })
|
||||
.forEach(({ _id, createdAt, updatedAt }) => {
|
||||
t.rawCollection().update(
|
||||
t.rawCollection().updateMany(
|
||||
{ _id },
|
||||
{
|
||||
$set: {
|
||||
|
|
@ -1178,13 +1182,9 @@ Migrations.add('add-card-details-show-lists', () => {
|
|||
});
|
||||
|
||||
Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
||||
const storagePath = Attachments.storagePath();
|
||||
if (!fs.existsSync(storagePath)) {
|
||||
console.log("create storagePath because it doesn't exist: " + storagePath);
|
||||
fs.mkdirSync(storagePath, { recursive: true });
|
||||
}
|
||||
AttachmentsOld.find().forEach(function(fileObj) {
|
||||
const newFileName = fileObj.name();
|
||||
const storagePath = Attachments.storagePath({});
|
||||
const filePath = path.join(storagePath, `${fileObj._id}-${newFileName}`);
|
||||
|
||||
// This is "example" variable, change it to the userId that you might be using.
|
||||
|
|
@ -1197,12 +1197,8 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
const readStream = fileObj.createReadStream('attachments');
|
||||
const writeStream = fs.createWriteStream(filePath);
|
||||
|
||||
writeStream.on('error', error => {
|
||||
console.error('[writeStream error]: ', error, filePath);
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.error('[readStream error]: ', error, filePath);
|
||||
writeStream.on('error', function(err) {
|
||||
console.log('Writing error: ', err, filePath);
|
||||
});
|
||||
|
||||
// Once we have a file, then upload it to our new data storage
|
||||
|
|
@ -1226,11 +1222,11 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
size: fileSize,
|
||||
fileId,
|
||||
},
|
||||
(error, fileRef) => {
|
||||
if (error) {
|
||||
console.error('[Attachments#addFile error]: ', error);
|
||||
(err, fileRef) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log('File Inserted: ', fileRef);
|
||||
console.log('File Inserted: ', fileRef._id);
|
||||
// Set the userId again
|
||||
Attachments.update({ _id: fileRef._id }, { $set: { userId } });
|
||||
fileObj.remove();
|
||||
|
|
@ -1240,18 +1236,18 @@ Migrations.add('migrate-attachments-collectionFS-to-ostrioFiles', () => {
|
|||
); // proceedAfterUpload
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.log('Error: ', filePath, error);
|
||||
});
|
||||
|
||||
readStream.pipe(writeStream);
|
||||
});
|
||||
});
|
||||
|
||||
Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
||||
const storagePath = Avatars.storagePath();
|
||||
if (!fs.existsSync(storagePath)) {
|
||||
console.log("create storagePath because it doesn't exist: " + storagePath);
|
||||
fs.mkdirSync(storagePath, { recursive: true });
|
||||
}
|
||||
AvatarsOld.find().forEach(function(fileObj) {
|
||||
const newFileName = fileObj.name();
|
||||
const storagePath = Avatars.storagePath({});
|
||||
const filePath = path.join(storagePath, `${fileObj._id}-${newFileName}`);
|
||||
|
||||
// This is "example" variable, change it to the userId that you might be using.
|
||||
|
|
@ -1264,12 +1260,8 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|||
const readStream = fileObj.createReadStream('avatars');
|
||||
const writeStream = fs.createWriteStream(filePath);
|
||||
|
||||
writeStream.on('error', error => {
|
||||
console.error('[writeStream error]: ', error, filePath);
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.error('[readStream error]: ', error, filePath);
|
||||
writeStream.on('error', function(err) {
|
||||
console.log('Writing error: ', err, filePath);
|
||||
});
|
||||
|
||||
// Once we have a file, then upload it to our new data storage
|
||||
|
|
@ -1292,11 +1284,11 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|||
size: fileSize,
|
||||
fileId,
|
||||
},
|
||||
(error, fileRef) => {
|
||||
if (error) {
|
||||
console.error('[Avatars#addFile error]: ', error);
|
||||
(err, fileRef) => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log('File Inserted: ', newFileName, fileRef);
|
||||
console.log('File Inserted: ', newFileName, fileRef._id);
|
||||
// Set the userId again
|
||||
Avatars.update({ _id: fileRef._id }, { $set: { userId } });
|
||||
Users.find().forEach(user => {
|
||||
|
|
@ -1322,6 +1314,10 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
|
|||
);
|
||||
});
|
||||
|
||||
readStream.on('error', error => {
|
||||
console.log('Error: ', filePath, error);
|
||||
});
|
||||
|
||||
readStream.pipe(writeStream);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { TAPi18n } from '/imports/i18n';
|
||||
//var nodemailer = require('nodemailer');
|
||||
|
||||
// buffer each user's email text in a queue, then flush them in single email
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { TAPi18n } from '/imports/i18n';
|
||||
|
||||
if (Meteor.isServer) {
|
||||
const postCatchError = Meteor.wrapAsync((url, options, resolve) => {
|
||||
HTTP.post(url, options, (err, res) => {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
import Users from "../../models/users";
|
||||
import Org from "../../models/org";
|
||||
import Team from "../../models/team";
|
||||
import Attachments from '../../models/attachments';
|
||||
|
||||
Meteor.publish('boards', function() {
|
||||
const userId = this.userId;
|
||||
|
|
@ -311,7 +312,7 @@ Meteor.publishRelations('board', function(boardId, isArchived) {
|
|||
),
|
||||
);
|
||||
|
||||
this.cursor(presences.find({ userId: { $in: memberIds } }));
|
||||
//this.cursor(presences.find({ userId: { $in: memberIds } }));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import moment from 'moment';
|
||||
import moment from 'moment/min/moment-with-locales';
|
||||
import escapeForRegex from 'escape-string-regexp';
|
||||
import Users from '../../models/users';
|
||||
import Boards from '../../models/boards';
|
||||
import Lists from '../../models/lists';
|
||||
|
|
@ -52,8 +53,6 @@ import { CARD_TYPES } from '../../config/const';
|
|||
import Org from "../../models/org";
|
||||
import Team from "../../models/team";
|
||||
|
||||
const escapeForRegex = require('escape-string-regexp');
|
||||
|
||||
Meteor.publish('card', cardId => {
|
||||
check(cardId, String);
|
||||
const ret = Cards.find({ _id: cardId });
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
import { FastRender } from 'meteor/staringatlights:fast-render';
|
||||
|
||||
FastRender.onAllRoutes(function() {
|
||||
this.subscribe('boards');
|
||||
});
|
||||
|
||||
FastRender.route('/b/:id/:slug', function({ id }) {
|
||||
this.subscribe('board', id, false);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue