
- 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.
54 lines
1.5 KiB
JavaScript
Executable File
54 lines
1.5 KiB
JavaScript
Executable File
var cc = require('./lib/utils')
|
|
var join = require('path').join
|
|
var deepExtend = require('deep-extend')
|
|
var etc = '/etc'
|
|
var win = process.platform === "win32"
|
|
var home = win
|
|
? process.env.USERPROFILE
|
|
: process.env.HOME
|
|
|
|
module.exports = function (name, defaults, argv, parse) {
|
|
if('string' !== typeof name)
|
|
throw new Error('rc(name): name *must* be string')
|
|
if(!argv)
|
|
argv = require('minimist')(process.argv.slice(2))
|
|
defaults = (
|
|
'string' === typeof defaults
|
|
? cc.json(defaults) : defaults
|
|
) || {}
|
|
|
|
parse = parse || cc.parse
|
|
|
|
var env = cc.env(name + '_')
|
|
|
|
var configs = [defaults]
|
|
var configFiles = []
|
|
function addConfigFile (file) {
|
|
if (configFiles.indexOf(file) >= 0) return
|
|
var fileConfig = cc.file(file)
|
|
if (fileConfig) {
|
|
configs.push(parse(fileConfig))
|
|
configFiles.push(file)
|
|
}
|
|
}
|
|
|
|
// which files do we look at?
|
|
if (!win)
|
|
[join(etc, name, 'config'),
|
|
join(etc, name + 'rc')].forEach(addConfigFile)
|
|
if (home)
|
|
[join(home, '.config', name, 'config'),
|
|
join(home, '.config', name),
|
|
join(home, '.' + name, 'config'),
|
|
join(home, '.' + name + 'rc')].forEach(addConfigFile)
|
|
addConfigFile(cc.find('.'+name+'rc'))
|
|
if (env.config) addConfigFile(env.config)
|
|
if (argv.config) addConfigFile(argv.config)
|
|
|
|
return deepExtend.apply(null, configs.concat([
|
|
env,
|
|
argv,
|
|
configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
|
|
]))
|
|
}
|