From 7cbe619235c5107f163e97fca8a4d03ce095e094 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 06:15:16 +0000 Subject: [PATCH 1/9] Bump nokogiri from 1.13.6 to 1.14.3 in /docs Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.6 to 1.14.3. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.6...v1.14.3) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 036fe106..84f8d09b 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -77,12 +77,12 @@ GEM rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) minitest (5.17.0) - nokogiri (1.13.6-x86_64-linux) + nokogiri (1.14.3-x86_64-linux) racc (~> 1.4) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.6) - racc (1.6.0) + racc (1.6.2) rb-fsevent (0.11.0) rb-inotify (0.10.1) ffi (~> 1.0) From c39cd613efa1e404b8f0c6371cb2caddc8ae2999 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 16 Apr 2023 20:09:15 +0000 Subject: [PATCH 2/9] Bump minimatch from 3.0.4 to 3.1.2 Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2. - [Release notes](https://github.com/isaacs/minimatch/releases) - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2) --- updated-dependencies: - dependency-name: minimatch dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index a687e866..b8e5531d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1435,14 +1435,7 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -"minimatch@2 || 3", minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^3.1.1, minimatch@^3.1.2: +"minimatch@2 || 3", minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -1450,9 +1443,9 @@ minimatch@^3.1.1, minimatch@^3.1.2: brace-expansion "^1.1.7" minimatch@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" - integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== dependencies: brace-expansion "^2.0.1" From 78af6fa522b151d299d2e7940195564af1c06fc5 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 11 May 2023 12:07:29 -0600 Subject: [PATCH 3/9] Add oputil mb post command --- core/oputil/oputil_help.js | 6 ++ core/oputil/oputil_message_base.js | 133 +++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) diff --git a/core/oputil/oputil_help.js b/core/oputil/oputil_help.js index f13690b6..7104d827 100644 --- a/core/oputil/oputil_help.js +++ b/core/oputil/oputil_help.js @@ -184,6 +184,12 @@ General Information: Actions: list-confs List conferences and areas + post PATH Posts a message file specified in PATH. + PATH must point to a UTF-8 encoded JSON file + containing 'to', 'from', 'subject', 'areaTag', and + 'body'. If 'timestamp' is present, the system will + attempt to use it. + areafix CMD1 CMD2 ... ADDR Sends an AreaFix NetMail NetMail is sent to supplied address with the supplied command(s). Multi-part commands diff --git a/core/oputil/oputil_message_base.js b/core/oputil/oputil_message_base.js index 36cde188..bd23894b 100644 --- a/core/oputil/oputil_message_base.js +++ b/core/oputil/oputil_message_base.js @@ -716,6 +716,138 @@ const listConferences = () => { }); }; +const postMessage = () => { + const inputFile = argv._[argv._.length - 1]; + if (argv._.length < 3 || !inputFile || 0 === inputFile.length) { + return printUsageAndSetExitCode(getHelpFor('MessageBase'), ExitCodes.ERROR); + } + + async.waterfall( + [ + callback => { + return initConfigAndDatabases(callback); + }, + callback => { + fs.readFile(inputFile, { encoding: 'utf-8' }, (err, jsonData) => { + if (err) { + return callback(err); + } + + let messageJson; + try { + messageJson = JSON.parse(jsonData); + } catch (e) { + return callback(e); + } + + for (let f of ['to', 'from', 'subject', 'body', 'areaTag']) { + if (!_.isString(messageJson[f])) { + return callback( + Errors.MissingConfig( + `Missing "${f}" field in message JSON` + ) + ); + } + + messageJson[f] = messageJson[f].trim(); + if (messageJson[f].length === 0 && f !== 'subject') { + return callback( + Errors.Invalid( + `"${messageJson[f]}" is not a valid value for the "${f}" field` + ) + ); + } + } + + const { getMessageAreaByTag } = require('../../core/message_area'); + + const area = getMessageAreaByTag(messageJson.areaTag); + if (!area) { + return callback( + Errors.DoesNotExist( + `Area "${messageJson.areaTag}" does not exist` + ) + ); + } + + const { getAddressedToInfo } = require('../../core/mail_util'); + const Message = require('../../core/message'); + + const toInfo = getAddressedToInfo(messageJson.to); + const fromInfo = getAddressedToInfo(messageJson.from); + + if (fromInfo.flavor !== Message.AddressFlavor.Local) { + return callback( + Errors.Invalid( + 'Only local "from" users are currently supported' + ) + ); + } + + let modTimestamp; + if (_.isString(messageJson.timestamp)) { + modTimestamp = moment(messageJson.timestamp); + } + + if (!modTimestamp || !modTimestamp.isValid()) { + modTimestamp = moment(); + } + + const message = new Message({ + toUserName: messageJson.to, + fromUserName: messageJson.from, + subject: messageJson.subject, + message: messageJson.body, + areaTag: messageJson.areaTag, + modTimestamp, + }); + + if (toInfo.flavor !== Message.AddressFlavor.Local) { + message.setExternalFlavor(toInfo.flavor); + message.setRemoteToUser(toInfo.remote); + + return callback(null, area, message); + } + + const User = require('../../core/user'); + User.getUserIdAndNameByLookup( + message.toUserName, + (err, toUserId, toUserName) => { + if (err) { + return callback( + Errors.DoesNotExist( + `User "${message.toUserName}" does not exist.` + ) + ); + } + + message.to = toUserName; // adjust case/etc. + message.setLocalToUserId(toUserId); + + return callback(null, area, message); + } + ); + }); + }, + (area, message, callback) => { + message.persist(err => { + if (!err) { + console.info( + `Message from ${message.fromUserName} to ${message.toUserName}: "${message.subject}" in ${area.name}` + ); + } + return callback(err); + }); + }, + ], + err => { + if (err) { + return console.error(err.reason ? err.reason : err.message); + } + } + ); +}; + function handleMessageBaseCommand() { function errUsage() { return printUsageAndSetExitCode(getHelpFor('MessageBase'), ExitCodes.ERROR); @@ -734,6 +866,7 @@ function handleMessageBaseCommand() { 'qwk-dump': dumpQWKPacket, 'qwk-export': exportQWKPacket, 'list-confs': listConferences, + post: postMessage, }[action] || errUsage )(); } From 8d6de56e91a8dfbd4c60864ef9d10eaa2b9e307b Mon Sep 17 00:00:00 2001 From: "Parker J. Banks" Date: Sun, 21 May 2023 12:09:54 -0600 Subject: [PATCH 4/9] Rumorz display bugfix Updates rumorz module to display the N latest rumors, rather than the first N rumors. --- core/rumorz.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/rumorz.js b/core/rumorz.js index 65ebc251..d2c24756 100644 --- a/core/rumorz.js +++ b/core/rumorz.js @@ -172,7 +172,7 @@ exports.getModule = class RumorzModule extends MenuModule { StatLog.getSystemLogEntries( SystemLogKeys.UserAddedRumorz, - StatLog.Order.Timestamp, + StatLog.Order.TimestampDesc, (err, entries) => { return callback(err, entriesView, entries); } From eca900f8293245a64a6729cc43588268efb19381 Mon Sep 17 00:00:00 2001 From: "Parker J. Banks" Date: Mon, 19 Jun 2023 10:43:25 -0600 Subject: [PATCH 5/9] Update theme.hjson Bugfix, change messageBaseSearchMessageList to messageBaseSearchResultsMessageList to match message_base.in.hjson --- art/themes/luciano_blocktronics/theme.hjson | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/art/themes/luciano_blocktronics/theme.hjson b/art/themes/luciano_blocktronics/theme.hjson index 8f6d01d7..582432ec 100644 --- a/art/themes/luciano_blocktronics/theme.hjson +++ b/art/themes/luciano_blocktronics/theme.hjson @@ -595,7 +595,7 @@ } } - messageBaseSearchMessageList: { + messageBaseSearchResultsMessageList: { config: { allViewsInfoFormat10: "|00|15{msgNumSelected:>4.4} |08/ |15{msgNumTotal:<4.4}" // Fri Sep 25th @@ -1364,4 +1364,4 @@ } } } -} \ No newline at end of file +} From 67b5a8d99f5ef878b90146bce52bfb4f6ba01b4d Mon Sep 17 00:00:00 2001 From: Nathan Byrd Date: Mon, 21 Aug 2023 19:58:16 -0500 Subject: [PATCH 6/9] Fixed bad image path --- docs/_docs/servers/loginservers/websocket.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_docs/servers/loginservers/websocket.md b/docs/_docs/servers/loginservers/websocket.md index a2c26754..511fb522 100644 --- a/docs/_docs/servers/loginservers/websocket.md +++ b/docs/_docs/servers/loginservers/websocket.md @@ -101,6 +101,6 @@ webserver, and unpack it to a temporary directory. otherwise. 9. If you navigate to http://your-hostname.here/vtx.html, you should see a splash screen like the following: - ![VTXClient](../assets/images/vtxclient.png "VTXClient") + ![VTXClient](../../assets/images/vtxclient.png "VTXClient") From 1cfbf4fb663411c380be581fd4f1535b4cf7dd92 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 23 Aug 2023 18:06:48 -0600 Subject: [PATCH 7/9] Update MenuFlags to work as expected * 'popParent' has been removed * 'noHistory' now works as expected * Mods that explicitly want noHistory can state such in their constructor() --- WHATSNEW.md | 1 + core/file_area_list.js | 6 +- core/file_base_area_select.js | 6 +- core/file_base_download_manager.js | 6 +- core/file_base_search.js | 1 - core/file_base_user_list_export.js | 5 +- core/file_base_web_download_manager.js | 6 +- core/menu_module.js | 22 ++++++ core/menu_stack.js | 82 ++++++++--------------- core/message_base_search.js | 2 - core/msg_area_list.js | 7 +- core/msg_conf_list.js | 7 +- core/my_messages.js | 5 +- core/show_art.js | 2 +- core/upload.js | 4 +- docs/_docs/admin/oputil.md | 2 +- docs/_docs/configuration/menu-hjson.md | 10 +-- docs/_docs/modding/show-art.md | 1 - misc/menu_templates/file_base.in.hjson | 8 +-- misc/menu_templates/message_base.in.hjson | 4 +- 20 files changed, 96 insertions(+), 91 deletions(-) diff --git a/WHATSNEW.md b/WHATSNEW.md index 708653f0..060bf502 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -8,6 +8,7 @@ This document attempts to track **major** changes and additions in ENiGMA½. For * Routes for the file base now default to `/_f/` prefixed instead of just `/f/`. If `/f/` is in your `config.hjson` you are encouraged to update it! * Finally, the system will search for `index.html` and `index.htm` in that order, if another suitable route cannot be established. * CombatNet has shut down, so the module (`combatnet.js`) has been removed. +* The Menu Flag `popParent` has been removed and `noHistory` has been updated to work as expected. In general things should "Just Work", but check your `menu.hjson` entries if you see menu stack issues. ## 0.0.13-beta * **Note for contributors**: ENiGMA has switched to [Prettier](https://prettier.io) for formatting/style. Please see [CONTRIBUTING](CONTRIBUTING.md) and the Prettier website for more information. diff --git a/core/file_area_list.js b/core/file_area_list.js index 9a778468..eeafb4f5 100644 --- a/core/file_area_list.js +++ b/core/file_area_list.js @@ -2,10 +2,8 @@ 'use strict'; // ENiGMA½ -const MenuModule = require('./menu_module.js').MenuModule; -const ViewController = require('./view_controller.js').ViewController; +const { MenuModule, MenuFlags } = require('./menu_module.js'); const ansi = require('./ansi_term.js'); -const theme = require('./theme.js'); const FileEntry = require('./file_entry.js'); const stringFormat = require('./string_format.js'); const FileArea = require('./file_base_area.js'); @@ -77,6 +75,8 @@ exports.getModule = class FileAreaList extends MenuModule { this.fileList = _.get(options, 'extraArgs.fileList'); this.lastFileNextExit = _.get(options, 'extraArgs.lastFileNextExit', true); + this.setMergedFlag(MenuFlags.NoHistory); + if (this.fileList) { // we'll need to adjust position as well! this.fileListPosition = 0; diff --git a/core/file_base_area_select.js b/core/file_base_area_select.js index f936207d..5993f259 100644 --- a/core/file_base_area_select.js +++ b/core/file_base_area_select.js @@ -2,7 +2,7 @@ 'use strict'; // enigma-bbs -const MenuModule = require('./menu_module.js').MenuModule; +const { MenuModule, MenuFlags } = require('./menu_module.js'); const { getSortedAvailableFileAreas } = require('./file_base_area.js'); const StatLog = require('./stat_log.js'); const SysProps = require('./system_property.js'); @@ -24,6 +24,8 @@ exports.getModule = class FileAreaSelectModule extends MenuModule { constructor(options) { super(options); + this.setMergedFlag(MenuFlags.NoHistory); + this.menuMethods = { selectArea: (formData, extraArgs, cb) => { const filterCriteria = { @@ -34,7 +36,7 @@ exports.getModule = class FileAreaSelectModule extends MenuModule { extraArgs: { filterCriteria: filterCriteria, }, - menuFlags: ['popParent', 'mergeFlags'], + menuFlags: [ MenuFlags.NoHistory ], }; return this.gotoMenu( diff --git a/core/file_base_download_manager.js b/core/file_base_download_manager.js index b8564b73..3bebb7d1 100644 --- a/core/file_base_download_manager.js +++ b/core/file_base_download_manager.js @@ -2,10 +2,8 @@ 'use strict'; // ENiGMA½ -const MenuModule = require('./menu_module.js').MenuModule; -const ViewController = require('./view_controller.js').ViewController; +const { MenuModule, MenuFlags } = require('./menu_module.js'); const DownloadQueue = require('./download_queue.js'); -const theme = require('./theme.js'); const ansi = require('./ansi_term.js'); const Errors = require('./enig_error.js').Errors; const FileAreaWeb = require('./file_area_web.js'); @@ -38,6 +36,8 @@ exports.getModule = class FileBaseDownloadQueueManager extends MenuModule { constructor(options) { super(options); + this.setMergedFlag(MenuFlags.NoHistory); + this.dlQueue = new DownloadQueue(this.client); if (_.has(options, 'lastMenuResult.sentFileIds')) { diff --git a/core/file_base_search.js b/core/file_base_search.js index 13e109fb..6b573551 100644 --- a/core/file_base_search.js +++ b/core/file_base_search.js @@ -121,7 +121,6 @@ exports.getModule = class FileBaseSearch extends MenuModule { extraArgs: { filterCriteria: filterCriteria, }, - menuFlags: ['popParent'], }; return this.gotoMenu( diff --git a/core/file_base_user_list_export.js b/core/file_base_user_list_export.js index 57b28ac2..e453c0b3 100644 --- a/core/file_base_user_list_export.js +++ b/core/file_base_user_list_export.js @@ -2,7 +2,7 @@ 'use strict'; // ENiGMA½ -const { MenuModule } = require('./menu_module.js'); +const { MenuModule, MenuFlags } = require('./menu_module.js'); const FileEntry = require('./file_entry.js'); const FileArea = require('./file_base_area.js'); const { renderSubstr } = require('./string_util.js'); @@ -65,6 +65,9 @@ const MciViewIds = { exports.getModule = class FileBaseListExport extends MenuModule { constructor(options) { super(options); + + this.setMergedFlag(MenuFlags.NoHistory); + this.config = Object.assign( {}, _.get(options, 'menuConfig.config'), diff --git a/core/file_base_web_download_manager.js b/core/file_base_web_download_manager.js index 233a247e..fc560b87 100644 --- a/core/file_base_web_download_manager.js +++ b/core/file_base_web_download_manager.js @@ -2,10 +2,8 @@ 'use strict'; // ENiGMA½ -const MenuModule = require('./menu_module.js').MenuModule; -const ViewController = require('./view_controller.js').ViewController; +const { MenuModule, MenuFlags } = require('./menu_module.js'); const DownloadQueue = require('./download_queue.js'); -const theme = require('./theme.js'); const ansi = require('./ansi_term.js'); const Errors = require('./enig_error.js').Errors; const FileAreaWeb = require('./file_area_web.js'); @@ -40,6 +38,8 @@ exports.getModule = class FileBaseWebDownloadQueueManager extends MenuModule { constructor(options) { super(options); + this.setMergedFlag(MenuFlags.NoHistory); + this.dlQueue = new DownloadQueue(this.client); this.menuMethods = { diff --git a/core/menu_module.js b/core/menu_module.js index 335c6e43..afa4c998 100644 --- a/core/menu_module.js +++ b/core/menu_module.js @@ -20,6 +20,23 @@ const assert = require('assert'); const _ = require('lodash'); const iconvDecode = require('iconv-lite').decode; +const MenuFlags = { + // When leaving this menu to load/chain to another, remove this + // menu from history. In other words, the fallback from + // the next menu would *not* be this one, but the previous. + NoHistory: 'noHistory', + + // Generally used in code only: Request that any flags from menu.hjson + // are merged in to the total set of flags vs overriding the default. + MergeFlags: 'mergeFlags', + + // Forward this menu's 'extraArgs' to the next. + ForwardArgs: 'forwardArgs', +}; + +exports.MenuFlags = MenuFlags; + + exports.MenuModule = class MenuModule extends PluginModule { constructor(options) { super(options); @@ -48,6 +65,11 @@ exports.MenuModule = class MenuModule extends PluginModule { }); } + setMergedFlag(flag) { + this.menuConfig.config.menuFlags.push(flag); + this.menuConfig.config.menuFlags = [...new Set([...this.menuConfig.config.menuFlags, MenuFlags.MergeFlags])]; + } + static get InterruptTypes() { return { Never: 'never', diff --git a/core/menu_stack.js b/core/menu_stack.js index 961fdc7e..fcd5f0bf 100644 --- a/core/menu_stack.js +++ b/core/menu_stack.js @@ -5,12 +5,12 @@ const loadMenu = require('./menu_util.js').loadMenu; const { Errors, ErrorReasons } = require('./enig_error.js'); const { getResolvedSpec } = require('./menu_util.js'); +const { MenuFlags } = require('./menu_module.js'); // deps const _ = require('lodash'); const assert = require('assert'); - -// :TODO: Stack is backwards.... top should be most recent! :) +const bunyan = require('bunyan'); module.exports = class MenuStack { constructor(client) { @@ -27,19 +27,11 @@ module.exports = class MenuStack { } peekPrev() { - if (this.stackSize > 1) { - return this.stack[this.stack.length - 2]; - } + return this.stack[this.stack.length - 2]; } top() { - if (this.stackSize > 0) { - return this.stack[this.stack.length - 1]; - } - } - - get stackSize() { - return this.stack.length; + return this.stack[this.stack.length - 1]; } get currentModule() { @@ -56,13 +48,13 @@ module.exports = class MenuStack { return cb( Array.isArray(menuConfig.next) ? Errors.MenuStack( - 'No matching condition for "next"', - ErrorReasons.NoConditionMatch - ) + 'No matching condition for "next"', + ErrorReasons.NoConditionMatch + ) : Errors.MenuStack( - 'Invalid or missing "next" member in menu config', - ErrorReasons.InvalidNextMenu - ) + 'Invalid or missing "next" member in menu config', + ErrorReasons.InvalidNextMenu + ) ); } @@ -81,7 +73,6 @@ module.exports = class MenuStack { prev(cb) { const menuResult = this.top().instance.getMenuResult(); - // :TODO: leave() should really take a cb... this.pop().instance.leave(); // leave & remove current const previousModuleInfo = this.pop(); // get previous @@ -129,7 +120,7 @@ module.exports = class MenuStack { client: self.client, }; - if (currentModuleInfo && currentModuleInfo.menuFlags.includes('forwardArgs')) { + if (currentModuleInfo && currentModuleInfo.menuFlags.includes(MenuFlags.ForwardArgs)) { loadOpts.extraArgs = currentModuleInfo.extraArgs; } else { loadOpts.extraArgs = options.extraArgs || _.get(options, 'formData.value'); @@ -138,7 +129,6 @@ module.exports = class MenuStack { loadMenu(loadOpts, (err, modInst) => { if (err) { - // :TODO: probably should just require a cb... const errCb = cb || self.client.defaultHandlerMissingMod(); errCb(err); } else { @@ -151,22 +141,6 @@ module.exports = class MenuStack { return; } - // - // Handle deprecated 'options' block by merging to config and warning user. - // :TODO: Remove in 0.0.10+ - // - if (modInst.menuConfig.options) { - self.client.log.warn( - { options: modInst.menuConfig.options }, - 'Use of "options" is deprecated. Move relevant members to "config" block! Support will be fully removed in future versions' - ); - Object.assign( - modInst.menuConfig.config || {}, - modInst.menuConfig.options - ); - delete modInst.menuConfig.options; - } - // // If menuFlags were supplied in menu.hjson, they should win over // anything supplied in code. @@ -180,9 +154,9 @@ module.exports = class MenuStack { // in code we can ask to merge in if ( Array.isArray(options.menuFlags) && - options.menuFlags.includes('mergeFlags') + options.menuFlags.includes(MenuFlags.MergeFlags) ) { - menuFlags = _.uniq(menuFlags.concat(options.menuFlags)); + menuFlags = [...new Set(options.menuFlags)]; // make unique } } @@ -193,12 +167,8 @@ module.exports = class MenuStack { currentModuleInfo.instance.leave(); - if (currentModuleInfo.menuFlags.includes('noHistory')) { - this.pop(); - } - - if (menuFlags.includes('popParent')) { - this.pop().instance.leave(); // leave & remove current + if (currentModuleInfo.menuFlags.includes(MenuFlags.NoHistory)) { + this.pop().instance.leave(); // leave & remove current from stack } } @@ -214,17 +184,19 @@ module.exports = class MenuStack { modInst.restoreSavedState(options.savedState); } - const stackEntries = self.stack.map(stackEntry => { - let name = stackEntry.name; - if (stackEntry.instance.menuConfig.config.menuFlags.length > 0) { - name += ` (${stackEntry.instance.menuConfig.config.menuFlags.join( - ', ' - )})`; - } - return name; - }); + if (self.client.log.level() <= bunyan.TRACE) { + const stackEntries = self.stack.map(stackEntry => { + let name = stackEntry.name; + if (stackEntry.instance.menuConfig.config.menuFlags.length > 0) { + name += ` (${stackEntry.instance.menuConfig.config.menuFlags.join( + ', ' + )})`; + } + return name; + }); - self.client.log.trace({ stack: stackEntries }, 'Updated menu stack'); + self.client.log.trace({ stack: stackEntries }, 'Updated menu stack'); + } modInst.enter(); diff --git a/core/message_base_search.js b/core/message_base_search.js index f98b0b89..e102f743 100644 --- a/core/message_base_search.js +++ b/core/message_base_search.js @@ -113,7 +113,6 @@ exports.getModule = class MessageBaseSearch extends MenuModule { const returnNoResults = () => { return this.gotoMenu( this.menuConfig.config.noResultsMenu || 'messageSearchNoResults', - { menuFlags: ['popParent'] }, cb ); }; @@ -160,7 +159,6 @@ exports.getModule = class MessageBaseSearch extends MenuModule { messageList, noUpdateLastReadId: true, }, - menuFlags: ['popParent'], }; return this.gotoMenu( diff --git a/core/msg_area_list.js b/core/msg_area_list.js index 43227a24..0639bc72 100644 --- a/core/msg_area_list.js +++ b/core/msg_area_list.js @@ -2,7 +2,7 @@ 'use strict'; // ENiGMA½ -const { MenuModule } = require('./menu_module.js'); +const { MenuModule, MenuFlags } = require('./menu_module.js'); const messageArea = require('./message_area.js'); const { Errors } = require('./enig_error.js'); const UserProps = require('./user_property.js'); @@ -29,6 +29,9 @@ exports.getModule = class MessageAreaListModule extends MenuModule { constructor(options) { super(options); + // always include noHistory flag + this.setMergedFlag(MenuFlags.NoHistory); + this.initList(); this.menuMethods = { @@ -49,7 +52,7 @@ exports.getModule = class MessageAreaListModule extends MenuModule { extraArgs: { areaTag: area.areaTag, }, - menuFlags: ['popParent', 'noHistory'], + menuFlags: [ MenuFlags.NoHistory ], }; return this.gotoMenu( diff --git a/core/msg_conf_list.js b/core/msg_conf_list.js index 74439be6..0769ed47 100644 --- a/core/msg_conf_list.js +++ b/core/msg_conf_list.js @@ -2,7 +2,7 @@ 'use strict'; // ENiGMA½ -const { MenuModule } = require('./menu_module.js'); +const { MenuModule, MenuFlags } = require('./menu_module.js'); const messageArea = require('./message_area.js'); const { Errors } = require('./enig_error.js'); @@ -26,6 +26,9 @@ exports.getModule = class MessageConfListModule extends MenuModule { constructor(options) { super(options); + // always include noHistory flag + this.setMergedFlag(MenuFlags.NoHistory); + this.initList(); this.menuMethods = { @@ -49,7 +52,7 @@ exports.getModule = class MessageConfListModule extends MenuModule { extraArgs: { confTag: conf.confTag, }, - menuFlags: ['popParent', 'noHistory'], + menuFlags: [ MenuFlags.NoHistory ], }; return this.gotoMenu( diff --git a/core/my_messages.js b/core/my_messages.js index 50bba7ae..0f1fe620 100644 --- a/core/my_messages.js +++ b/core/my_messages.js @@ -2,7 +2,7 @@ 'use strict'; // ENiGMA½ -const MenuModule = require('./menu_module.js').MenuModule; +const { MenuModule, MenuFlags } = require('./menu_module'); const Message = require('./message.js'); const UserProps = require('./user_property.js'); const { filterMessageListByReadACS } = require('./message_area.js'); @@ -16,6 +16,7 @@ exports.moduleInfo = { exports.getModule = class MyMessagesModule extends MenuModule { constructor(options) { super(options); + this.setMergedFlag(MenuFlags.NoHistory); } initSequence() { @@ -49,7 +50,6 @@ exports.getModule = class MyMessagesModule extends MenuModule { if (!this.messageList || 0 === this.messageList.length) { return this.gotoMenu( this.menuConfig.config.noResultsMenu || 'messageSearchNoResults', - { menuFlags: ['popParent'] } ); } @@ -58,7 +58,6 @@ exports.getModule = class MyMessagesModule extends MenuModule { messageList: this.messageList, noUpdateLastReadId: true, }, - menuFlags: ['popParent'], }; return this.gotoMenu( diff --git a/core/show_art.js b/core/show_art.js index 2359081c..9cbe303f 100644 --- a/core/show_art.js +++ b/core/show_art.js @@ -4,7 +4,6 @@ // ENiGMA½ const MenuModule = require('./menu_module.js').MenuModule; const Errors = require('../core/enig_error.js').Errors; -const ANSI = require('./ansi_term.js'); const Config = require('./config.js').get; const { getMessageAreaByTag } = require('./message_area.js'); @@ -21,6 +20,7 @@ exports.moduleInfo = { exports.getModule = class ShowArtModule extends MenuModule { constructor(options) { super(options); + this.config = Object.assign({}, _.get(options, 'menuConfig.config'), { extraArgs: options.extraArgs, }); diff --git a/core/upload.js b/core/upload.js index ec73a233..c055acb2 100644 --- a/core/upload.js +++ b/core/upload.js @@ -2,7 +2,7 @@ 'use strict'; // enigma-bbs -const MenuModule = require('./menu_module.js').MenuModule; +const { MenuModule, MenuFlags } = require('./menu_module'); const stringFormat = require('./string_format.js'); const getSortedAvailableFileAreas = require('./file_base_area.js').getSortedAvailableFileAreas; @@ -76,6 +76,8 @@ exports.getModule = class UploadModule extends MenuModule { constructor(options) { super(options); + this.setMergedFlag(MenuFlags.NoHistory); + this.interrupt = MenuModule.InterruptTypes.Never; if (_.has(options, 'lastMenuResult.recvFilePaths')) { diff --git a/docs/_docs/admin/oputil.md b/docs/_docs/admin/oputil.md index b2ee2892..f1463cc9 100644 --- a/docs/_docs/admin/oputil.md +++ b/docs/_docs/admin/oputil.md @@ -323,7 +323,7 @@ qwk-export arguments: | Action | Description | Examples | |-----------|-------------------|---------------------------------------| -| `import-areas` | Imports areas using a FidoNet style *.NA or AREAS.BBS formatted file. Optionally maps areas to FTN networks. | `./oputil.js config import-areas /some/path/l33tnet.na` | +| `import-areas` | Imports areas using a FidoNet style *.NA or AREAS.BBS formatted file. Optionally maps areas to FTN networks. | `./oputil.js mb import-areas /some/path/l33tnet.na` | | `areafix` | Utility for sending AreaFix mails without logging into the system | | | `qwk-dump` | Dump a QWK packet to stdout | `./oputil.js mb qwk-dump /path/to/XIBALBA.QWK` | | `qwk-export` | Export messages to a QWK packet | `./oputil.js mb qwk-export /path/to/XIBALBA.QWK` | diff --git a/docs/_docs/configuration/menu-hjson.md b/docs/_docs/configuration/menu-hjson.md index 9c358109..a376a8bd 100644 --- a/docs/_docs/configuration/menu-hjson.md +++ b/docs/_docs/configuration/menu-hjson.md @@ -59,13 +59,15 @@ The `config` block for a menu entry can contain common members as well as a per- | `menuFlags` | An array of menu flag(s) controlling menu behavior. See **Menu Flags** below. #### Menu Flags -The `menuFlags` field of a `config` block can change default behavior of a particular menu. +The `menuFlags` field of a `config` block can change default behavior of a particular menu: | Flag | Description | |------|-------------| -| `noHistory` | Prevents the menu from remaining in the menu stack / history. When this flag is set, when the **next** menu falls back, this menu will be skipped and the previous menu again displayed instead. Example: menuA -> menuB(noHistory) -> menuC: Exiting menuC returns the user to menuA. | -| `popParent` | When *this* menu is exited, fall back beyond the parent as well. Often used in combination with `noHistory`. | -| `forwardArgs` | If set, when the next menu is entered, forward any `extraArgs` arguments to *this* menu on to it. | +| `noHistory` | When leaving the current menu to load/chain to another, remove this menu from history. In other words, the fallback from the next menu would *not* be this one, but the previous. | +| `mergeFlags` | Generally used in code only: Request that any flags from `menu.hjson` | +| `forwardArgs` | Forward this menu's `extraArgs` to the next. | + +> 💡 In JavaScript code, `MenuFlags` from `menu_module.js` contains constants for these flags. ## Forms diff --git a/docs/_docs/modding/show-art.md b/docs/_docs/modding/show-art.md index 69be395d..8fd84b10 100644 --- a/docs/_docs/modding/show-art.md +++ b/docs/_docs/modding/show-art.md @@ -58,7 +58,6 @@ showFileBaseAreaArt: { method: fileBaseArea cls: true pause: true - menuFlags: [ "popParent", "noHistory" ] } } ``` diff --git a/misc/menu_templates/file_base.in.hjson b/misc/menu_templates/file_base.in.hjson index 8b102c68..a4fc1b11 100644 --- a/misc/menu_templates/file_base.in.hjson +++ b/misc/menu_templates/file_base.in.hjson @@ -388,7 +388,7 @@ art: FEMPTYQ config: { pause: true - menuFlags: [ "noHistory", "popParent" ] + menuFlags: [ "noHistory" ] } } @@ -779,7 +779,7 @@ art: FBNORES config: { pause: true - menuFlags: [ "noHistory", "popParent" ] + menuFlags: [ "noHistory" ] } } @@ -807,7 +807,7 @@ art: FBNORES config: { pause: true - menuFlags: [ "noHistory", "popParent" ] + menuFlags: [ "noHistory" ] } } @@ -852,7 +852,7 @@ art: ULNOAREA config: { pause: true - menuFlags: [ "noHistory", "popParent" ] + menuFlags: [ "noHistory" ] } } diff --git a/misc/menu_templates/message_base.in.hjson b/misc/menu_templates/message_base.in.hjson index d20d3077..a5fcebc8 100644 --- a/misc/menu_templates/message_base.in.hjson +++ b/misc/menu_templates/message_base.in.hjson @@ -776,7 +776,7 @@ key: confTag pause: true cls: true - menuFlags: [ "popParent", "noHistory" ] + menuFlags: [ "noHistory" ] } } @@ -794,7 +794,7 @@ key: areaTag pause: true cls: true - menuFlags: [ "popParent", "noHistory" ] + menuFlags: [ "noHistory" ] } } } From a1242b51aa628065f9372ff072da14bd4d24bf1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 01:03:06 +0000 Subject: [PATCH 8/9] Bump activesupport from 7.0.4.1 to 7.0.7.2 in /docs Bumps [activesupport](https://github.com/rails/rails) from 7.0.4.1 to 7.0.7.2. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.0.7.2/activesupport/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.0.4.1...v7.0.7.2) --- updated-dependencies: - dependency-name: activesupport dependency-type: indirect ... Signed-off-by: dependabot[bot] --- docs/Gemfile.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 036fe106..0bb3815d 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.4.1) + activesupport (7.0.7.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -9,7 +9,7 @@ GEM addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) colorator (1.1.0) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) cssminify2 (2.0.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) @@ -24,7 +24,7 @@ GEM nokogiri (>= 1.4) htmlcompressor (0.4.0) http_parser.rb (0.8.0) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) jekyll (4.2.1) addressable (~> 2.4) @@ -76,7 +76,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.4.0) - minitest (5.17.0) + minitest (5.19.0) nokogiri (1.13.6-x86_64-linux) racc (~> 1.4) pathutil (0.16.2) @@ -93,7 +93,7 @@ GEM ffi (~> 1.9) terminal-table (2.0.0) unicode-display_width (~> 1.1, >= 1.1.1) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) From 5857f46d11de8c9913dbe315ce8811dd29eebb47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 01:03:10 +0000 Subject: [PATCH 9/9] Bump semver from 6.3.0 to 6.3.1 Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1. - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1) --- updated-dependencies: - dependency-name: semver dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index b8e5531d..160861af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1997,14 +1997,14 @@ sanitize-filename@^1.6.3: truncate-utf8-bytes "^1.0.0" semver@^6.0.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.5: - version "7.3.7" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" - integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0"