Skip to content

Commit 724af88

Browse files
author
Nils Bars
committed
Construct SSH welcome message in provision API
Build the welcome header, message of the day, and greeting in the provision endpoint so the SSH proxy can display it on connection. Also remove verbose per-request key count logging.
1 parent e21496e commit 724af88

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

webapp/ref/view/api.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ExerciseImageManager,
1616
InconsistentStateError,
1717
InstanceManager,
18+
admin_required,
1819
utc_datetime_to_local_tz,
1920
datetime_to_string,
2021
)
@@ -107,7 +108,16 @@ def start_and_return_instance(
107108
exercise: Exercise = instance.exercise
108109

109110
# Message that is printed before the user is dropped into the container shell.
110-
welcome_message = ""
111+
# Include the SSH welcome header and greeting (previously displayed by ssh-wrapper).
112+
header = SystemSettingsManager.SSH_WELCOME_MSG.value or ""
113+
msg_of_the_day = SystemSettingsManager.SSH_MESSAGE_OF_THE_DAY.value
114+
if msg_of_the_day:
115+
header += f"\n{ansi.green(msg_of_the_day)}"
116+
117+
user_name = requesting_user.full_name
118+
greeting = f"Hello {user_name}!\n[+] Connecting to task \"{exercise.short_name}\"..."
119+
120+
welcome_message = f"{header}\n{greeting}\n"
111121

112122
if not instance.is_submission():
113123
latest_submission = instance.get_latest_submission()

0 commit comments

Comments
 (0)