Merge pull request #22 from Blergo/Testing

Testing
This commit is contained in:
Blergo 2024-07-03 15:27:06 +01:00 committed by GitHub
commit 0fb2153472
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 21 deletions

View file

@ -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

View file

@ -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 =

View file

@ -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:

View file

@ -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...")