
- 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.
69 lines
2.9 KiB
JavaScript
69 lines
2.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
const os = require("os");
|
|
const path = require("path");
|
|
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
/**
|
|
* All non-escaped special characters.
|
|
* Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
|
|
* Windows: (){}[], !+@ before (, ! at the beginning.
|
|
*/
|
|
const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
/**
|
|
* The device path (\\.\ or \\?\).
|
|
* https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
|
|
*/
|
|
const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
|
|
/**
|
|
* All backslashes except those escaping special characters.
|
|
* Windows: !()+@{}
|
|
* https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
|
*/
|
|
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
|
/**
|
|
* Designed to work only with simple paths: `dir\\file`.
|
|
*/
|
|
function unixify(filepath) {
|
|
return filepath.replace(/\\/g, '/');
|
|
}
|
|
exports.unixify = unixify;
|
|
function makeAbsolute(cwd, filepath) {
|
|
return path.resolve(cwd, filepath);
|
|
}
|
|
exports.makeAbsolute = makeAbsolute;
|
|
function removeLeadingDotSegment(entry) {
|
|
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
|
|
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
if (entry.charAt(0) === '.') {
|
|
const secondCharactery = entry.charAt(1);
|
|
if (secondCharactery === '/' || secondCharactery === '\\') {
|
|
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
|
|
}
|
|
}
|
|
return entry;
|
|
}
|
|
exports.removeLeadingDotSegment = removeLeadingDotSegment;
|
|
exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
|
function escapeWindowsPath(pattern) {
|
|
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
}
|
|
exports.escapeWindowsPath = escapeWindowsPath;
|
|
function escapePosixPath(pattern) {
|
|
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
}
|
|
exports.escapePosixPath = escapePosixPath;
|
|
exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
|
function convertWindowsPathToPattern(filepath) {
|
|
return escapeWindowsPath(filepath)
|
|
.replace(DOS_DEVICE_PATH_RE, '//$1')
|
|
.replace(WINDOWS_BACKSLASHES_RE, '/');
|
|
}
|
|
exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
|
function convertPosixPathToPattern(filepath) {
|
|
return escapePosixPath(filepath);
|
|
}
|
|
exports.convertPosixPathToPattern = convertPosixPathToPattern;
|