move ttyd to /opt/ttyd

This commit is contained in:
nagumii 2025-02-05 21:48:59 +02:00
parent 15b5381d77
commit 95f55550d1
4 changed files with 27 additions and 6 deletions

View file

@ -43,8 +43,8 @@ pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beauti
if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi
echo "Downloading ttyd and enabling service..."
wget -qO- https://api.github.com/repos/tsl0922/ttyd/releases/latest | grep "browser_download_url" | grep "armhf" | cut -d '"' -f 4 | xargs wget -O /opt/ttyd
chmod +x /opt/ttyd
wget -qO- https://api.github.com/repos/tsl0922/ttyd/releases/latest | grep "browser_download_url" | grep "armhf" | cut -d '"' -f 4 | xargs wget -O /opt/ttyd/ttyd
chmod +x /opt/ttyd/ttyd
systemctl enable ttyd
echo "Setting MOTD..."

View file

@ -1,10 +1,10 @@
[Unit]
Description=TTYD
Description=ttyd Web Terminal
After=syslog.target
After=network.target
[Service]
ExecStart=/opt/ttyd -W -6 login
ExecStart=/opt/ttyd/ttyd -W -6 login
Type=simple
Restart=always
User=root

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2025 Shuanglei Tao <tsl0922@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -293,7 +293,7 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
while true; do
echo "Checking web terminal status..."
ttyd_state=$(replace_colors "$(femto-utils.sh -t "check")")
[[ $ttyd_state == *"running"* ]] && ttyd_state+="\nWeb terminal available at \Zuhttp://$(hostname).local:7681\Zn"
[[ $ttyd_state == *"running"* ]] && ttyd_state+="\nWeb terminal available at \Zuhttps://$(hostname).local:7681\Zn"
choice=$(dialog --no-collapse --colors --title "Web Terminal" --cancel-label "Back" --help-button --default-item "$choice" --item-help --menu "Current state: $ttyd_state" 14 58 2 \
$(if ! echo "$ttyd_state" | grep -q 'enabled and running'; then echo "Enable and start (default) x  "; fi) \
$(if echo "$ttyd_state" | grep -q 'enabled'; then echo "Disable and stop x  "; fi) \
@ -305,7 +305,7 @@ $(ingest_data "femto-meshtasticd-config.sh -i" 15)" 0 0
if [ $exit_status -eq 1 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
break
elif [ $exit_status -eq 2 ]; then # Help ("extra") button
dialog --no-collapse --colors --title "Web terminal help" --msgbox "Web terminal is a browser based terminal interface, and can be used as a replacement for an SSH client such as PuTTY.\n\nWeb terminal is enabled by default on Foxbuntu." 0 0
dialog --no-collapse --colors --title "Web terminal help" --msgbox "Web terminal is a browser based terminal interface, and can be used as a replacement for an SSH client such as PuTTY.\nSSL encryption is provided by keys generated during first-boot. Your browser may give a warning about the self-signed encryption certificate.\n\nWeb terminal is provided by ttyd.\nLicense for ttyd: \`cat /opt/ttyd/license\`.\nFor more details, see: \Zuhttps://github.com/tsl0922/ttyd\Zn\n\nWeb terminal is enabled by default on Foxbuntu." 0 0
else
case $choice in
"Enable and start (default)") femto-utils.sh -t "enable" ;;