mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
Good progress on 2FA/OTP config
This commit is contained in:
parent
b62f55961f
commit
8802ae24ba
7 changed files with 230 additions and 10 deletions
|
@ -16,6 +16,7 @@ const { getPredefinedMCIValue } = require('../core/predefined_mci.js');
|
|||
const async = require('async');
|
||||
const assert = require('assert');
|
||||
const _ = require('lodash');
|
||||
const iconvDecode = require('iconv-lite').decode;
|
||||
|
||||
exports.MenuModule = class MenuModule extends PluginModule {
|
||||
|
||||
|
@ -379,7 +380,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
);
|
||||
}
|
||||
|
||||
displayAsset(name, options, cb) {
|
||||
displayAsset(nameOrData, options, cb) {
|
||||
if(_.isFunction(options)) {
|
||||
cb = options;
|
||||
options = {};
|
||||
|
@ -389,10 +390,25 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
this.client.term.rawWrite(ansi.resetScreen());
|
||||
}
|
||||
|
||||
options = Object.assign( { client : this.client, font : this.menuConfig.config.font }, options );
|
||||
|
||||
if(Buffer.isBuffer(nameOrData)) {
|
||||
const data = iconvDecode(nameOrData, options.encoding || 'cp437');
|
||||
return theme.displayPreparedArt(
|
||||
options,
|
||||
{ data },
|
||||
(err, artData) => {
|
||||
if(cb) {
|
||||
return cb(err, artData);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return theme.displayThemedAsset(
|
||||
name,
|
||||
nameOrData,
|
||||
this.client,
|
||||
Object.assign( { font : this.menuConfig.config.font }, options ),
|
||||
options,
|
||||
(err, artData) => {
|
||||
if(cb) {
|
||||
return cb(err, artData);
|
||||
|
@ -513,7 +529,7 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
}
|
||||
|
||||
setViewText(formName, mciId, text, appendMultiLine) {
|
||||
const view = this.viewControllers[formName].getView(mciId);
|
||||
const view = this.getView(formName, mciId);
|
||||
if(!view) {
|
||||
return;
|
||||
}
|
||||
|
@ -525,6 +541,11 @@ exports.MenuModule = class MenuModule extends PluginModule {
|
|||
}
|
||||
}
|
||||
|
||||
getView(formName, id) {
|
||||
const form = this.viewControllers[formName];
|
||||
return form && form.getView(id);
|
||||
}
|
||||
|
||||
updateCustomViewTextsWithFilter(formName, startId, fmtObj, options) {
|
||||
options = options || {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue