diff --git a/core/client.js b/core/client.js index bcb0ffdf..522c786e 100644 --- a/core/client.js +++ b/core/client.js @@ -100,10 +100,10 @@ class TfNavigationElement extends LitElement { get_spark_line(key, options) { if (!this.spark_lines[key]) { let spark_line = document.createElement('tf-sparkline'); - spark_line.style.display = 'flex'; - spark_line.style.flexDirection = 'row'; - spark_line.style.flex = '0 50 5em'; spark_line.title = key; + spark_line.classList.add('w3-bar-item'); + spark_line.classList.add('w3-hide-small'); + spark_line.style.paddingRight = '0'; if (options) { if (options.max) { spark_line.max = options.max; @@ -121,11 +121,11 @@ class TfNavigationElement extends LitElement { */ render_login() { if (this?.credentials?.session?.name) { - return html`logout ${this.credentials.session.name}`; } else { - return html`login`; } @@ -145,8 +145,8 @@ class TfNavigationElement extends LitElement { `; @@ -155,7 +155,7 @@ class TfNavigationElement extends LitElement { `; @@ -210,6 +210,7 @@ class TfNavigationElement extends LitElement { render() { let self = this; return html` +
`; } @@ -619,13 +618,13 @@ class TfSparkLineElement extends LitElement { ) / 10.0; return html` `; diff --git a/src/httpd.js.c b/src/httpd.js.c index 4b764e84..aabb5cf1 100644 --- a/src/httpd.js.c +++ b/src/httpd.js.c @@ -328,8 +328,8 @@ static JSValue _httpd_websocket_upgrade(JSContext* context, JSValueConst this_va const char* session = tf_http_get_cookie(tf_http_request_get_header(request, "cookie"), "session"); JSValue jwt = _authenticate_jwt(context, session); tf_free((void*)session); - JSValue name = JS_GetPropertyStr(context, jwt, "name"); - const char* name_string = JS_ToCString(context, name); + JSValue name = !JS_IsUndefined(jwt) ? JS_GetPropertyStr(context, jwt, "name") : JS_UNDEFINED; + const char* name_string = !JS_IsUndefined(name) ? JS_ToCString(context, name) : NULL; const char* session_token = _make_session_jwt(ssb, name_string); const char* cookie = _make_set_session_cookie_header(request, session_token); tf_free((void*)session_token);