
- Complete NestJS TypeScript implementation with WebSocket support - Direct messaging (DM) and group chat functionality - End-to-end encryption with AES encryption and key pairs - Media file support (images, videos, audio, documents) up to 100MB - Push notifications with Firebase Cloud Messaging integration - Mention alerts and real-time typing indicators - User authentication with JWT and Passport - SQLite database with TypeORM entities and relationships - Comprehensive API documentation with Swagger/OpenAPI - File upload handling with secure access control - Online/offline status tracking and presence management - Message editing, deletion, and reply functionality - Notification management with automatic cleanup - Health check endpoint for monitoring - CORS configuration for cross-origin requests - Environment-based configuration management - Structured for Flutter SDK integration Features implemented: ✅ Real-time messaging with Socket.IO ✅ User registration and authentication ✅ Direct messages and group chats ✅ Media file uploads and management ✅ End-to-end encryption ✅ Push notifications ✅ Mention alerts ✅ Typing indicators ✅ Message read receipts ✅ Online status tracking ✅ File access control ✅ Comprehensive API documentation Ready for Flutter SDK development and production deployment.
62 lines
1.4 KiB
JavaScript
62 lines
1.4 KiB
JavaScript
/*!
|
|
* word-wrap <https://github.com/jonschlinkert/word-wrap>
|
|
*
|
|
* Copyright (c) 2014-2023, Jon Schlinkert.
|
|
* Released under the MIT License.
|
|
*/
|
|
|
|
function trimEnd(str) {
|
|
let lastCharPos = str.length - 1;
|
|
let lastChar = str[lastCharPos];
|
|
while(lastChar === ' ' || lastChar === '\t') {
|
|
lastChar = str[--lastCharPos];
|
|
}
|
|
return str.substring(0, lastCharPos + 1);
|
|
}
|
|
|
|
function trimTabAndSpaces(str) {
|
|
const lines = str.split('\n');
|
|
const trimmedLines = lines.map((line) => trimEnd(line));
|
|
return trimmedLines.join('\n');
|
|
}
|
|
|
|
module.exports = function(str, options) {
|
|
options = options || {};
|
|
if (str == null) {
|
|
return str;
|
|
}
|
|
|
|
var width = options.width || 50;
|
|
var indent = (typeof options.indent === 'string')
|
|
? options.indent
|
|
: ' ';
|
|
|
|
var newline = options.newline || '\n' + indent;
|
|
var escape = typeof options.escape === 'function'
|
|
? options.escape
|
|
: identity;
|
|
|
|
var regexString = '.{1,' + width + '}';
|
|
if (options.cut !== true) {
|
|
regexString += '([\\s\u200B]+|$)|[^\\s\u200B]+?([\\s\u200B]+|$)';
|
|
}
|
|
|
|
var re = new RegExp(regexString, 'g');
|
|
var lines = str.match(re) || [];
|
|
var result = indent + lines.map(function(line) {
|
|
if (line.slice(-1) === '\n') {
|
|
line = line.slice(0, line.length - 1);
|
|
}
|
|
return escape(line);
|
|
}).join(newline);
|
|
|
|
if (options.trim === true) {
|
|
result = trimTabAndSpaces(result);
|
|
}
|
|
return result;
|
|
};
|
|
|
|
function identity(str) {
|
|
return str;
|
|
}
|