mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 09:39:58 -06:00
Merge pull request #2207 from Squidly271/Terminal
Feat: Selectable placement of Terminal Button
This commit is contained in:
@@ -203,6 +203,12 @@ _(Page view)_:
|
||||
|
||||
:display_page_view_help:
|
||||
|
||||
_(Show Terminal Button in header)_:
|
||||
: <select name="terminalButton">
|
||||
<?=mk_option($display['terminalButton'],"no",_("No"))?>
|
||||
<?=mk_option($display['terminalButton'],"yes",_("Yes"))?>
|
||||
</select>
|
||||
|
||||
_(Placement of Users menu)_:
|
||||
: <select name="users">
|
||||
<?=mk_option($display['users'], "Tasks:3", _('Header menu'))?>
|
||||
|
||||
37
emhttp/plugins/dynamix/Terminal.page
Normal file
37
emhttp/plugins/dynamix/Terminal.page
Normal file
@@ -0,0 +1,37 @@
|
||||
Menu="UNRAID-OS"
|
||||
Title="Open Terminal"
|
||||
Icon="terminal"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2025, Lime Technology
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*/
|
||||
?>
|
||||
<script>
|
||||
$(function(){
|
||||
var d = new Date();
|
||||
try {
|
||||
openTerminal('ttyd', 'Web Terminal ' + d.getTime(), '');
|
||||
} catch (e) {
|
||||
console.error('Failed to open terminal:', e);
|
||||
window.location.href = '/';
|
||||
return;
|
||||
}
|
||||
// Give time for terminal to open then go back to the previous page
|
||||
var referer = '<?= htmlspecialchars($_SERVER['HTTP_REFERER'] ?? '', ENT_QUOTES) ?>';
|
||||
setTimeout(function(){
|
||||
// Only redirect to same origin or fallback to home
|
||||
if (referer && referer.indexOf(window.location.origin) === 0) {
|
||||
window.location.href = referer;
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
}, 5000);
|
||||
});
|
||||
</script>
|
||||
@@ -2,6 +2,7 @@ Menu="Buttons:3"
|
||||
Title="Terminal"
|
||||
Icon="icon-u-terminal"
|
||||
Code="e93f"
|
||||
Cond="($display['terminalButton'] == 'yes')"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
|
||||
@@ -17,6 +17,7 @@ banner=""
|
||||
header=""
|
||||
background=""
|
||||
tabs="1"
|
||||
terminalButton="no"
|
||||
users="Tasks:3"
|
||||
usage="0"
|
||||
text="1"
|
||||
|
||||
Reference in New Issue
Block a user