metadata in web

This commit is contained in:
Devaev Maxim 2018-11-16 23:23:54 +03:00
parent 127b22b4be
commit 0bf39f56e2
3 changed files with 40 additions and 14 deletions

View File

@ -20,3 +20,27 @@ div#about td.copyright {
div#about tr.version { div#about tr.version {
font-family: monospace; font-family: monospace;
} }
div#about textarea {
display: block;
resize: none;
width: 100%;
height: 150px;
padding: 0;
color: var(--fg-color-normal);
background-color: var(--bg-color-menu);
border: none;
outline: 0 !important;
box-sizing: border-box;
padding: 5px;
font-family: monospace;
-webkit-appearance:none;
}
div#about textarea::-moz-placeholder {
line-height: 150px;
text-align: center;
}
div#about textarea::-webkit-input-placeholder {
line-height: 150px;
text-align: center;
}

View File

@ -26,7 +26,19 @@ function Session() {
if (http.readyState === 4) { if (http.readyState === 4) {
if (http.status === 200) { if (http.status === 200) {
var info = JSON.parse(http.responseText).result; var info = JSON.parse(http.responseText).result;
$("kvmd-version").innerHTML = "kvmd v" + info.version.kvmd; if (info.meta) {
$("about-meta").innerHTML = (
"// The server metadata.\n"
+ "// You can get this json using handle /kvmd/info.\n"
+ "// In the standard configuration this data\n"
+ "// is specified in the file /etc/kvmd/meta.yaml.\n\n"
+ JSON.stringify(info.meta, undefined, 4)
);
if (info.meta.server && info.meta.server.host) {
document.title = "Pi-KVM Session - " + info.meta.server.host;
$("kvmd-meta-server-host").innerHTML = "Server: " + info.meta.server.host;
}
}
$("about-version-kvmd").innerHTML = info.version.kvmd; $("about-version-kvmd").innerHTML = info.version.kvmd;
$("about-version-streamer").innerHTML = info.version.streamer + " (" + info.streamer + ")"; $("about-version-streamer").innerHTML = info.version.streamer + " (" + info.streamer + ")";
} else { } else {

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Pi-KVM / Session</title> <title>Pi-KVM Session</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
@ -581,17 +581,7 @@
</tr> </tr>
</table> </table>
<hr> <hr>
This is a web interface for KVMD. For better experience<br> <textarea readonly placeholder="No data" id="about-meta"></textarea>
we recommend you to use a fresh version of one<br>
of the following browsers:<br>
<ul>
<li><a target="_blank" href="https://google.com/chrome">Google Chrome</a> <sup><i>recommended</i></sup></li>
<li><a target="_blank" href="https://chromium.org/Home">Chromium</a> <sup><i>recommended</i></sup></li>
<li><a target="_blank" href="https://mozilla.org/firefox">Mozilla Firefox</a></li>
<li><a target="_blank" href="https://apple.com/safari">Apple Safari</a></li>
<li><a target="_blank" href="https://opera.com">Opera</a></li>
<li><a target="_blank" href="https://vivaldi.com">Vivaldi</a></li>
</ul>
<hr> <hr>
Please visit our site <a target="_blank" href="https://github.com/pi-kvm">https://github.com/pi-kvm</a> to get documentation,<br> Please visit our site <a target="_blank" href="https://github.com/pi-kvm">https://github.com/pi-kvm</a> to get documentation,<br>
source codes, hardware schematics and legal information.<br> source codes, hardware schematics and legal information.<br>
@ -599,7 +589,7 @@
</div> </div>
<ul class="footer"> <ul class="footer">
<li id="kvmd-version" class="footer-left"></li> <li id="kvmd-meta-server-host" class="footer-left"></li>
<li class="footer-right"><a target="_blank" href="https://github.com/pi-kvm">Pi-KVM Project</a></li> <li class="footer-right"><a target="_blank" href="https://github.com/pi-kvm">Pi-KVM Project</a></li>
</ul> </ul>
</body> </body>