
- 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.
127 lines
2.7 KiB
JavaScript
Executable File
127 lines
2.7 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
|
|
'use strict';
|
|
|
|
/*eslint-disable no-console*/
|
|
|
|
|
|
var fs = require('fs');
|
|
var argparse = require('argparse');
|
|
var yaml = require('..');
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
var cli = new argparse.ArgumentParser({
|
|
prog: 'js-yaml',
|
|
add_help: true
|
|
});
|
|
|
|
cli.add_argument('-v', '--version', {
|
|
action: 'version',
|
|
version: require('../package.json').version
|
|
});
|
|
|
|
cli.add_argument('-c', '--compact', {
|
|
help: 'Display errors in compact mode',
|
|
action: 'store_true'
|
|
});
|
|
|
|
// deprecated (not needed after we removed output colors)
|
|
// option suppressed, but not completely removed for compatibility
|
|
cli.add_argument('-j', '--to-json', {
|
|
help: argparse.SUPPRESS,
|
|
dest: 'json',
|
|
action: 'store_true'
|
|
});
|
|
|
|
cli.add_argument('-t', '--trace', {
|
|
help: 'Show stack trace on error',
|
|
action: 'store_true'
|
|
});
|
|
|
|
cli.add_argument('file', {
|
|
help: 'File to read, utf-8 encoded without BOM',
|
|
nargs: '?',
|
|
default: '-'
|
|
});
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
var options = cli.parse_args();
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
function readFile(filename, encoding, callback) {
|
|
if (options.file === '-') {
|
|
// read from stdin
|
|
|
|
var chunks = [];
|
|
|
|
process.stdin.on('data', function (chunk) {
|
|
chunks.push(chunk);
|
|
});
|
|
|
|
process.stdin.on('end', function () {
|
|
return callback(null, Buffer.concat(chunks).toString(encoding));
|
|
});
|
|
} else {
|
|
fs.readFile(filename, encoding, callback);
|
|
}
|
|
}
|
|
|
|
readFile(options.file, 'utf8', function (error, input) {
|
|
var output, isYaml;
|
|
|
|
if (error) {
|
|
if (error.code === 'ENOENT') {
|
|
console.error('File not found: ' + options.file);
|
|
process.exit(2);
|
|
}
|
|
|
|
console.error(
|
|
options.trace && error.stack ||
|
|
error.message ||
|
|
String(error));
|
|
|
|
process.exit(1);
|
|
}
|
|
|
|
try {
|
|
output = JSON.parse(input);
|
|
isYaml = false;
|
|
} catch (err) {
|
|
if (err instanceof SyntaxError) {
|
|
try {
|
|
output = [];
|
|
yaml.loadAll(input, function (doc) { output.push(doc); }, {});
|
|
isYaml = true;
|
|
|
|
if (output.length === 0) output = null;
|
|
else if (output.length === 1) output = output[0];
|
|
|
|
} catch (e) {
|
|
if (options.trace && err.stack) console.error(e.stack);
|
|
else console.error(e.toString(options.compact));
|
|
|
|
process.exit(1);
|
|
}
|
|
} else {
|
|
console.error(
|
|
options.trace && err.stack ||
|
|
err.message ||
|
|
String(err));
|
|
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
if (isYaml) console.log(JSON.stringify(output, null, ' '));
|
|
else console.log(yaml.dump(output));
|
|
});
|