Add placeholder button in console header for graceful shutdown

This commit is contained in:
dr|z3d 2021-08-12 02:42:20 +00:00
parent 50341f4b08
commit 6a8d539ccd
2 changed files with 51 additions and 7 deletions

View file

@ -307,6 +307,7 @@ namespace http {
URL url; URL url;
url.parse_query(params); url.parse_query(params);
page = params["page"]; page = params["page"];
std::string token = params["token"];
s << s <<
"<!DOCTYPE html>\r\n" "<!DOCTYPE html>\r\n"
@ -321,7 +322,11 @@ namespace http {
"</head>\r\n" "</head>\r\n"
"<body>\r\n" "<body>\r\n"
"<div class=\"wrapper\">\r\n<table id=\"main\">\r\n" "<div class=\"wrapper\">\r\n<table id=\"main\">\r\n"
"<tr><td class=\"center\" colspan=\"2\"><a id=\"home\" href=\"" << webroot << "\">" << tr("Main page") << "</a></td></tr>" "<tr><td class=\"center\" colspan=\"2\"><span class=\"header\">"
"<a id=\"home\" href=\"" << webroot << "\">" << tr("Main page") << "</a> "
// placeholder for graceful shutdown button (requires token)
"<a id=\"shutdownbutton\" href=\"" << webroot << "?cmd=" << HTTP_COMMAND_SHUTDOWN_START << "&amp;token=" << token <<
"\" data-tooltip=\"" << tr("Start graceful shutdown") << "\">Shutdown</a></span></td></tr>\r\n"
"<tr id=\"nav\"><td id=\"navlinks\" class=\"center\" colspan=\"2\">\r\n"; "<tr id=\"nav\"><td id=\"navlinks\" class=\"center\" colspan=\"2\">\r\n";
if (i2p::context.IsFloodfill ()) if (i2p::context.IsFloodfill ())
s << "<a href=\"" << webroot << "?page=" << HTTP_PAGE_LEASESETS << "\">" << tr("LeaseSets") << "</a>\r\n"; s << "<a href=\"" << webroot << "?page=" << HTTP_PAGE_LEASESETS << "\">" << tr("LeaseSets") << "</a>\r\n";

View file

@ -1,3 +1,6 @@
/* "purple" console theme for i2pd */
/* Author: dr|z3d */
:root { :root {
--bodyfont: Open Sans, Noto Sans, Ubuntu, Segoe UI, sans-serif; --bodyfont: Open Sans, Noto Sans, Ubuntu, Segoe UI, sans-serif;
--monospaced: Droid Sans Mono, Noto Mono, Lucida Console, DejaVu Sans Mono, monospace; --monospaced: Droid Sans Mono, Noto Mono, Lucida Console, DejaVu Sans Mono, monospace;
@ -88,10 +91,6 @@ body {
color: var(--ink); color: var(--ink);
} }
.header {
display: none;
}
.wrapper { .wrapper {
margin: 0 auto; margin: 0 auto;
padding: 5px; padding: 5px;
@ -101,6 +100,39 @@ body {
text-align: center; text-align: center;
} }
.header {
display: inline-block;
width: 100%;
vertical-align: middle;
position: relative;
}
#shutdownbutton {
position: absolute;
top: 0;
right: -10px;
display: inline-block;
width: 40px;
height: 44px;
font-size: 0;
background: var(--shutdown) no-repeat center center / 24px;
opacity: .6;
mix-blend-mode: luminosity;
}
#shutdownbutton:hover, #shutdownbutton:focus {
opacity: .7;
mix-blend-mode: normal;
}
#shutdownbutton:active {
transform: scale(.85);
}
#shutdownbutton:active[data-tooltip]::after {
display: none;
}
b { b {
font-weight: 600; font-weight: 600;
} }
@ -430,9 +462,10 @@ td:last-child {
} }
#warning, #success { #warning, #success {
display: block; margin: -5px 0 10px;
width: 100%; width: 100%;
height: 48px; height: 48px;
display: block;
background: var(--error) no-repeat center top / 44px; background: var(--error) no-repeat center top / 44px;
} }
@ -844,7 +877,8 @@ a[href^="https://gwhois"] {
} }
span[data-tooltip]:hover::after, span[data-tooltip]:active::after, span[data-tooltip]:hover::after, span[data-tooltip]:active::after,
.itag[data-tooltip]:hover::after, .itag[data-tooltip]:active::after { .itag[data-tooltip]:hover::after, .itag[data-tooltip]:active::after,
.header a[data-tooltip][href*="cmd"]:hover::after {
padding: 3px 6px; padding: 3px 6px;
display: inline-block; display: inline-block;
position: absolute; position: absolute;
@ -858,6 +892,11 @@ span[data-tooltip]:hover::after, span[data-tooltip]:active::after,
background: #fff !important; background: #fff !important;
content: attr(data-tooltip); content: attr(data-tooltip);
text-shadow: none !important; text-shadow: none !important;
white-space: nowrap;
}
.header a[data-tooltip][href*="cmd"]:hover::after {
left: -50px;
} }
.slide label { .slide label {