diff --git a/README.md b/README.md index ca3b7412..188f3ec0 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ If you feel the urge to donate, [you can do so here](https://liberapay.com/NuSko Donate using Liberapay ## Support -* Use [the issue tracker](https://github.com/NuSkooler/enigma-bbs/issues) +* See [Discussions](https://github.com/NuSkooler/enigma-bbs/discussions) and [the issue tracker](https://github.com/NuSkooler/enigma-bbs/issues) * **Discussion on a ENiGMA BBS!** (see Boards below) * IRC: **#enigma-bbs** on **chat.freenode.net** ([webchat](https://webchat.freenode.net/?channels=enigma-bbs)) * FSX_ENG on [fsxNet](http://bbs.geek.nz/#fsxNet) or ARK_ENIG on [ArakNet](https://www.araknet.xyz/) available on many fine boards diff --git a/WHATSNEW.md b/WHATSNEW.md index c249ea65..0ef29581 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -15,6 +15,7 @@ This document attempts to track **major** changes and additions in ENiGMA½. For * File base search has had an improvement to search term handling. * `./oputil user group -group` to now accepts `~group` removing the need for special handling of the "-" character. #331 * A fix has been made to clean up old `file.db` entries when a file is removed. Previously stale records could be left or even recycled into new entries. Please see [UPGRADE.md](UPGRADE.md) for details on applying this fix (look for `tables_update_2020-11-29.sql`). +* The [./docs/modding/onelinerz.md](onelinerz) module can have `dbSuffix` set in it's `config` block to specify a separate DB file. For example to use as a requests list. ## 0.0.11-beta * Upgraded from `alpha` to `beta` -- The software is far along and mature enough at this point! diff --git a/core/onelinerz.js b/core/onelinerz.js index d840f731..679f5fec 100644 --- a/core/onelinerz.js +++ b/core/onelinerz.js @@ -135,7 +135,7 @@ exports.getModule = class OnelinerzModule extends MenuModule { self.db.each( `SELECT * FROM ( - SELECT * + SELECT * FROM onelinerz ORDER BY timestamp DESC LIMIT ${limit} @@ -248,8 +248,9 @@ exports.getModule = class OnelinerzModule extends MenuModule { async.series( [ function openDatabase(callback) { + const dbSuffix = self.menuConfig.config.dbSuffix; self.db = getTransactionDatabase(new sqlite3.Database( - getModDatabasePath(exports.moduleInfo), + getModDatabasePath(exports.moduleInfo, dbSuffix), err => { return callback(err); } @@ -260,7 +261,7 @@ exports.getModule = class OnelinerzModule extends MenuModule { `CREATE TABLE IF NOT EXISTS onelinerz ( id INTEGER PRIMARY KEY, user_id INTEGER_NOT NULL, - user_name VARCHAR NOT NULL, + user_name VARCHAR NOT NULL, oneliner VARCHAR NOT NULL, timestamp DATETIME NOT NULL );` diff --git a/docs/configuration/menu-hjson.md b/docs/configuration/menu-hjson.md index 0c409d2f..ab935222 100644 --- a/docs/configuration/menu-hjson.md +++ b/docs/configuration/menu-hjson.md @@ -3,13 +3,15 @@ layout: page title: Menu HSJON --- ## Menu HJSON -The core of a ENiGMA½ based BBS is `menu.hjson`. Note that when `menu.hjson` is referenced, we're actually talking about `config/menus/yourboardname-*.hjson`. These files determines the menus (or screens) a user can see, the order they come in, how they interact with each other, ACS configuration, and so on. Like all configuration within ENiGMA½, menu configuration is done in [HJSON](https://hjson.org/) format. See [HJSON General Information](hjson.md) for more information. +The core of a ENiGMA½ based BBS is it's menus driven by what will be referred to as `menu.hjson`. Throughout ENiGMA½ documentation, when `menu.hjson` is referenced, we're actually talking about `config/menus/yourboardname-*.hjson`. These files determine the menus (or screens) a user can see, the order they come in, how they interact with each other, ACS configuration, and so on. Like all configuration within ENiGMA½, menu configuration is done in [HJSON](https://hjson.org/) format. -Entries in `menu.hjson` are often referred to as *blocks* or *sections*. Each entry defines a menu. A menu in this sense is something the user can see or visit. Examples include but are not limited to: +:information_source: See also [HJSON General Information](hjson.md) for more information on the HJSON file format. -* Classical Main, Messages, and File menus -* Art file display -* Module driven menus such as door launchers and other custom mods +:bulb: Entries in `menu.hjson` are often referred to as *blocks* or *sections*. Each entry defines a menu. A menu in this sense is something the user can see or visit. Examples include but are not limited to: + +* Classical navigation and menus such as Main, Messages, and Files. +* Art file display. +* Module driven menus such as [door launchers](../modding/local-doors.md), [Onelinerz](../modding/onelinzerz.md), and other custom mods. Menu entries live under the `menus` section of `menu.hjson`. The *key* for a menu is it's name that can be referenced by other menus and areas of the system. @@ -25,24 +27,25 @@ As you can see a menu can be very simple. :information_source: Remember that the top level menu may include additional files using the `includes` directive. See [Configuration Files](config-files.md) for more information on this. ## Common Menu Entry Members -Below is a table of **common** menu entry members. These members apply to most entries, though entries that are backed by a specialized module (ie: `module: bbs_list`) may differ. See documentation for the module in question for particulars. +Below is a table of **common** menu entry members. These members apply to most entries, though entries that are backed by a specialized module (ie: `module: bbs_list`) may differ. Menus that use their own module contain a `module` declaration: + +```hjson +module: some_fancy_module +``` + +See documentation for the module in question for particulars. | Item | Description | |--------|--------------| | `desc` | A friendly description that can be found in places such as "Who's Online" or wherever the `%MD` MCI code is used. | | `art` | An art file *spec*. See [General Art Information](../art/general.md). | -| `next` | Specifies the next menu entry to go to next. Can be explicit or an array of possibilities dependent on ACS. See **Flow Control** in the **ACS Checks** section below. If `next` is not supplied, the next menu is this menus parent. Note that special built in methods such as `@systemMethod:logoff` can also be utilized here. | +| `next` | Specifies the menu to go to next. Can be explicit or an array of possibilities dependent on ACS. See **Flow Control** in the **ACS Checks** section below. If `next` is not supplied, the next menu is this menus parent. Note that special built in methods such as `@systemMethod:logoff` can also be utilized here. | | `prompt` | Specifies a prompt, by name, to use along with this menu. Prompts are configured in the `prompts` section. See **Prompts** for more information. | | `submit` | Defines a submit handler when using `prompt`. | `form` | An object defining one or more *forms* available on this menu. | -| `module` | Sets the module name to use for this menu. See **Menu Modules** below. | +| `module` | Sets the module name to use for this menu. The system ships with many build in modules or you can build your own! | | `config` | An object containing additional configuration. See **Config Block** below. | -### Menu Modules -A given menu entry is backed by a *menu module*. That is, the code behind it. Menus are considered "standard" if the `module` member is not specified (and therefore backed by `core/standard_menu.js`). - -See [Menu Modules](../modding/menu-modules.md) for more information. - ### Config Block The `config` block for a menu entry can contain common members as well as a per-module (when `module` is used) settings. @@ -267,6 +270,31 @@ someMenu: { } ``` +## Case Study: Adding a Sub Menu to Main +A very common task: You want to add a new menu accessible from "Main". First, let's create a new menu called "Snazzy Town"! Perhaps under the `mainMenu` entry somewhere, create a new menu: + +```hjson +snazzyTown: { + desc: Snazzy Town + art: snazzy + config: { + cls: true + pause: true + } +} +``` + +Now let's make it accessible by "S" from the main menu. By default the main menu entry is named `mainMenu`. Within the `mainMenu`'s `submit` block you will see some existing action matches to "command". Simply add a new one pointing to `snazzyTown`: + +```hjson +{ + value: { command: "S" } + action: @menu:snazzyTown +} +``` + +That's it! When users type "S" at the main menu, they'll be sent to the Snazzy Town menu. Since we did not supply additional flow logic when they exit, they will fall back to main. + ## Case Study: Adding a New User Password (NUP) You've got a super 31337 board and want to prevent lamerz! Let's run through adding a NUP to your application flow. diff --git a/docs/modding/onelinerz.md b/docs/modding/onelinerz.md index 92515617..001c4e04 100644 --- a/docs/modding/onelinerz.md +++ b/docs/modding/onelinerz.md @@ -9,6 +9,7 @@ The built in `onelinerz` module provides a retro onelinerz system. ### Config Block Available `config` block entries: * `dateTimeFormat`: [moment.js](https://momentjs.com) style format. Defaults to current theme → system `short` date format. +* `dbSuffix`: Provide a suffix that will be appended to the DB name to use onelinerz for more than one purpose (separate lists). ### Theming The following `itemFormat` object is provided to MCI 1 (ie: `%VM1`): diff --git a/yarn.lock b/yarn.lock index 0ea64d4f..9b287f50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1161,9 +1161,9 @@ ini-config-parser@^1.0.4: rimraf "^2.6.1" ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" - integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== + version "1.3.7" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" + integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== inquirer@7.3.3: version "7.3.3"