From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
Added httpserver-html5-cli app
This new HTML5 app is implemented in Typescript and served by OSv httpserver
same way as OSv gui. It provides command line terminal functionality in
your favorite
webbrowser and the supported set of commands is identical to the one
supported by
OSv cli module. The app depends on httpserver-cli OSv module and external
project
https://github.com/wkozaczuk/osv-html5-terminal.git.
You can build and run it a standalone:
./scripts/build image=httpserver-html5-cli.fg
Or add it to you favorite app:
./scripts/build image=elasticsearch,httpserver-html5-cli
You can open it in a browser by typing this URL:
http://localhost:8000/cli/
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
Message-Id: <1503419783-6274-1-git-send-email-jwkozac...@gmail.com>
---
diff --git a/httpserver-html5-cli/.gitignore
b/httpserver-html5-cli/.gitignore
--- a/httpserver-html5-cli/.gitignore
+++ b/httpserver-html5-cli/.gitignore
@@ -0,0 +1 @@
+osv-html5-terminal
diff --git a/httpserver-html5-cli/Makefile b/httpserver-html5-cli/Makefile
--- a/httpserver-html5-cli/Makefile
+++ b/httpserver-html5-cli/Makefile
@@ -0,0 +1,23 @@
+src = $(shell readlink -f ../..)
+app-dir = $(src)/apps/httpserver-html5-cli
+
+all: module
+module: html5-cli
+
+html5-cli: osv-html5-terminal/.git
+ cd $(app-dir) && \
+ (command -v node > /dev/null 2>&1 || (echo "Node not installed. Install
node (https://nodejs.org/en/download/package-manager/) and try again" &&
exit 1)) && \
+ cd osv-html5-terminal && \
+ npm install && \
+ node_modules/grunt-cli/bin/grunt
+
+.PHONY: html5-cli
+
+osv-html5-terminal/.git:
+ cd $(app-dir) && \
+ git clone --depth 1 https://github.com/wkozaczuk/osv-html5-terminal.git
+
+clean:
+ cd $(app-dir) && rm -rf osv-html5-terminal
+
+.SECONDARY:
diff --git a/httpserver-html5-cli/httpserver.conf
b/httpserver-html5-cli/httpserver.conf
--- a/httpserver-html5-cli/httpserver.conf
+++ b/httpserver-html5-cli/httpserver.conf
@@ -0,0 +1,20 @@
+{
+ "port": "8000",
+ "redirects": [
+ {
+ "path": "/",
+ "target_path": "/cli/"
+ }
+ ],
+ "file_mappings": [
+ {
+ "path": "/cli",
+ "file": "/usr/mgmt/cli/index.html",
+ "exact_match": true
+ },
+ {
+ "path": "/cli",
+ "directory": "/usr/mgmt/cli"
+ }
+ ]
+}
diff --git a/httpserver-html5-cli/module.py b/httpserver-html5-cli/module.py
--- a/httpserver-html5-cli/module.py
+++ b/httpserver-html5-cli/module.py
@@ -0,0 +1,24 @@
+import os
+from osv.modules.api import *
+from osv.modules.filemap import FileMap
+from osv.modules import api
+
+_app = '${OSV_BASE}/apps/httpserver-html5-cli'
+
+usr_files = FileMap()
+usr_files.add(os.path.join(_app,
'osv-html5-terminal/dist')).to('/usr/mgmt/cli')
+usr_files.add(os.path.join(_app, 'httpserver.conf')).to('/tmp/httpserver.conf')
+
+api.require('httpserver-api')
+
+# httpserver will run regardless of an explicit command line
+# passed with "run.py -e".
+_exe = '/libhttpserver.so'
+daemon = api.run_on_init(_exe + ' &!')
+
+fg = api.run(_exe)
+
+fg_ssl = api.run(_exe + ' --ssl')
+fg_cors = api.run(_exe + ' --access-allow=true')
+
+default = daemon
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.