Merge pull request #3460 from CvH/10.0/ttyd-addon

Web Terminal
This commit is contained in:
MilhouseVH 2019-05-01 19:56:23 +01:00 committed by GitHub
commit f185e2b809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv)
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="json-c"
PKG_VERSION="3e81b4abe359c8128bb2b4127f4e8c8c057fb004"
PKG_SHA256="85569b581e8ff0999de5a43a65332559df3aa386e757d76ac8a4915eb4fb783a"
PKG_LICENSE="MIT"
PKG_SITE="https://github.com/json-c/json-c"
PKG_URL="https://github.com/json-c/json-c/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="Implements a reference counting object model that allows you to easily construct JSON objects in C."

View File

@ -0,0 +1,11 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="libwebsockets"
PKG_VERSION="3.1.0"
PKG_SHA256="db948be74c78fc13f1f1a55e76707d7baae3a1c8f62b625f639e8f2736298324"
PKG_LICENSE="LGPL2+"
PKG_SITE="https://libwebsockets.org"
PKG_URL="https://github.com/warmcat/libwebsockets/archive/v$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain openssl json-c"
PKG_LONGDESC="Library for implementing network protocols with a tiny footprint."

View File

@ -0,0 +1,2 @@
100
- initial LibreELEC version

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -0,0 +1,28 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ttyd"
PKG_VERSION="1.4.4"
PKG_SHA256="b910a33ddaa474c369991ba345187a8a2f4aa420389083671ba3a6c305a491d6"
PKG_REV="100"
PKG_ARCH="any"
PKG_LICENSE="MIT"
PKG_SITE="https://github.com/tsl0922/ttyd"
PKG_URL="https://github.com/tsl0922/ttyd/archive/$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain libwebsockets"
PKG_SECTION="service"
PKG_SHORTDESC="ttyd: a tool for accessing the terminal over a browser"
PKG_LONGDESC="ttyd ($PKG_VERSION): is a simple command-line tool for sharing terminal over the web"
PKG_IS_ADDON="yes"
PKG_ADDON_NAME="Web SSH Terminal"
PKG_ADDON_TYPE="xbmc.service"
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp -P $PKG_BUILD/.install_pkg/usr/bin/ttyd $ADDON_BUILD/$PKG_ADDON_ID/bin
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -p $(get_build_dir json-c)/.install_pkg/usr/lib/libjson-c.so $ADDON_BUILD/$PKG_ADDON_ID/lib
cp -p $(get_build_dir libwebsockets)/.install_pkg/usr/lib/libwebsockets.so.14 $ADDON_BUILD/$PKG_ADDON_ID/lib
}

View File

@ -0,0 +1,18 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
. /etc/profile
oe_setup_addon service.ttyd
chmod a+x $ADDON_DIR/bin/*
if [ "$TTYD_NOLOGIN" = "true" ]; then
TTYD_NOLOGIN="bash"
elif [ "$TTYD_NOLOGIN" = "false" ]; then
TTYD_NOLOGIN="login root"
fi
exec $ADDON_DIR/bin/ttyd -O -T xterm -p ${TTYD_WEBPORT} ${TTYD_NOLOGIN} &>$ADDON_HOME/service.log

View File

@ -0,0 +1,20 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
import subprocess
import xbmc
import xbmcaddon
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.id = xbmcaddon.Addon().getAddonInfo('id')
def onSettingsChanged(self):
subprocess.call(['systemctl', 'restart', self.id])
if __name__ == "__main__":
Monitor().waitForAbort()

View File

@ -0,0 +1,19 @@
# Kodi Media Center language file
# Addon Name: ttyd
# Addon id: service.ttyd
# Addon Provider: Team LibreELEC
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Settings"
msgstr ""
msgctxt "#30001"
msgid "Webui Port"
msgstr ""
msgctxt "#30002"
msgid "[COLOR FFFF0000][SECURITY RISK][/COLOR] Allow usage without password"
msgstr ""

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
<setting id="TTYD_WEBPORT" type="text" label="30001" default="11111" />
<setting id="TTYD_NOLOGIN" type="bool" label="30002" default="false" />
</category>
</settings>

View File

@ -0,0 +1,4 @@
<settings version="2">
<setting id="TTYD_NOLOGIN" default="true">false</setting>
<setting id="TTYD_WEBPORT" default="true">11111</setting>
</settings>

View File

@ -0,0 +1,14 @@
[Unit]
Description=ttyd
After=graphical.target
[Service]
ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.ttyd/bin/ttyd.start"
TimeoutStopSec=1
Restart=always
RestartSec=2
StartLimitInterval=0
Type=forking
[Install]
WantedBy=kodi.target