Till Tomczak 2d33753b94 feat: Major updates to backend structure and security enhancements
- Removed `COMMON_ERRORS.md` file to streamline documentation.
- Added `Flask-Limiter` for rate limiting and `redis` for session management in `requirements.txt`.
- Expanded `ROADMAP.md` to include completed security features and planned enhancements for version 2.2.
- Enhanced `setup_myp.sh` for ultra-secure kiosk installation, including system hardening and security configurations.
- Updated `app.py` to integrate CSRF protection and improved logging setup.
- Refactored user model to include username and active status for better user management.
- Improved job scheduler with uptime tracking and task management features.
- Updated various templates for a more cohesive user interface and experience.
2025-05-25 20:33:38 +02:00

65 lines
1.6 KiB
JavaScript

var readline = require('readline')
var Promise = require('any-promise')
var objectAssign = require('object-assign')
var Interface = readline.Interface
function wrapCompleter (completer) {
if (completer.length === 2) return completer
return function (line, cb) {
var result = completer(line)
if (typeof result.then !== 'function') {
return cb(null, result)
}
result.catch(cb).then(function (result) {
process.nextTick(function () { cb(null, result) })
})
}
}
function InterfaceAsPromised (input, output, completer, terminal) {
if (arguments.length === 1) {
var options = input
if (typeof options.completer === 'function') {
options = objectAssign({}, options, {
completer: wrapCompleter(options.completer)
})
}
Interface.call(this, options)
} else {
if (typeof completer === 'function') {
completer = wrapCompleter(completer)
}
Interface.call(this, input, output, completer, terminal)
}
}
InterfaceAsPromised.prototype = Object.create(Interface.prototype)
InterfaceAsPromised.prototype.question = function (question, callback) {
if (typeof callback === 'function') {
return Interface.prototype.question.call(this, question, callback)
}
var self = this
return new Promise(function (resolve) {
Interface.prototype.question.call(self, question, resolve)
})
}
objectAssign(exports, readline, {
Interface: InterfaceAsPromised,
createInterface: function (input, output, completer, terminal) {
if (arguments.length === 1) {
return new InterfaceAsPromised(input)
}
return new InterfaceAsPromised(input, output, completer, terminal)
}
})