diff --git a/CHANGELOG.md b/CHANGELOG.md index 1642caadea..d83f0cb0e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,7 +99,8 @@ Up requirements to Django 3.2+, Twisted 21+ because it's used for handlers, and e.g. self.locks=[] is a common beginner mistake. - Add `$pron()` inlinefunc for pronoun parsing in actor-stance strings using `msg_contents`. - +- Update defauklt website to show Telnet/SSL/SSH connect info. Added new + `SERVER_HOSTNAME` setting for use in the server:port stanza. ### Evennia 0.9.5 (2019-2020) diff --git a/evennia/settings_default.py b/evennia/settings_default.py index f22ba2737a..3dbfd3131d 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -27,6 +27,10 @@ SERVERNAME = "Evennia" # Short one-sentence blurb describing your game. Shown under the title # on the website and could be used in online listings of your game etc. GAME_SLOGAN = "The Python MUD/MU* creation system" +# The url address to your server, like mymudgame.com. This should be the publicly +# visible location. This is used e.g. on the web site to show how you connect to the +# game over telnet. Default is localhost (only on your machine). +SERVER_HOSTNAME = "localhost" # Lockdown mode will cut off the game from any external connections # and only allow connections from localhost. Requires a cold reboot. LOCKDOWN_MODE = False diff --git a/evennia/web/templates/website/index.html b/evennia/web/templates/website/index.html index f26be70131..6c3535b44e 100644 --- a/evennia/web/templates/website/index.html +++ b/evennia/web/templates/website/index.html @@ -24,21 +24,55 @@ into a full-fledged home for your game.
{% if webclient_enabled %} - + + {% endif %} + {% if telnet_enabled %} ++ Telnet: {{ server_hostname }}, port + {% for port in telnet_ports %} + {% if not forloop.first and forloop.last %} or + {% elif forloop.counter != 1 %}, + {% endif %} + {{ port }} + {% endfor %} +
+ {% endif %} + {% if telnet_ssl_enabled %} ++ Telnet (SSL): {{ server_hostname }}, port + {% for port in telnet_ssl_ports %} + {% if not forloop.first and forloop.last %} or + {% elif forloop.counter != 1 %}, + {% endif %} + {{ port }} + {% endfor %} +
+ {% endif %} + {% if ssh_enabled %} ++ SSH: {{ server_hostname }}, port + {% for port in ssh_ports %} + {% if not forloop.first and forloop.last %} or + {% elif forloop.counter != 1 %}, + {% endif %} + {{ port }} + {% endfor %} +
{% endif %}- For more info, take your time to - peruse Evennia's extensive online manual. + For more info, see the Evennia homepage or check + out our extensive online documentation.
- If you have any questions, don't hesitate to join the Evennia community! Drop a message in the Evennia forums
- or come say hi in the support/chat channels (IRC
- or Discord).
+ Don't hesitate asking questions to the Evennia community!
Drop a message
+ in the Evennia forums
+ or come say hi in the Discord support channel.
- If you find bugs, please report them to our Issue tracker on GitHub. + Evennia is Open source and can be found on GitHub. + If you find bugs, please report them to the Issue tracker.
diff --git a/evennia/web/utils/general_context.py b/evennia/web/utils/general_context.py index a2a9306bf3..b424c1707d 100644 --- a/evennia/web/utils/general_context.py +++ b/evennia/web/utils/general_context.py @@ -15,24 +15,45 @@ from evennia.utils.utils import get_evennia_version # Setup lists of the most relevant apps so # the adminsite becomes more readable. +GAME_NAME = None +GAME_SLOGAN = None +SERVER_VERSION = None +SERVER_HOSTNAME = None + +TELNET_ENABLED = None +TELNET_PORTS = None +TELNET_SSL_ENABLED = None +TELNET_SSL_PORTS = None + +SSH_ENABLED = None +SSH_PORTS = None + +WEBCLIENT_ENABLED = None +WEBSOCKET_CLIENT_ENABLED = None +WEBSOCKET_PORT = None +WEBSOCKET_URL = None + +REST_API_ENABLED = False + ACCOUNT_RELATED = ["Accounts"] GAME_ENTITIES = ["Objects", "Scripts", "Comms", "Help"] GAME_SETUP = ["Permissions", "Config"] CONNECTIONS = ["Irc"] WEBSITE = ["Flatpages", "News", "Sites"] -REST_API_ENABLED = False -# Determine the site name and server version -def set_game_name_and_slogan(): + +def load_game_settings(): """ - Sets global variables GAME_NAME and GAME_SLOGAN which are used by - general_context. - - Notes: - This function is used for unit testing the values of the globals. + Load and cache game settings. """ - global GAME_NAME, GAME_SLOGAN, SERVER_VERSION, REST_API_ENABLED + global GAME_NAME, GAME_SLOGAN, SERVER_VERSION, SERVER_HOSTNAME + global TELNET_ENABLED, TELNET_PORTS + global TELNET_SSL_ENABLED, TELNET_SSL_PORTS + global SSH_ENABLED, SSH_PORTS + global WEBCLIENT_ENABLED, WEBSOCKET_CLIENT_ENABLED, WEBSOCKET_PORT, WEBSOCKET_URL + global REST_API_ENABLED + try: GAME_NAME = settings.SERVERNAME.strip() except AttributeError: @@ -42,19 +63,16 @@ def set_game_name_and_slogan(): GAME_SLOGAN = settings.GAME_SLOGAN.strip() except AttributeError: GAME_SLOGAN = SERVER_VERSION + SERVER_HOSTNAME = settings.SERVER_HOSTNAME - REST_API_ENABLED = settings.REST_API_ENABLED + TELNET_ENABLED = settings.TELNET_ENABLED + TELNET_PORTS = settings.TELNET_PORTS + TELNET_SSL_ENABLED = settings.SSL_ENABLED + TELNET_SSL_PORTS = settings.SSL_PORTS -def set_webclient_settings(): - """ - As with set_game_name_and_slogan above, this sets global variables pertaining - to webclient settings. + SSH_ENABLED = settings.SSH_ENABLED + SSH_PORTS = settings.SSH_PORTS - Notes: - Used for unit testing. - - """ - global WEBCLIENT_ENABLED, WEBSOCKET_CLIENT_ENABLED, WEBSOCKET_PORT, WEBSOCKET_URL WEBCLIENT_ENABLED = settings.WEBCLIENT_ENABLED WEBSOCKET_CLIENT_ENABLED = settings.WEBSOCKET_CLIENT_ENABLED # if we are working through a proxy or uses docker port-remapping, the webclient port encoded @@ -66,9 +84,11 @@ def set_webclient_settings(): # this is determined dynamically by the client and is less of an issue WEBSOCKET_URL = settings.WEBSOCKET_CLIENT_URL + REST_API_ENABLED = settings.REST_API_ENABLED + + +load_game_settings() -set_game_name_and_slogan() -set_webclient_settings() # The main context processor function def general_context(request): @@ -91,11 +111,18 @@ def general_context(request): "puppet": puppet, "game_name": GAME_NAME, "game_slogan": GAME_SLOGAN, + "server_hostname": SERVER_HOSTNAME, "evennia_userapps": ACCOUNT_RELATED, "evennia_entityapps": GAME_ENTITIES, "evennia_setupapps": GAME_SETUP, "evennia_connectapps": CONNECTIONS, "evennia_websiteapps": WEBSITE, + "telnet_enabled": TELNET_ENABLED, + "telnet_ports": TELNET_PORTS, + "telnet_ssl_enabled": TELNET_SSL_ENABLED, + "telnet_ssl_ports": TELNET_SSL_PORTS, + "ssh_enabled": SSH_ENABLED, + "ssh_ports": SSH_ENABLED, "webclient_enabled": WEBCLIENT_ENABLED, "websocket_enabled": WEBSOCKET_CLIENT_ENABLED, "websocket_port": WEBSOCKET_PORT,