diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/kvm/index.html | 14 | ||||
-rw-r--r-- | web/kvm/navbar-system.pug | 3 | ||||
-rw-r--r-- | web/kvm/window-webterm.pug | 8 | ||||
-rw-r--r-- | web/kvm/windows.pug | 1 | ||||
-rw-r--r-- | web/share/js/index/main.js | 2 | ||||
-rw-r--r-- | web/share/js/kvm/session.js | 21 | ||||
-rw-r--r-- | web/share/js/wm.js | 3 |
7 files changed, 51 insertions, 1 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html index aa0e5fce..dc5779a5 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -205,6 +205,10 @@ <hr> <button disabled id="wol-wakeup-button">• Wake-on-LAN server</button> </div> + <div class="buttons feature-disabled" id="webterm"> + <hr> + <button data-force-hide-menu id="show-webterm-button">• Show terminal</button> + </div> </div> </li> <li class="right feature-disabled" id="atx-dropdown"><a class="menu-button" href="#"><img class="led-gray" data-dont-hide-menu id="atx-power-led" src="/share/svg/led-atx-power.svg"><img class="led-gray" data-dont-hide-menu id="atx-hdd-led" src="/share/svg/led-atx-hdd.svg">ATX</a> @@ -1744,6 +1748,16 @@ </p> </div> </div> + <div class="window window-resizable" id="webterm-window" data-show-by-button="show-webterm-button" style="width: 640px; height: 480px"> + <div class="window-header"> + <div class="window-grab">Terminal</div> + <button class="window-button-close">×</button> + <button class="window-button-maximize">☐</button> + <!-- Терминал глючит из-за зажимаемой клавиши ESC для выхода--> + <!-- button(class="window-button-full-screen") ⤢--> + </div> + <iframe id="webterm-iframe" src="" style="width: 100%; height: 100%"></iframe> + </div> <ul class="footer"> <li class="footer-left" id="kvmd-meta-server-host"></li> <li class="footer-right"><a target="_blank" href="https://pikvm.org">Pi-KVM Project</a></li> diff --git a/web/kvm/navbar-system.pug b/web/kvm/navbar-system.pug index 2f85416c..186bdef7 100644 --- a/web/kvm/navbar-system.pug +++ b/web/kvm/navbar-system.pug @@ -66,3 +66,6 @@ li(class="right") div(id="wol" class="buttons feature-disabled") hr button(disabled id="wol-wakeup-button") • Wake-on-LAN server + div(id="webterm" class="buttons feature-disabled") + hr + button(data-force-hide-menu id="show-webterm-button") • Show terminal diff --git a/web/kvm/window-webterm.pug b/web/kvm/window-webterm.pug new file mode 100644 index 00000000..e6c1d196 --- /dev/null +++ b/web/kvm/window-webterm.pug @@ -0,0 +1,8 @@ +div(id="webterm-window" class="window window-resizable" data-show-by-button="show-webterm-button" style="width: 640px; height: 480px") + div(class="window-header") + div(class="window-grab") Terminal + button(class="window-button-close") × + button(class="window-button-maximize") ☐ + // Терминал глючит из-за зажимаемой клавиши ESC для выхода + // button(class="window-button-full-screen") ⤢ + iframe(id="webterm-iframe" src="" style="width: 100%; height: 100%") diff --git a/web/kvm/windows.pug b/web/kvm/windows.pug index 898a8562..b2d32dad 100644 --- a/web/kvm/windows.pug +++ b/web/kvm/windows.pug @@ -1,3 +1,4 @@ include window-stream.pug include window-keyboard.pug include window-about.pug +include window-webterm.pug diff --git a/web/share/js/index/main.js b/web/share/js/index/main.js index ee829480..5f715007 100644 --- a/web/share/js/index/main.js +++ b/web/share/js/index/main.js @@ -80,7 +80,7 @@ function __loadKvmdInfo() { } for (let app of apps) { - if (app.enabled) { + if (app.enabled || app.started) { $("apps").innerHTML += __makeApp(null, app.path, app.icon, app.name); } } diff --git a/web/share/js/kvm/session.js b/web/share/js/kvm/session.js index b278dd06..3dd59d12 100644 --- a/web/share/js/kvm/session.js +++ b/web/share/js/kvm/session.js @@ -107,6 +107,26 @@ export function Session() { } }; + var __setExtras = function(state) { + let show_hook = null; + let close_hook = null; + let has_webterm = (state.webterm && state.webterm.started); + if (has_webterm) { + let path = "/" + state.webterm.path; + show_hook = function() { + tools.info("Terminal opened: ", path); + $("webterm-iframe").src = path; + }; + close_hook = function() { + tools.info("Terminal closed"); + $("webterm-iframe").src = ""; + }; + } + tools.featureSetEnabled($("webterm"), has_webterm); + $("webterm-window").show_hook = show_hook; + $("webterm-window").close_hook = close_hook; + }; + var __formatTemp = function(temp) { let pairs = []; for (let field of Object.keys(temp).sort()) { @@ -218,6 +238,7 @@ export function Session() { case "info_meta_state": __setAboutInfoMeta(data.event); break; case "info_hw_state": __setAboutInfoHw(data.event); break; case "info_system_state": __setAboutInfoSystem(data.event); break; + case "info_extras_state": __setExtras(data.event); break; case "wol_state": __wol.setState(data.event); break; case "gpio_model_state": __gpio.setModel(data.event); break; case "gpio_state": __gpio.setState(data.event); break; diff --git a/web/share/js/wm.js b/web/share/js/wm.js index 7e4105da..44238447 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -263,6 +263,9 @@ function __WindowManager() { el_window.focus(); el_window.blur(); el_window.style.visibility = "hidden"; + if (el_window.close_hook) { + el_window.close_hook(); + } }; var __toggleMenu = function(el_a) { |