From 7d9b1b508be92b763b3130af9f3b9bc35106bcf8 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 11 May 2024 09:18:30 -0400 Subject: [PATCH] Print a little colorful message when we've started about where to connect. Multiple people have pointed out that it's not obvious that it's working. --- src/httpd.js.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/httpd.js.c b/src/httpd.js.c index 1e61606c..961df4a8 100644 --- a/src/httpd.js.c +++ b/src/httpd.js.c @@ -31,6 +31,10 @@ #define tf_countof(a) ((int)(sizeof((a)) / sizeof(*(a)))) +#define CYAN "\e[1;36m" +#define MAGENTA "\e[1;35m" +#define RESET "\e[0m" + const int64_t k_refresh_interval = 1ULL * 7 * 24 * 60 * 60 * 1000; static JSValue _authenticate_jwt(JSContext* context, const char* jwt); @@ -416,6 +420,7 @@ static JSValue _httpd_endpoint_start(JSContext* context, JSValueConst this_val, *listener = (httpd_listener_t) { .context = context, .tls = JS_DupValue(context, argv[1]) }; tf_tls_context_t* tls = tf_tls_context_get(listener->tls); int assigned_port = tf_http_listen(http, port, tls, _httpd_listener_cleanup, listener); + tf_printf(CYAN "~😎 Tilde Friends" RESET " is now up at " MAGENTA "http%s://127.0.0.1:%d/" RESET ".\n", tls ? "s" : "", assigned_port); return JS_NewInt32(context, assigned_port); }