
- 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.
61 lines
1.5 KiB
JavaScript
61 lines
1.5 KiB
JavaScript
/*!
|
|
* encodeurl
|
|
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
* MIT Licensed
|
|
*/
|
|
|
|
'use strict'
|
|
|
|
/**
|
|
* Module exports.
|
|
* @public
|
|
*/
|
|
|
|
module.exports = encodeUrl
|
|
|
|
/**
|
|
* RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
|
|
* and including invalid escape sequences.
|
|
* @private
|
|
*/
|
|
|
|
var ENCODE_CHARS_REGEXP = /(?:[^\x21\x23-\x3B\x3D\x3F-\x5F\x61-\x7A\x7C\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g
|
|
|
|
/**
|
|
* RegExp to match unmatched surrogate pair.
|
|
* @private
|
|
*/
|
|
|
|
var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g
|
|
|
|
/**
|
|
* String to replace unmatched surrogate pair with.
|
|
* @private
|
|
*/
|
|
|
|
var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
|
|
|
|
/**
|
|
* Encode a URL to a percent-encoded form, excluding already-encoded sequences.
|
|
*
|
|
* This function will take an already-encoded URL and encode all the non-URL
|
|
* code points. This function will not encode the "%" character unless it is
|
|
* not part of a valid sequence (`%20` will be left as-is, but `%foo` will
|
|
* be encoded as `%25foo`).
|
|
*
|
|
* This encode is meant to be "safe" and does not throw errors. It will try as
|
|
* hard as it can to properly encode the given URL, including replacing any raw,
|
|
* unpaired surrogate pairs with the Unicode replacement character prior to
|
|
* encoding.
|
|
*
|
|
* @param {string} url
|
|
* @return {string}
|
|
* @public
|
|
*/
|
|
|
|
function encodeUrl (url) {
|
|
return String(url)
|
|
.replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
|
|
.replace(ENCODE_CHARS_REGEXP, encodeURI)
|
|
}
|