From 23c36384c02e082d464c1057522ac4cb65e42dcd Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Thu, 21 May 2026 22:29:29 +0200 Subject: [PATCH] Web Logout --- mars-nwe-webui.service.cmake | 2 ++ settings.pl | 3 ++- smart.cmake | 19 +++++++++++-------- static/menu.html | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/mars-nwe-webui.service.cmake b/mars-nwe-webui.service.cmake index e86d211..7bcedf6 100644 --- a/mars-nwe-webui.service.cmake +++ b/mars-nwe-webui.service.cmake @@ -8,6 +8,8 @@ Documentation=man:systemd.service(5) Type=simple User=root Group=root +RuntimeDirectory=mars-nwe-webui +RuntimeDirectoryMode=0700 WorkingDirectory=/ ExecStartPre=/bin/mkdir -p @MARS_NWE_LOG_DIR@ diff --git a/settings.pl b/settings.pl index 8e98e50..303badd 100644 --- a/settings.pl +++ b/settings.pl @@ -40,7 +40,8 @@ sub settings_nav_bar() return <<'EOF_NAV';
Back - Main menu + Main menu + Logout
EOF_NAV } diff --git a/smart.cmake b/smart.cmake index be19578..fb071ab 100644 --- a/smart.cmake +++ b/smart.cmake @@ -70,8 +70,9 @@ if( scalar( @c ) > 2 ) } $c[0] = uc( $c[0] ); +$request_method = $c[0]; -if( $c[0] eq 'POST' ) +if( $request_method eq 'POST' ) { my $content_length = 0; @@ -86,7 +87,7 @@ if( $c[0] eq 'POST' ) } } -if( $c[0] ne 'GET' && $c[0] ne 'POST' ) +if( $request_method ne 'GET' && $request_method ne 'POST' ) { error( 501 ); } @@ -97,7 +98,7 @@ $cc =~ s/[^\?]*\?//; $c = substr( shift( @p ), 1 ); parse_params( $p[0] ); -parse_params( $post_body ) if $c[0] eq 'POST'; +parse_params( $post_body ) if $request_method eq 'POST'; @c = split( '/', $c ); @@ -416,7 +417,7 @@ html,body{margin:0;padding:0;min-height:100%;background:var(--bg);color:var(--te body{display:flex;align-items:center;justify-content:center;padding:24px} .login{width:min(440px,100%);background:var(--panel);border:1px solid var(--line);border-radius:20px;box-shadow:0 18px 45px rgba(64,36,12,.12);overflow:hidden} .hero{padding:26px 28px;background:linear-gradient(135deg,#a80f18,#c44731 60%,#d79a54);color:white} -.hero h1{margin:0;font-size:28px} +.hero{display:flex;align-items:center;gap:16px}.hero img{width:54px;height:auto;background:#fff;border-radius:12px;padding:6px;box-shadow:0 8px 20px rgba(0,0,0,.16)}.hero h1{margin:0;font-size:28px} .hero p{margin:6px 0 0;opacity:.95} form{padding:24px 28px 28px} label{display:block;font-weight:bold;margin:0 0 7px} @@ -429,8 +430,11 @@ button{width:100%;border:1px solid #a33d2f;border-radius:12px;padding:11px 14px;
-

SMArT Login

-

MARS_NWE web administration

+ SMArT logo +
+

SMArT Login

+

MARS_NWE web administration

+
EOF @@ -446,7 +450,6 @@ EOF -
Authentication is checked through PAM via check_login.
@@ -456,7 +459,7 @@ EOF sub handle_login_route() { - if( $c[0] ne 'POST' ) + if( $request_method ne 'POST' ) { print_login_page( '' ); return; diff --git a/static/menu.html b/static/menu.html index 0736bbc..969f0d6 100644 --- a/static/menu.html +++ b/static/menu.html @@ -19,7 +19,7 @@ body{padding:18px} a{color:inherit} code,tt{font-family:"DejaVu Sans Mono",monospace} .shell{max-width:1250px;margin:0 auto} .hero{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:22px 24px;border:1px solid var(--line);border-radius:18px;background:linear-gradient(135deg,#a80f18,#c44731 60%,#d79a54);color:#fff;box-shadow:0 12px 30px rgba(64,36,12,.08)} -.hero img{height:42px;width:auto;display:block;background:#fff;border-radius:10px;padding:5px;box-shadow:0 8px 20px rgba(0,0,0,.12)} +.hero-actions{display:flex;align-items:center;gap:12px}.hero img{height:42px;width:auto;display:block;background:#fff;border-radius:10px;padding:5px;box-shadow:0 8px 20px rgba(0,0,0,.12)}.logout-button{display:inline-block;text-decoration:none;border:1px solid rgba(255,255,255,.6);border-radius:10px;padding:8px 13px;background:rgba(255,255,255,.14);color:#fff;font-weight:bold;box-shadow:0 8px 18px rgba(0,0,0,.10)}.logout-button:hover{background:rgba(255,255,255,.22)} .hero h1{margin:0;font-size:28px;line-height:1.1} .hero p{margin:6px 0 0;font-size:15px;opacity:.95} .workspace{margin-top:18px;display:grid;grid-template-columns:180px minmax(0,1fr);gap:18px;align-items:start} @@ -83,7 +83,7 @@ a{color:inherit} code,tt{font-family:"DejaVu Sans Mono",monospace}

Main menu

Choose a section from the icon list. The explanation opens here on the left, and the editor opens on the right.

- SMArT logo +
LogoutSMArT logo