diff --git a/command_handlers.py b/command_handlers.py index 78be576..044a36d 100644 --- a/command_handlers.py +++ b/command_handlers.py @@ -37,16 +37,21 @@ def handle_exit_command(sender_id, interface): def handle_help_command(sender_id, interface, state=None): title = "█▓▒░ Yorkshire BBS ░▒▓█\n\n" - commands = [ - "[M]ail", - "[B]ulletin", - "[S]tats", - #"[F]ortune", - #"[W]all of Shame", - #"[C]hannel Directory", - #"EXIT: Exit current menu", - "[H]elp" - ] + commands = [] + if mail in interface.disabled == False: + commands.append("[M]ail") + if bulletin in interface.disabled == False: + commands.append("[B]ulletin") + if stats in interface.disabled == False: + commands.append("[S]tats") + if fortune in interface.disabled == False: + commands.append("[F]ortune") + if wos in interface.disabled == False: + commands.append("[W]all of Shame") + if channel in interface.disabled == False: + commands.append("[C]hannel Directory") + commands.append("[H]elp") + if state and 'command' in state: current_command = state['command'] if current_command == 'MAIL': @@ -107,7 +112,7 @@ def handle_stats_steps(sender_id, message, step, interface, bbs_nodes): la2 = str(psutil.getloadavg()[1]) la3 = str(psutil.getloadavg()[2]) ramu = str(psutil.virtual_memory().percent) - response = "Version: 0.1.02_Dev\nCPU: " + cpu + "Mhz\nLoad: " + la1 + ", " + la2 + ", " + la3 + "\nRAM: " + ramu + "% Used" + response = "Version: 0.1.03_Dev\nCPU: " + cpu + "Mhz\nLoad: " + la1 + ", " + la2 + ", " + la3 + "\nRAM: " + ramu + "% Used" send_message(response, sender_id, interface) handle_stats_command(sender_id, interface) return diff --git a/config.ini b/config.ini index fcd278a..e6a096e 100644 --- a/config.ini +++ b/config.ini @@ -39,12 +39,11 @@ type = serial ######################### #### Enabled Modules #### ######################### -#All modules are enaabled by default but can be removed from the menu by uncommenting thre below lines. +# All modules are enaabled by default but can be removed from the menu by adding them below. +# Available modules: mail, bulletin, stats, fortune, wos, channel +# Example: +# [modules] +# disabled = fortune, channel # [modules] -# mail = False -# bulletin = False -# stats = False -# fortune = False -# wos = False -# channel = False +# disabled = diff --git a/config_init.py b/config_init.py index 17820b7..b9a0073 100644 --- a/config_init.py +++ b/config_init.py @@ -110,7 +110,11 @@ def initialize_config(config_file:str = None) -> dict[str, Any]: if bbs_nodes == ['']: bbs_nodes = [] - return {'config':config, 'interface_type': interface_type, 'hostname': hostname, 'port': port, 'bbs_nodes': bbs_nodes, 'mqtt_topic': 'meshtastic.receive'} + disabled = config.get('modules', 'disabled', fallback='').split(',') + if disabled == ['']: + disabled = [] + + return {'config':config, 'interface_type': interface_type, 'hostname': hostname, 'port': port, 'bbs_nodes': bbs_nodes, 'disabled': disabled, 'mqtt_topic': 'meshtastic.receive'} def get_interface(system_config:dict[str, Any]) -> meshtastic.stream_interface.StreamInterface: diff --git a/server.py b/server.py index 899b448..d3e1b43 100644 --- a/server.py +++ b/server.py @@ -4,7 +4,7 @@ TC²-BBS Server for Meshtastic by TheCommsChannel (TC²) Date: 03/07/2024 Yorkshire BBS Edition -Version: 0.1.02_Dev +Version: 0.1.03_Dev Description: The system allows for mail message handling, bulletin boards, and a channel @@ -33,7 +33,7 @@ def display_banner(): ██║ ╚██████╗███████╗ ██████╔╝██████╔╝███████║ ╚═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ Yorkshire BBS Edition -Version: 0.1.02_Dev +Version: 0.1.03_Dev """ print(banner) @@ -54,6 +54,7 @@ def main(): interface = get_interface(system_config) interface.bbs_nodes = system_config['bbs_nodes'] + interface.disabled = system_config['disabled'] logging.info(f"TC²-BBS is running on {system_config['interface_type']} interface...")