diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 7bde74c..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,44 +0,0 @@ -# How to contribute - -GoTTY is MIT licensed and accepts contributions via GitHub pull requests. We also accepts feature requests on GitHub issues. - -## Reporting a bug - -Reporting a bug is always welcome and one of the best ways to contribute. A good bug report helps the developers to improve the product much easier. We therefore would like to ask you to fill out the quesions on the issue template as much as possible. That helps us to figure out what's happening and discover the root cause. - - -## Requesting a new feature - -When you find that GoTTY cannot fullfill your requirements because of lack of ability, you may want to open a new feature request. In that case, please file a new issue with your usecase and requirements. - - -## Opening a pull request - -### Code Style - -Please run `go fmt` on your Go code and make sure that your commits are organized for each logical change and your commit messages are in proper format (see below). - -[Go's official code style guide](https://github.com/golang/go/wiki/CodeReviewComments) is also helpful. - -### Format of the commit message - -When you write a commit message, we recommend include following information to make review easier and keep the history cleaerer. - -* What is the change -* The reason for the change - -The following is an example: - -``` -Add something new to existing package - -Since the existing function lacks that mechanism for some purpose, -this commit adds a new structure to provide it. -``` - -When your pull request is to add a new feature, we recommend add an actual usecase so that we can discuss the best way to achive your requirement. Opening a proposal issue in advance is another good way to start discussion of new features. - - -## Contact - -If you have a trivial question about GoTTY for a bug or new feature, you can contact @sorenisanerd on Twitter (unfortunately, I cannot provide support on GoTTY though). diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 95dcea5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM golang:1.13.1 - -WORKDIR /gotty -COPY . /gotty -RUN CGO_ENABLED=0 make - -FROM alpine:latest - -RUN apk update && \ - apk upgrade && \ - apk --no-cache add ca-certificates && \ - apk add bash -WORKDIR /root -COPY --from=0 /gotty/gotty /usr/bin/ -CMD ["gotty", "-w", "bash"] diff --git a/Makefile b/Makefile deleted file mode 100644 index 2aa0f24..0000000 --- a/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -OUTPUT_DIR = ./builds -GIT_COMMIT = `git rev-parse HEAD | cut -c1-7` -VERSION = 2.1.0 -BUILD_OPTIONS = -ldflags "-X main.Version=$(VERSION) -X main.CommitID=$(GIT_COMMIT)" - -gotty: main.go server/*.go webtty/*.go backend/*.go Makefile asset - go build ${BUILD_OPTIONS} - -docker: - docker build . -t gotty-bash:$(VERSION) - -.PHONY: asset -asset: bindata/static/js/gotty.js bindata/static/index.html bindata/static/favicon.png bindata/static/css/index.css bindata/static/css/xterm.css bindata/static/css/xterm_customize.css bindata/static/manifest.json bindata/static/icon_192.png server/asset.go - -server/asset.go: - go-bindata -prefix bindata -pkg server -ignore=\\.gitkeep -o server/asset.go bindata/... - gofmt -w server/asset.go - -.PHONY: all -all: asset gotty docker - -bindata: - mkdir bindata - -bindata/static: bindata - mkdir bindata/static - -bindata/static/index.html: bindata/static resources/index.html - cp resources/index.html bindata/static/index.html - -bindata/static/manifest.json: bindata/static resources/manifest.json - cp resources/manifest.json bindata/static/manifest.json - -bindata/static/favicon.png: bindata/static resources/favicon.png - cp resources/favicon.png bindata/static/favicon.png - -bindata/static/icon_192.png: bindata/static resources/icon_192.png - cp resources/icon_192.png bindata/static/icon_192.png - -bindata/static/js: bindata/static - mkdir -p bindata/static/js - -bindata/static/css: bindata/static - mkdir -p bindata/static/css - -bindata/static/css/index.css: bindata/static/css resources/index.css - cp resources/index.css bindata/static/css/index.css - -bindata/static/css/xterm_customize.css: bindata/static/css resources/xterm_customize.css - cp resources/xterm_customize.css bindata/static/css/xterm_customize.css - -bindata/static/css/xterm.css: bindata/static/css js/node_modules/xterm/dist/xterm.css - cp js/node_modules/xterm/dist/xterm.css bindata/static/css/xterm.css - -js/node_modules/xterm/dist/xterm.css: - cd js && \ - npm install - -bindata/static/js/gotty.js: js/src/* js/node_modules/webpack - cd js && \ - npx webpack - -js/node_modules/webpack: - cd js && \ - npm install - -README.md: README.md.in - (cat $< ; git log --pretty=format:' * %aN' | \ - grep -v 'S.*ren L. Hansen' | \ - grep -v 'Iwasaki Yudai' | \ - sort -u ) > $@ - -tools: - go get github.com/tools/godep - go get github.com/mitchellh/gox - go get github.com/tcnksm/ghr - go get github.com/jteeuwen/go-bindata/... - -test: - if [ `go fmt $(go list ./... | grep -v /vendor/) | wc -l` -gt 0 ]; then echo "go fmt error"; exit 1; fi - -cross_compile: - GOARM=5 gox -os="darwin linux freebsd netbsd openbsd solaris" -arch="386 amd64 arm" -osarch="!darwin/386" -osarch="!darwin/arm" -output "${OUTPUT_DIR}/pkg/{{.OS}}_{{.Arch}}/{{.Dir}}" - -targz: - mkdir -p ${OUTPUT_DIR}/dist - cd ${OUTPUT_DIR}/pkg/; for osarch in *; do (cd $$osarch; tar zcvf ../../dist/gotty_${VERSION}_$$osarch.tar.gz ./*); done; - -shasums: - cd ${OUTPUT_DIR}/dist; sha256sum * > ./SHA256SUMS - -release-artifacts: asset gotty cross_compile targz shasums - -release: - ghr -draft -prerelease ${VERSION} ${OUTPUT_DIR}/dist # -c ${GIT_COMMIT} --delete --prerelease -u sorenisanerd -r gotty ${VERSION} - -clean: - rm -fr gotty builds bindata server/asset.go js/dist diff --git a/NEWS.md b/NEWS.md deleted file mode 100644 index 182180e..0000000 --- a/NEWS.md +++ /dev/null @@ -1,11 +0,0 @@ -# GoTTY releases - -## v2.1.0 (unreleased) - - * Use Go modules and update cli module import path (Thanks, @svanellewee - * Fix typos (Thanks, @0xflotus, @RealCyGuy, @ygit, @Jason-Cooke and @fredster33!) - * Fix printing of ipv6 addresses (Thanks, @Felixoid!) - * Add Progressive Web App support (Thanks, @sehaas!) - * Add instructions for GNU screen (Thanks, @Immortalin!) - * Add Solaris support (Thanks, @fazalmajid!) - * New maintainer: @sorenisanerd diff --git a/README.md b/README.md deleted file mode 100644 index 3676af6..0000000 --- a/README.md +++ /dev/null @@ -1,237 +0,0 @@ -# ![](https://raw.githubusercontent.com/sorenisanerd/gotty/master/resources/favicon.png) GoTTY - Share your terminal as a web application - -[![GitHub release](http://img.shields.io/github/release/sorenisanerd/gotty.svg?style=flat-square)][release] -[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license] - -[release]: https://github.com/sorenisanerd/gotty/releases -[license]: https://github.com/sorenisanerd/gotty/blob/master/LICENSE - -GoTTY is a simple command line tool that turns your CLI tools into web applications. - -![Screenshot](https://raw.githubusercontent.com/sorenisanerd/gotty/master/screenshot.gif) - -# Installation - -Download the latest stable binary file from the [Releases](https://github.com/sorenisanerd/gotty/releases) page. Note that the release marked `Pre-release` is built for testing purpose, which can include unstable or breaking changes. Download a release marked [Latest release](https://github.com/sorenisanerd/gotty/releases/latest) for a stable build. - -(Files named with `darwin_amd64` are for Mac OS X users) - -## Homebrew Installation - -You can install GoTTY with [Homebrew](http://brew.sh/) as well. - -```sh -$ brew install yudai/gotty/gotty -``` - -## `go get` Installation (Development) - -If you have a Go language environment, you can install GoTTY with the `go get` command. However, this command builds a binary file from the latest master branch, which can include unstable or breaking changes. GoTTY requires go1.9 or later. - -```sh -$ go get github.com/sorenisanerd/gotty -``` - -# Usage - -``` -Usage: gotty [options] [] -``` - -Run `gotty` with your preferred command as its arguments (e.g. `gotty top`). - -By default, GoTTY starts a web server at port 8080. Open the URL on your web browser and you can see the running command as if it were running on your terminal. - -## Options - -``` ---address value, -a value IP address to listen (default: "0.0.0.0") [$GOTTY_ADDRESS] ---port value, -p value Port number to listen (default: "8080") [$GOTTY_PORT] ---permit-write, -w Permit clients to write to the TTY (BE CAREFUL) [$GOTTY_PERMIT_WRITE] ---credential value, -c value Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL] ---random-url, -r Add a random string to the URL [$GOTTY_RANDOM_URL] ---random-url-length value Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH] ---tls, -t Enable TLS/SSL [$GOTTY_TLS] ---tls-crt value TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT] ---tls-key value TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY] ---tls-ca-crt value TLS/SSL CA certificate file for client certifications (default: "~/.gotty.ca.crt") [$GOTTY_TLS_CA_CRT] ---index value Custom index.html file [$GOTTY_INDEX] ---title-format value Title format of browser window (default: "{{ .command }}@{{ .hostname }}") [$GOTTY_TITLE_FORMAT] ---reconnect Enable reconnection [$GOTTY_RECONNECT] ---reconnect-time value Time to reconnect (default: 10) [$GOTTY_RECONNECT_TIME] ---max-connection value Maximum connection to gotty (default: 0) [$GOTTY_MAX_CONNECTION] ---once Accept only one client and exit on disconnection [$GOTTY_ONCE] ---timeout value Timeout seconds for waiting a client(0 to disable) (default: 0) [$GOTTY_TIMEOUT] ---permit-arguments Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB) [$GOTTY_PERMIT_ARGUMENTS] ---width value Static width of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_WIDTH] ---height value Static height of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_HEIGHT] ---ws-origin value A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default [$GOTTY_WS_ORIGIN] ---term value Terminal name to use on the browser, one of xterm or hterm. (default: "xterm") [$GOTTY_TERM] ---close-signal value Signal sent to the command process when gotty close it (default: SIGHUP) (default: 1) [$GOTTY_CLOSE_SIGNAL] ---close-timeout value Time in seconds to force kill process after client is disconnected (default: -1) (default: -1) [$GOTTY_CLOSE_TIMEOUT] ---config value Config file path (default: "~/.gotty") [$GOTTY_CONFIG] ---version, -v print the version -``` - -### Config File - -You can customize default options and your terminal (hterm) by providing a config file to the `gotty` command. GoTTY loads a profile file at `~/.gotty` by default when it exists. - -``` -// Listen at port 9000 by default -port = "9000" - -// Enable TSL/SSL by default -enable_tls = true - -// hterm preferences -// Smaller font and a little bit bluer background color -preferences { - font_size = 5 - background_color = "rgb(16, 16, 32)" -} -``` - -See the [`.gotty`](https://github.com/sorenisanerd/gotty/blob/master/.gotty) file in this repository for the list of configuration options. - -### Security Options - -By default, GoTTY doesn't allow clients to send any keystrokes or commands except terminal window resizing. When you want to permit clients to write input to the TTY, add the `-w` option. However, accepting input from remote clients is dangerous for most commands. When you need interaction with the TTY for some reasons, consider starting GoTTY with tmux or GNU Screen and run your command on it (see "Sharing with Multiple Clients" section for detail). - -To restrict client access, you can use the `-c` option to enable the basic authentication. With this option, clients need to input the specified username and password to connect to the GoTTY server. Note that the credentials will be transmitted between the server and clients in plain text. For more strict authentication, consider the SSL/TLS client certificate authentication described below. - -The `-r` option is a little bit casualer way to restrict access. With this option, GoTTY generates a random URL so that only people who know the URL can get access to the server. - -All traffic between the server and clients are NOT encrypted by default. When you send secret information through GoTTY, we strongly recommend you use the `-t` option which enables TLS/SSL on the session. By default, GoTTY loads the crt and key files placed at `~/.gotty.crt` and `~/.gotty.key`. You can overwrite these file paths with the `--tls-crt` and `--tls-key` options. When you need to generate a self-signed certification file, you can use the `openssl` command. - -```sh -openssl req -x509 -nodes -days 9999 -newkey rsa:2048 -keyout ~/.gotty.key -out ~/.gotty.crt -``` - -(NOTE: For Safari uses, see [how to enable self-signed certificates for WebSockets](http://blog.marcon.me/post/24874118286/secure-websockets-safari) when use self-signed certificates) - -For additional security, you can use the SSL/TLS client certificate authentication by providing a CA certificate file to the `--tls-ca-crt` option (this option requires the `-t` or `--tls` to be set). This option requires all clients to send valid client certificates that are signed by the specified certification authority. - -## Sharing with Multiple Clients - -GoTTY starts a new process with the given command when a new client connects to the server. This means users cannot share a single terminal with others by default. However, you can use terminal multiplexers for sharing a single process with multiple clients. -### Screen -After installing GNU screen, start a new session with `screen -S name-for-session` and connect to it with gotty in another terminal window/tab through `screen -x name-for-session`. All commands and activities being done in the first terminal tab/window will now be broadcasted by gotty. -### Tmux -For example, you can start a new tmux session named `gotty` with `top` command by the command below. - -```sh -$ gotty tmux new -A -s gotty top -``` - -This command doesn't allow clients to send keystrokes, however, you can attach the session from your local terminal and run operations like switching the mode of the `top` command. To connect to the tmux session from your terminal, you can use following command. - -```sh -$ tmux new -A -s gotty -``` - -By using terminal multiplexers, you can have the control of your terminal and allow clients to just see your screen. - -### Quick Sharing on tmux - -To share your current session with others by a shortcut key, you can add a line like below to your `.tmux.conf`. - -``` -# Start GoTTY in a new window with C-t -bind-key C-t new-window "gotty tmux attach -t `tmux display -p '#S'`" -``` - -## Playing with Docker - -When you want to create a jailed environment for each client, you can use Docker containers like following: - -```sh -$ gotty -w docker run -it --rm busybox -``` - -## Development - -You can build a binary using the following commands. Windows is not supported now. go1.9 is required. - -```sh -# Install tools -go get github.com/jteeuwen/go-bindata/... -go get github.com/tools/godep - -# Build -make -``` - -To build the frontend part (JS files and other static files), you need `npm`. - -## Architecture - -GoTTY uses [xterm.js](https://xtermjs.org/) and [hterm](https://groups.google.com/a/chromium.org/forum/#!forum/chromium-hterm) to run a JavaScript based terminal on web browsers. GoTTY itself provides a websocket server that simply relays output from the TTY to clients and receives input from clients and forwards it to the TTY. This hterm + websocket idea is inspired by [Wetty](https://github.com/krishnasrinivas/wetty). - -## Alternatives - -### Command line client - -* [gotty-client](https://github.com/moul/gotty-client): If you want to connect to GoTTY server from your terminal - -### Terminal/SSH on Web Browsers - -* [Secure Shell (Chrome App)](https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo): If you are a chrome user and need a "real" SSH client on your web browser, perhaps the Secure Shell app is what you want -* [Wetty](https://github.com/krishnasrinivas/wetty): Node based web terminal (SSH/login) -* [ttyd](https://tsl0922.github.io/ttyd): C port of GoTTY with CJK and IME support - -### Terminal Sharing - -* [tmate](http://tmate.io/): Forked-Tmux based Terminal-Terminal sharing -* [termshare](https://termsha.re): Terminal-Terminal sharing through a HTTP server -* [tmux](https://tmux.github.io/): Tmux itself also supports TTY sharing through SSH) - -# License - -The MIT License - -# Contributors - -## Original author - - * Iwasaki Yudai - -## Maintainer - - * Søren L. Hansen - -## Contributors - * 0xflotus - * Andrea Lusuardi - uovobw - * Andy Skelton - * Artem Medvedev - * Blake Jennings - * Christian Jensen - * Christopher Wilkinson - * Cyrus - * David Horsley - * Fazal Majid - * freakhill - * fredster33 - * Jan-Willem Korver - * Jason Cooke - * Johan Gall - * Korenevskiy Denis - * Lin - * Manfred Touron - * Massimiliano Stucchi - * mattn - * Mikhail f. Shiryaev - * Quentin Perez - * Richard Metzler - * Robert Bittle - * Sebastian Haas - * shingt - * Shoji Ihara - * Shuanglei Tao - * Stephan van Ellewee - * The Gitter Badger - * Xinyun Zhou - * Yifa Zhang - * yogesh singh - * zlji diff --git a/README.md.in b/README.md.in deleted file mode 100644 index 3284a2e..0000000 --- a/README.md.in +++ /dev/null @@ -1,203 +0,0 @@ -# ![](https://raw.githubusercontent.com/sorenisanerd/gotty/master/resources/favicon.png) GoTTY - Share your terminal as a web application - -[![GitHub release](http://img.shields.io/github/release/sorenisanerd/gotty.svg?style=flat-square)][release] -[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license] - -[release]: https://github.com/sorenisanerd/gotty/releases -[license]: https://github.com/sorenisanerd/gotty/blob/master/LICENSE - -GoTTY is a simple command line tool that turns your CLI tools into web applications. - -![Screenshot](https://raw.githubusercontent.com/sorenisanerd/gotty/master/screenshot.gif) - -# Installation - -Download the latest stable binary file from the [Releases](https://github.com/sorenisanerd/gotty/releases) page. Note that the release marked `Pre-release` is built for testing purpose, which can include unstable or breaking changes. Download a release marked [Latest release](https://github.com/sorenisanerd/gotty/releases/latest) for a stable build. - -(Files named with `darwin_amd64` are for Mac OS X users) - -## Homebrew Installation - -You can install GoTTY with [Homebrew](http://brew.sh/) as well. - -```sh -$ brew install yudai/gotty/gotty -``` - -## `go get` Installation (Development) - -If you have a Go language environment, you can install GoTTY with the `go get` command. However, this command builds a binary file from the latest master branch, which can include unstable or breaking changes. GoTTY requires go1.9 or later. - -```sh -$ go get github.com/sorenisanerd/gotty -``` - -# Usage - -``` -Usage: gotty [options] [] -``` - -Run `gotty` with your preferred command as its arguments (e.g. `gotty top`). - -By default, GoTTY starts a web server at port 8080. Open the URL on your web browser and you can see the running command as if it were running on your terminal. - -## Options - -``` ---address value, -a value IP address to listen (default: "0.0.0.0") [$GOTTY_ADDRESS] ---port value, -p value Port number to listen (default: "8080") [$GOTTY_PORT] ---permit-write, -w Permit clients to write to the TTY (BE CAREFUL) [$GOTTY_PERMIT_WRITE] ---credential value, -c value Credential for Basic Authentication (ex: user:pass, default disabled) [$GOTTY_CREDENTIAL] ---random-url, -r Add a random string to the URL [$GOTTY_RANDOM_URL] ---random-url-length value Random URL length (default: 8) [$GOTTY_RANDOM_URL_LENGTH] ---tls, -t Enable TLS/SSL [$GOTTY_TLS] ---tls-crt value TLS/SSL certificate file path (default: "~/.gotty.crt") [$GOTTY_TLS_CRT] ---tls-key value TLS/SSL key file path (default: "~/.gotty.key") [$GOTTY_TLS_KEY] ---tls-ca-crt value TLS/SSL CA certificate file for client certifications (default: "~/.gotty.ca.crt") [$GOTTY_TLS_CA_CRT] ---index value Custom index.html file [$GOTTY_INDEX] ---title-format value Title format of browser window (default: "{{ .command }}@{{ .hostname }}") [$GOTTY_TITLE_FORMAT] ---reconnect Enable reconnection [$GOTTY_RECONNECT] ---reconnect-time value Time to reconnect (default: 10) [$GOTTY_RECONNECT_TIME] ---max-connection value Maximum connection to gotty (default: 0) [$GOTTY_MAX_CONNECTION] ---once Accept only one client and exit on disconnection [$GOTTY_ONCE] ---timeout value Timeout seconds for waiting a client(0 to disable) (default: 0) [$GOTTY_TIMEOUT] ---permit-arguments Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB) [$GOTTY_PERMIT_ARGUMENTS] ---width value Static width of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_WIDTH] ---height value Static height of the screen, 0(default) means dynamically resize (default: 0) [$GOTTY_HEIGHT] ---ws-origin value A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default [$GOTTY_WS_ORIGIN] ---term value Terminal name to use on the browser, one of xterm or hterm. (default: "xterm") [$GOTTY_TERM] ---close-signal value Signal sent to the command process when gotty close it (default: SIGHUP) (default: 1) [$GOTTY_CLOSE_SIGNAL] ---close-timeout value Time in seconds to force kill process after client is disconnected (default: -1) (default: -1) [$GOTTY_CLOSE_TIMEOUT] ---config value Config file path (default: "~/.gotty") [$GOTTY_CONFIG] ---version, -v print the version -``` - -### Config File - -You can customize default options and your terminal (hterm) by providing a config file to the `gotty` command. GoTTY loads a profile file at `~/.gotty` by default when it exists. - -``` -// Listen at port 9000 by default -port = "9000" - -// Enable TSL/SSL by default -enable_tls = true - -// hterm preferences -// Smaller font and a little bit bluer background color -preferences { - font_size = 5 - background_color = "rgb(16, 16, 32)" -} -``` - -See the [`.gotty`](https://github.com/sorenisanerd/gotty/blob/master/.gotty) file in this repository for the list of configuration options. - -### Security Options - -By default, GoTTY doesn't allow clients to send any keystrokes or commands except terminal window resizing. When you want to permit clients to write input to the TTY, add the `-w` option. However, accepting input from remote clients is dangerous for most commands. When you need interaction with the TTY for some reasons, consider starting GoTTY with tmux or GNU Screen and run your command on it (see "Sharing with Multiple Clients" section for detail). - -To restrict client access, you can use the `-c` option to enable the basic authentication. With this option, clients need to input the specified username and password to connect to the GoTTY server. Note that the credentials will be transmitted between the server and clients in plain text. For more strict authentication, consider the SSL/TLS client certificate authentication described below. - -The `-r` option is a little bit casualer way to restrict access. With this option, GoTTY generates a random URL so that only people who know the URL can get access to the server. - -All traffic between the server and clients are NOT encrypted by default. When you send secret information through GoTTY, we strongly recommend you use the `-t` option which enables TLS/SSL on the session. By default, GoTTY loads the crt and key files placed at `~/.gotty.crt` and `~/.gotty.key`. You can overwrite these file paths with the `--tls-crt` and `--tls-key` options. When you need to generate a self-signed certification file, you can use the `openssl` command. - -```sh -openssl req -x509 -nodes -days 9999 -newkey rsa:2048 -keyout ~/.gotty.key -out ~/.gotty.crt -``` - -(NOTE: For Safari uses, see [how to enable self-signed certificates for WebSockets](http://blog.marcon.me/post/24874118286/secure-websockets-safari) when use self-signed certificates) - -For additional security, you can use the SSL/TLS client certificate authentication by providing a CA certificate file to the `--tls-ca-crt` option (this option requires the `-t` or `--tls` to be set). This option requires all clients to send valid client certificates that are signed by the specified certification authority. - -## Sharing with Multiple Clients - -GoTTY starts a new process with the given command when a new client connects to the server. This means users cannot share a single terminal with others by default. However, you can use terminal multiplexers for sharing a single process with multiple clients. -### Screen -After installing GNU screen, start a new session with `screen -S name-for-session` and connect to it with gotty in another terminal window/tab through `screen -x name-for-session`. All commands and activities being done in the first terminal tab/window will now be broadcasted by gotty. -### Tmux -For example, you can start a new tmux session named `gotty` with `top` command by the command below. - -```sh -$ gotty tmux new -A -s gotty top -``` - -This command doesn't allow clients to send keystrokes, however, you can attach the session from your local terminal and run operations like switching the mode of the `top` command. To connect to the tmux session from your terminal, you can use following command. - -```sh -$ tmux new -A -s gotty -``` - -By using terminal multiplexers, you can have the control of your terminal and allow clients to just see your screen. - -### Quick Sharing on tmux - -To share your current session with others by a shortcut key, you can add a line like below to your `.tmux.conf`. - -``` -# Start GoTTY in a new window with C-t -bind-key C-t new-window "gotty tmux attach -t `tmux display -p '#S'`" -``` - -## Playing with Docker - -When you want to create a jailed environment for each client, you can use Docker containers like following: - -```sh -$ gotty -w docker run -it --rm busybox -``` - -## Development - -You can build a binary using the following commands. Windows is not supported now. go1.9 is required. - -```sh -# Install tools -go get github.com/jteeuwen/go-bindata/... -go get github.com/tools/godep - -# Build -make -``` - -To build the frontend part (JS files and other static files), you need `npm`. - -## Architecture - -GoTTY uses [xterm.js](https://xtermjs.org/) and [hterm](https://groups.google.com/a/chromium.org/forum/#!forum/chromium-hterm) to run a JavaScript based terminal on web browsers. GoTTY itself provides a websocket server that simply relays output from the TTY to clients and receives input from clients and forwards it to the TTY. This hterm + websocket idea is inspired by [Wetty](https://github.com/krishnasrinivas/wetty). - -## Alternatives - -### Command line client - -* [gotty-client](https://github.com/moul/gotty-client): If you want to connect to GoTTY server from your terminal - -### Terminal/SSH on Web Browsers - -* [Secure Shell (Chrome App)](https://chrome.google.com/webstore/detail/secure-shell/pnhechapfaindjhompbnflcldabbghjo): If you are a chrome user and need a "real" SSH client on your web browser, perhaps the Secure Shell app is what you want -* [Wetty](https://github.com/krishnasrinivas/wetty): Node based web terminal (SSH/login) -* [ttyd](https://tsl0922.github.io/ttyd): C port of GoTTY with CJK and IME support - -### Terminal Sharing - -* [tmate](http://tmate.io/): Forked-Tmux based Terminal-Terminal sharing -* [termshare](https://termsha.re): Terminal-Terminal sharing through a HTTP server -* [tmux](https://tmux.github.io/): Tmux itself also supports TTY sharing through SSH) - -# License - -The MIT License - -# Contributors - -## Original author - - * Iwasaki Yudai - -## Maintainer - - * Søren L. Hansen - -## Contributors diff --git a/backend/doc.go b/backend/doc.go deleted file mode 100644 index 2480943..0000000 --- a/backend/doc.go +++ /dev/null @@ -1 +0,0 @@ -package backend diff --git a/backend/localcommand/doc.go b/backend/localcommand/doc.go deleted file mode 100644 index 47cc2b7..0000000 --- a/backend/localcommand/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package localcommand provides an implementation of webtty.Slave -// that launches a local command with a PTY. -package localcommand diff --git a/backend/localcommand/factory.go b/backend/localcommand/factory.go deleted file mode 100644 index 9d0c916..0000000 --- a/backend/localcommand/factory.go +++ /dev/null @@ -1,48 +0,0 @@ -package localcommand - -import ( - "syscall" - "time" - - "github.com/sorenisanerd/gotty/server" -) - -type Options struct { - CloseSignal int `hcl:"close_signal" flagName:"close-signal" flagSName:"" flagDescribe:"Signal sent to the command process when gotty close it (default: SIGHUP)" default:"1"` - CloseTimeout int `hcl:"close_timeout" flagName:"close-timeout" flagSName:"" flagDescribe:"Time in seconds to force kill process after client is disconnected (default: -1)" default:"-1"` -} - -type Factory struct { - command string - argv []string - options *Options - opts []Option -} - -func NewFactory(command string, argv []string, options *Options) (*Factory, error) { - opts := []Option{WithCloseSignal(syscall.Signal(options.CloseSignal))} - if options.CloseTimeout >= 0 { - opts = append(opts, WithCloseTimeout(time.Duration(options.CloseTimeout)*time.Second)) - } - - return &Factory{ - command: command, - argv: argv, - options: options, - opts: opts, - }, nil -} - -func (factory *Factory) Name() string { - return "local command" -} - -func (factory *Factory) New(params map[string][]string) (server.Slave, error) { - argv := make([]string, len(factory.argv)) - copy(argv, factory.argv) - if params["arg"] != nil && len(params["arg"]) > 0 { - argv = append(argv, params["arg"]...) - } - - return New(factory.command, argv, factory.opts...) -} diff --git a/backend/localcommand/local_command.go b/backend/localcommand/local_command.go deleted file mode 100644 index 71b6c18..0000000 --- a/backend/localcommand/local_command.go +++ /dev/null @@ -1,123 +0,0 @@ -package localcommand - -import ( - "os" - "os/exec" - "syscall" - "time" - - "github.com/creack/pty" - "github.com/pkg/errors" -) - -const ( - DefaultCloseSignal = syscall.SIGINT - DefaultCloseTimeout = 10 * time.Second -) - -type LocalCommand struct { - command string - argv []string - - closeSignal syscall.Signal - closeTimeout time.Duration - - cmd *exec.Cmd - pty *os.File - ptyClosed chan struct{} -} - -func New(command string, argv []string, options ...Option) (*LocalCommand, error) { - cmd := exec.Command(command, argv...) - - cmd.Env = append(os.Environ(), "TERM=xterm-256color") - - pty, err := pty.Start(cmd) - if err != nil { - // todo close cmd? - return nil, errors.Wrapf(err, "failed to start command `%s`", command) - } - ptyClosed := make(chan struct{}) - - lcmd := &LocalCommand{ - command: command, - argv: argv, - - closeSignal: DefaultCloseSignal, - closeTimeout: DefaultCloseTimeout, - - cmd: cmd, - pty: pty, - ptyClosed: ptyClosed, - } - - for _, option := range options { - option(lcmd) - } - - // When the process is closed by the user, - // close pty so that Read() on the pty breaks with an EOF. - go func() { - defer func() { - lcmd.pty.Close() - close(lcmd.ptyClosed) - }() - - lcmd.cmd.Wait() - }() - - return lcmd, nil -} - -func (lcmd *LocalCommand) Read(p []byte) (n int, err error) { - return lcmd.pty.Read(p) -} - -func (lcmd *LocalCommand) Write(p []byte) (n int, err error) { - return lcmd.pty.Write(p) -} - -func (lcmd *LocalCommand) Close() error { - if lcmd.cmd != nil && lcmd.cmd.Process != nil { - lcmd.cmd.Process.Signal(lcmd.closeSignal) - } - for { - select { - case <-lcmd.ptyClosed: - return nil - case <-lcmd.closeTimeoutC(): - lcmd.cmd.Process.Signal(syscall.SIGKILL) - } - } -} - -func (lcmd *LocalCommand) WindowTitleVariables() map[string]interface{} { - return map[string]interface{}{ - "command": lcmd.command, - "argv": lcmd.argv, - "pid": lcmd.cmd.Process.Pid, - } -} - -func (lcmd *LocalCommand) ResizeTerminal(width int, height int) error { - window := pty.Winsize{ - Rows: uint16(height), - Cols: uint16(width), - X: 0, - Y: 0, - } - err := pty.Setsize(lcmd.pty, &window) - if err != nil { - return err - } else { - return nil - } -} - -func (lcmd *LocalCommand) closeTimeoutC() <-chan time.Time { - if lcmd.closeTimeout >= 0 { - return time.After(lcmd.closeTimeout) - } - - return make(chan time.Time) -} diff --git a/backend/localcommand/options.go b/backend/localcommand/options.go deleted file mode 100644 index 72af01f..0000000 --- a/backend/localcommand/options.go +++ /dev/null @@ -1,20 +0,0 @@ -package localcommand - -import ( - "syscall" - "time" -) - -type Option func(*LocalCommand) - -func WithCloseSignal(signal syscall.Signal) Option { - return func(lcmd *LocalCommand) { - lcmd.closeSignal = signal - } -} - -func WithCloseTimeout(timeout time.Duration) Option { - return func(lcmd *LocalCommand) { - lcmd.closeTimeout = timeout - } -} diff --git a/favicon.psd b/favicon.psd deleted file mode 100755 index e6f8925..0000000 Binary files a/favicon.psd and /dev/null differ diff --git a/go.mod b/go.mod index fc80319..a4a4c93 100644 --- a/go.mod +++ b/go.mod @@ -2,16 +2,4 @@ module github.com/sorenisanerd/gotty/v2 go 1.13 -require ( - github.com/NYTimes/gziphandler v1.1.1 - github.com/creack/pty v1.1.11 - github.com/elazarl/go-bindata-assetfs v1.0.1 - github.com/fatih/structs v1.1.0 - github.com/gorilla/websocket v1.4.2 - github.com/pkg/errors v0.9.1 - github.com/sorenisanerd/gotty v1.3.0 - github.com/urfave/cli/v2 v2.3.0 - github.com/yudai/hcl v0.0.0-20151013225006-5fa2393b3552 -) - retract [v2.0.0, v2.1.1] diff --git a/go.sum b/go.sum index 57f1be3..e69de29 100644 --- a/go.sum +++ b/go.sum @@ -1,51 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= -github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= -github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= -github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw= -github.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= -github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/yudai/hcl v0.0.0-20151013225006-5fa2393b3552 h1:tjsK9T2IA3d2FFNxzDP7AJf+EXhyuPd7PB4Z2HrtAoc= -github.com/yudai/hcl v0.0.0-20151013225006-5fa2393b3552/go.mod h1:hg0ZaCmQL3rze1cH8Fh2g0a9q8vQs0uN8ESpePEwSEw= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750 h1:ZBu6861dZq7xBnG1bn5SRU0vA8nx42at4+kP07FMTog= -golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210415045647-66c3f260301c h1:6L+uOeS3OQt/f4eFHXZcTxeZrGCuz+CLElgEBjbcTA4= -golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/js/package-lock.json b/js/package-lock.json deleted file mode 100644 index 2be3759..0000000 --- a/js/package-lock.json +++ /dev/null @@ -1,1467 +0,0 @@ -{ - "name": "gotty", - "version": "2.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@discoveryjs/json-ext": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.2.tgz", - "integrity": "sha512-HyYEUDeIj5rRQU2Hk5HTB2uHsbRQpF70nvMhVzi+VJR0X+xNEhjPui4/kBf3VeH/wqD28PT4sVOm8qqLjBrSZg==", - "dev": true - }, - "@types/eslint": { - "version": "7.2.10", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.10.tgz", - "integrity": "sha512-kUEPnMKrqbtpCq/KTaGFFKAcz6Ethm2EjCoKIDaCmfRBWLbFuTcOJfTlorwbnboXBzahqWLgUp1BQeKHiJzPUQ==", - "dev": true, - "requires": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "@types/eslint-scope": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.0.tgz", - "integrity": "sha512-O/ql2+rrCUe2W2rs7wMR+GqPRcgB6UiqN5RhrR5xruFlY7l9YLMn0ZkDzjoHLeiFkR8MCQZVudUuuvQ2BLC9Qw==", - "dev": true, - "requires": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, - "@types/estree": { - "version": "0.0.46", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.46.tgz", - "integrity": "sha512-laIjwTQaD+5DukBZaygQ79K1Z0jb1bPEMRrkXSLjtCcZm+abyp5YbrqpSLzD42FwWW6gK/aS4NYpJ804nG2brg==", - "dev": true - }, - "@types/json-schema": { - "version": "7.0.7", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz", - "integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==" - }, - "@types/node": { - "version": "14.14.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", - "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==", - "dev": true - }, - "@webassemblyjs/ast": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.0.tgz", - "integrity": "sha512-kX2W49LWsbthrmIRMbQZuQDhGtjyqXfEmmHyEi4XWnSZtPmxY0+3anPIzsnRb45VH/J55zlOfWvZuY47aJZTJg==", - "dev": true, - "requires": { - "@webassemblyjs/helper-numbers": "1.11.0", - "@webassemblyjs/helper-wasm-bytecode": "1.11.0" - } - }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.0.tgz", - "integrity": "sha512-Q/aVYs/VnPDVYvsCBL/gSgwmfjeCb4LW8+TMrO3cSzJImgv8lxxEPM2JA5jMrivE7LSz3V+PFqtMbls3m1exDA==", - "dev": true - }, - "@webassemblyjs/helper-api-error": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.0.tgz", - "integrity": "sha512-baT/va95eXiXb2QflSx95QGT5ClzWpGaa8L7JnJbgzoYeaA27FCvuBXU758l+KXWRndEmUXjP0Q5fibhavIn8w==", - "dev": true - }, - "@webassemblyjs/helper-buffer": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.0.tgz", - "integrity": "sha512-u9HPBEl4DS+vA8qLQdEQ6N/eJQ7gT7aNvMIo8AAWvAl/xMrcOSiI2M0MAnMCy3jIFke7bEee/JwdX1nUpCtdyA==", - "dev": true - }, - "@webassemblyjs/helper-numbers": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.0.tgz", - "integrity": "sha512-DhRQKelIj01s5IgdsOJMKLppI+4zpmcMQ3XboFPLwCpSNH6Hqo1ritgHgD0nqHeSYqofA6aBN/NmXuGjM1jEfQ==", - "dev": true, - "requires": { - "@webassemblyjs/floating-point-hex-parser": "1.11.0", - "@webassemblyjs/helper-api-error": "1.11.0", - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.0.tgz", - "integrity": "sha512-MbmhvxXExm542tWREgSFnOVo07fDpsBJg3sIl6fSp9xuu75eGz5lz31q7wTLffwL3Za7XNRCMZy210+tnsUSEA==", - "dev": true - }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.0.tgz", - "integrity": "sha512-3Eb88hcbfY/FCukrg6i3EH8H2UsD7x8Vy47iVJrP967A9JGqgBVL9aH71SETPx1JrGsOUVLo0c7vMCN22ytJew==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.11.0", - "@webassemblyjs/helper-buffer": "1.11.0", - "@webassemblyjs/helper-wasm-bytecode": "1.11.0", - "@webassemblyjs/wasm-gen": "1.11.0" - } - }, - "@webassemblyjs/ieee754": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.0.tgz", - "integrity": "sha512-KXzOqpcYQwAfeQ6WbF6HXo+0udBNmw0iXDmEK5sFlmQdmND+tr773Ti8/5T/M6Tl/413ArSJErATd8In3B+WBA==", - "dev": true, - "requires": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "@webassemblyjs/leb128": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.0.tgz", - "integrity": "sha512-aqbsHa1mSQAbeeNcl38un6qVY++hh8OpCOzxhixSYgbRfNWcxJNJQwe2rezK9XEcssJbbWIkblaJRwGMS9zp+g==", - "dev": true, - "requires": { - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/utf8": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.0.tgz", - "integrity": "sha512-A/lclGxH6SpSLSyFowMzO/+aDEPU4hvEiooCMXQPcQFPPJaYcPQNKGOCLUySJsYJ4trbpr+Fs08n4jelkVTGVw==", - "dev": true - }, - "@webassemblyjs/wasm-edit": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.0.tgz", - "integrity": "sha512-JHQ0damXy0G6J9ucyKVXO2j08JVJ2ntkdJlq1UTiUrIgfGMmA7Ik5VdC/L8hBK46kVJgujkBIoMtT8yVr+yVOQ==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.11.0", - "@webassemblyjs/helper-buffer": "1.11.0", - "@webassemblyjs/helper-wasm-bytecode": "1.11.0", - "@webassemblyjs/helper-wasm-section": "1.11.0", - "@webassemblyjs/wasm-gen": "1.11.0", - "@webassemblyjs/wasm-opt": "1.11.0", - "@webassemblyjs/wasm-parser": "1.11.0", - "@webassemblyjs/wast-printer": "1.11.0" - } - }, - "@webassemblyjs/wasm-gen": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.0.tgz", - "integrity": "sha512-BEUv1aj0WptCZ9kIS30th5ILASUnAPEvE3tVMTrItnZRT9tXCLW2LEXT8ezLw59rqPP9klh9LPmpU+WmRQmCPQ==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.11.0", - "@webassemblyjs/helper-wasm-bytecode": "1.11.0", - "@webassemblyjs/ieee754": "1.11.0", - "@webassemblyjs/leb128": "1.11.0", - "@webassemblyjs/utf8": "1.11.0" - } - }, - "@webassemblyjs/wasm-opt": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.0.tgz", - "integrity": "sha512-tHUSP5F4ywyh3hZ0+fDQuWxKx3mJiPeFufg+9gwTpYp324mPCQgnuVKwzLTZVqj0duRDovnPaZqDwoyhIO8kYg==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.11.0", - "@webassemblyjs/helper-buffer": "1.11.0", - "@webassemblyjs/wasm-gen": "1.11.0", - "@webassemblyjs/wasm-parser": "1.11.0" - } - }, - "@webassemblyjs/wasm-parser": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.0.tgz", - "integrity": "sha512-6L285Sgu9gphrcpDXINvm0M9BskznnzJTE7gYkjDbxET28shDqp27wpruyx3C2S/dvEwiigBwLA1cz7lNUi0kw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.11.0", - "@webassemblyjs/helper-api-error": "1.11.0", - "@webassemblyjs/helper-wasm-bytecode": "1.11.0", - "@webassemblyjs/ieee754": "1.11.0", - "@webassemblyjs/leb128": "1.11.0", - "@webassemblyjs/utf8": "1.11.0" - } - }, - "@webassemblyjs/wast-printer": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.0.tgz", - "integrity": "sha512-Fg5OX46pRdTgB7rKIUojkh9vXaVN6sGYCnEiJN1GYkb0RPwShZXp6KTDqmoMdQPKhcroOXh3fEzmkWmCYaKYhQ==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.11.0", - "@xtuc/long": "4.2.2" - } - }, - "@webpack-cli/configtest": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.2.tgz", - "integrity": "sha512-3OBzV2fBGZ5TBfdW50cha1lHDVf9vlvRXnjpVbJBa20pSZQaSkMJZiwA8V2vD9ogyeXn8nU5s5A6mHyf5jhMzA==", - "dev": true - }, - "@webpack-cli/info": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.2.3.tgz", - "integrity": "sha512-lLek3/T7u40lTqzCGpC6CAbY6+vXhdhmwFRxZLMnRm6/sIF/7qMpT8MocXCRQfz0JAh63wpbXLMnsQ5162WS7Q==", - "dev": true, - "requires": { - "envinfo": "^7.7.3" - } - }, - "@webpack-cli/serve": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.3.1.tgz", - "integrity": "sha512-0qXvpeYO6vaNoRBI52/UsbcaBydJCggoBBnIo/ovQQdn6fug0BgwsjorV1hVS7fMqGVTZGcVxv8334gjmbj5hw==", - "dev": true - }, - "@xtuc/ieee754": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true - }, - "@xtuc/long": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true - }, - "acorn": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.1.1.tgz", - "integrity": "sha512-xYiIVjNuqtKXMxlRMDc6mZUhXehod4a3gbZ1qRlM7icK4EbxUFNLhWoPblCvFtB2Y9CIqHP3CF/rdxLItaQv8g==", - "dev": true - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "dependencies": { - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - } - } - }, - "ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==" - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browserslist": { - "version": "4.16.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.4.tgz", - "integrity": "sha512-d7rCxYV8I9kj41RH8UKYnvDYCRENUlHRgyXy/Rhr/1BaeLGfiCptEdFE8MIrvGfWbBFNjVYx76SQWvNX1j+/cQ==", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001208", - "colorette": "^1.2.2", - "electron-to-chromium": "^1.3.712", - "escalade": "^3.1.1", - "node-releases": "^1.1.71" - } - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==" - }, - "caniuse-lite": { - "version": "1.0.30001209", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001209.tgz", - "integrity": "sha512-2Ktt4OeRM7EM/JaOZjuLzPYAIqmbwQMNnYbgooT+icoRGrKOyAxA1xhlnotBD1KArRSPsuJp3TdYcZYrL7qNxA==", - "dev": true - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "chrome-trace-event": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", - "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", - "dev": true - }, - "clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "colorette": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", - "integrity": "sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w==" - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "css-loader": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-5.2.1.tgz", - "integrity": "sha512-YCyRzlt/jgG1xanXZDG/DHqAueOtXFHeusP9TS478oP1J++JSKOyEgGW1GHVoCj/rkS+GWOlBwqQJBr9yajQ9w==", - "requires": { - "camelcase": "^6.2.0", - "cssesc": "^3.0.0", - "icss-utils": "^5.1.0", - "loader-utils": "^2.0.0", - "postcss": "^8.2.8", - "postcss-modules-extract-imports": "^3.0.0", - "postcss-modules-local-by-default": "^4.0.0", - "postcss-modules-scope": "^3.0.0", - "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.1.0", - "schema-utils": "^3.0.0", - "semver": "^7.3.4" - }, - "dependencies": { - "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - } - } - }, - "cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==" - }, - "electron-to-chromium": { - "version": "1.3.717", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.717.tgz", - "integrity": "sha512-OfzVPIqD1MkJ7fX+yTl2nKyOE4FReeVfMCzzxQS+Kp43hZYwHwThlGP+EGIZRXJsxCM7dqo8Y65NOX/HP12iXQ==", - "dev": true - }, - "emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==" - }, - "enhanced-resolve": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz", - "integrity": "sha512-Nv9m36S/vxpsI+Hc4/ZGRs0n9mXqSWGGq49zxb/cJfPAQMbUtttJAlNPS4AQzaBdw/pKskw5bMbekT/Y7W/Wlg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - } - }, - "enquirer": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", - "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "envinfo": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", - "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", - "dev": true - }, - "errno": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", - "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", - "dev": true, - "requires": { - "prr": "~0.0.0" - } - }, - "es-module-lexer": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.4.1.tgz", - "integrity": "sha512-ooYciCUtfw6/d2w56UVeqHPcoCFAiJdz5XOkYpv/Txl1HMUozpXjz/2RIQgqwKdXNDPSF1W7mJCFse3G+HDyAA==", - "dev": true - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true - }, - "events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true - }, - "execa": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.0.0.tgz", - "integrity": "sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "fastest-levenshtein": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz", - "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "dependencies": { - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - } - } - }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true - }, - "glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true - }, - "icss-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", - "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==" - }, - "import-local": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", - "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "dependencies": { - "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } - } - }, - "indexes-of": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", - "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=" - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", - "dev": true - }, - "is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "jest-worker": { - "version": "26.6.2", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz", - "integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==", - "dev": true, - "requires": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - } - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "requires": { - "minimist": "^1.2.5" - }, - "dependencies": { - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - } - } - }, - "kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true - }, - "libapps": { - "version": "github:yudai/libapps#424e3e95e5346ef0c0c281aaf2ef73463a55b39e", - "from": "github:yudai/libapps#release-hterm-1.70" - }, - "license-loader": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/license-loader/-/license-loader-0.5.0.tgz", - "integrity": "sha512-4p+estbTHilHxOXv/wh8qHndksfINzBT6HGvgIU4sfwWu28kCByHGV57K/HVgSujoFFv2wCITghGbK/qRiRbUQ==", - "dev": true - }, - "loader-runner": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz", - "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==", - "dev": true - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "memory-fs": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", - "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "micromatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", - "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - } - }, - "mime-db": { - "version": "1.47.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", - "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==", - "dev": true - }, - "mime-types": { - "version": "2.1.30", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", - "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", - "dev": true, - "requires": { - "mime-db": "1.47.0" - } - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "nanoid": { - "version": "3.1.22", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.22.tgz", - "integrity": "sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==" - }, - "neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node-releases": { - "version": "1.1.71", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.71.tgz", - "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "dev": true - }, - "postcss": { - "version": "8.2.10", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.2.10.tgz", - "integrity": "sha512-b/h7CPV7QEdrqIxtAf2j31U5ef05uBDuvoXv6L51Q4rcS1jdlXAVKJv+atCFdUXYl9dyTHGyoMzIepwowRJjFw==", - "requires": { - "colorette": "^1.2.2", - "nanoid": "^3.1.22", - "source-map": "^0.6.1" - } - }, - "postcss-modules-extract-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", - "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==" - }, - "postcss-modules-local-by-default": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz", - "integrity": "sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==", - "requires": { - "icss-utils": "^5.0.0", - "postcss-selector-parser": "^6.0.2", - "postcss-value-parser": "^4.1.0" - } - }, - "postcss-modules-scope": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.0.0.tgz", - "integrity": "sha512-hncihwFA2yPath8oZ15PZqvWGkWf+XUfQgUGamS4LqoP1anQLOsOJw0vr7J7IwLpoY9fatA2qiGUGmuZL0Iqlg==", - "requires": { - "postcss-selector-parser": "^6.0.4" - } - }, - "postcss-modules-values": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", - "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", - "requires": { - "icss-utils": "^5.0.0" - } - }, - "postcss-selector-parser": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.4.tgz", - "integrity": "sha512-gjMeXBempyInaBqpp8gODmwZ52WaYsVOsfr4L4lDQ7n3ncD6mEyySiDtgzCT+NYC0mmeOLvtsF8iaEf0YT6dBw==", - "requires": { - "cssesc": "^3.0.0", - "indexes-of": "^1.0.1", - "uniq": "^1.0.1", - "util-deprecate": "^1.0.2" - } - }, - "postcss-value-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", - "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==" - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "prr": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", - "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=", - "dev": true - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "rechoir": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.0.tgz", - "integrity": "sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==", - "dev": true, - "requires": { - "resolve": "^1.9.0" - } - }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dev": true, - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "requires": { - "resolve-from": "^5.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "requires": { - "lru-cache": "^6.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - } - }, - "serialize-javascript": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", - "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true - }, - "source-list-map": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", - "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - }, - "source-map-support": { - "version": "0.5.19", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", - "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - }, - "style-loader": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-2.0.0.tgz", - "integrity": "sha512-Z0gYUJmzZ6ZdRUqpg1r8GsaFKypE+3xAzuFeMuoHgjc9KZv3wMyCRjQIWEbhoFSq7+7yoHXySDJyyWQaPajeiQ==", - "requires": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0" - }, - "dependencies": { - "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - } - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "tapable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", - "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", - "dev": true - }, - "terser": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.6.1.tgz", - "integrity": "sha512-yv9YLFQQ+3ZqgWCUk+pvNJwgUTdlIxUk1WTN+RnaFJe2L7ipG2csPT0ra2XRm7Cs8cxN7QXmK1rFzEwYEQkzXw==", - "dev": true, - "requires": { - "commander": "^2.20.0", - "source-map": "~0.7.2", - "source-map-support": "~0.5.19" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "source-map": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true - } - } - }, - "terser-webpack-plugin": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.1.tgz", - "integrity": "sha512-5XNNXZiR8YO6X6KhSGXfY0QrGrCRlSwAEjIIrlRQR4W8nP69TaJUlh3bkuac6zzgspiGPfKEHcY295MMVExl5Q==", - "dev": true, - "requires": { - "jest-worker": "^26.6.2", - "p-limit": "^3.1.0", - "schema-utils": "^3.0.0", - "serialize-javascript": "^5.0.1", - "source-map": "^0.6.1", - "terser": "^5.5.1" - }, - "dependencies": { - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "ts-loader": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-8.1.0.tgz", - "integrity": "sha512-YiQipGGAFj2zBfqLhp28yUvPP9jUGqHxRzrGYuc82Z2wM27YIHbElXiaZDc93c3x0mz4zvBmS6q/DgExpdj37A==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^4.0.0", - "loader-utils": "^2.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4" - } - }, - "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", - "dev": true - }, - "uniq": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", - "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=" - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "requires": { - "punycode": "^2.1.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "v8-compile-cache": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", - "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", - "dev": true - }, - "watchpack": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.1.1.tgz", - "integrity": "sha512-Oo7LXCmc1eE1AjyuSBmtC3+Wy4HcV8PxWh2kP6fOl8yTlNS7r0K9l1ao2lrrUza7V39Y3D/BbJgY8VeSlc5JKw==", - "dev": true, - "requires": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - } - }, - "webpack": { - "version": "5.33.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.33.2.tgz", - "integrity": "sha512-X4b7F1sYBmJx8mlh2B7mV5szEkE0jYNJ2y3akgAP0ERi0vLCG1VvdsIxt8lFd4st6SUy0lf7W0CCQS566MBpJg==", - "dev": true, - "requires": { - "@types/eslint-scope": "^3.7.0", - "@types/estree": "^0.0.46", - "@webassemblyjs/ast": "1.11.0", - "@webassemblyjs/wasm-edit": "1.11.0", - "@webassemblyjs/wasm-parser": "1.11.0", - "acorn": "^8.0.4", - "browserslist": "^4.14.5", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.7.0", - "es-module-lexer": "^0.4.0", - "eslint-scope": "^5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.4", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.0.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.1.1", - "watchpack": "^2.0.0", - "webpack-sources": "^2.1.1" - }, - "dependencies": { - "enhanced-resolve": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.7.0.tgz", - "integrity": "sha512-6njwt/NsZFUKhM6j9U8hzVyD4E4r0x7NQzhTCbcWOJ0IQjNSAoalWmb0AE51Wn+fwan5qVESWi7t2ToBxs9vrw==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - } - }, - "graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true - }, - "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - }, - "tapable": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz", - "integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==", - "dev": true - } - } - }, - "webpack-cli": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.6.0.tgz", - "integrity": "sha512-9YV+qTcGMjQFiY7Nb1kmnupvb1x40lfpj8pwdO/bom+sQiP4OBMKjHq29YQrlDWDPZO9r/qWaRRywKaRDKqBTA==", - "dev": true, - "requires": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.0.2", - "@webpack-cli/info": "^1.2.3", - "@webpack-cli/serve": "^1.3.1", - "colorette": "^1.2.1", - "commander": "^7.0.0", - "enquirer": "^2.3.6", - "execa": "^5.0.0", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "v8-compile-cache": "^2.2.0", - "webpack-merge": "^5.7.3" - }, - "dependencies": { - "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "dev": true - } - } - }, - "webpack-merge": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.7.3.tgz", - "integrity": "sha512-6/JUQv0ELQ1igjGDzHkXbVDRxkfA57Zw7PfiupdLFJYrgFqY5ZP8xxbpp2lU3EPwYx89ht5Z/aDkD40hFCm5AA==", - "dev": true, - "requires": { - "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" - } - }, - "webpack-sources": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.2.0.tgz", - "integrity": "sha512-bQsA24JLwcnWGArOKUxYKhX3Mz/nK1Xf6hxullKERyktjNMC4x8koOeaDNTA2fEJ09BdWLbM/iTW0ithREUP0w==", - "dev": true, - "requires": { - "source-list-map": "^2.0.1", - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wildcard": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", - "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", - "dev": true - }, - "xterm": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/xterm/-/xterm-2.8.1.tgz", - "integrity": "sha512-AuqLOWpprmhSe4TcGE6Gh2uwkR0wUC95V0Q736OFUmG+84W+w+g6RzcgVhrbOTo/Fzcq9i0TRR5nYksRt2DSIQ==" - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } - } -} diff --git a/js/package.json b/js/package.json deleted file mode 100644 index e9cd613..0000000 --- a/js/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "gotty", - "version": "2.0.0", - "private": true, - "devDependencies": { - "license-loader": "^0.5.0", - "ts-loader": "^8.1.0", - "typescript": "^4.2.4", - "webpack": "^5.33.2", - "webpack-cli": "^4.6.0" - }, - "dependencies": { - "css-loader": "^5.2.1", - "libapps": "github:yudai/libapps#release-hterm-1.70", - "style-loader": "^2.0.0", - "xterm": "^2.7.0" - } -} diff --git a/js/src/hterm.ts b/js/src/hterm.ts deleted file mode 100644 index b49a22f..0000000 --- a/js/src/hterm.ts +++ /dev/null @@ -1,92 +0,0 @@ -import * as bare from "libapps"; - -export class Hterm { - elem: HTMLElement; - - term: bare.hterm.Terminal; - io: bare.hterm.IO; - - columns: number; - rows: number; - - // to "show" the current message when removeMessage() is called - message: string; - - constructor(elem: HTMLElement) { - this.elem = elem; - bare.hterm.defaultStorage = new bare.lib.Storage.Memory(); - this.term = new bare.hterm.Terminal(); - this.term.getPrefs().set("send-encoding", "raw"); - this.term.decorate(this.elem); - - this.io = this.term.io.push(); - this.term.installKeyboard(); - }; - - info(): { columns: number, rows: number } { - return { columns: this.columns, rows: this.rows }; - }; - - output(data: string) { - if (this.term.io != null) { - this.term.io.writeUTF8(data); - } - }; - - showMessage(message: string, timeout: number) { - this.message = message; - if (timeout > 0) { - this.term.io.showOverlay(message, timeout); - } else { - this.term.io.showOverlay(message, null); - } - }; - - removeMessage(): void { - // there is no hideOverlay(), so show the same message with 0 sec - this.term.io.showOverlay(this.message, 0); - } - - setWindowTitle(title: string) { - this.term.setWindowTitle(title); - }; - - setPreferences(value: object) { - Object.keys(value).forEach((key) => { - this.term.getPrefs().set(key, value[key]); - }); - }; - - onInput(callback: (input: string) => void) { - this.io.onVTKeystroke = (data) => { - callback(data); - }; - this.io.sendString = (data) => { - callback(data); - }; - }; - - onResize(callback: (colmuns: number, rows: number) => void) { - this.io.onTerminalResize = (columns: number, rows: number) => { - this.columns = columns; - this.rows = rows; - callback(columns, rows); - }; - }; - - deactivate(): void { - this.io.onVTKeystroke = function(){}; - this.io.sendString = function(){}; - this.io.onTerminalResize = function(){}; - this.term.uninstallKeyboard(); - } - - reset(): void { - this.removeMessage(); - this.term.installKeyboard(); - } - - close(): void { - this.term.uninstallKeyboard(); - } -} diff --git a/js/src/main.ts b/js/src/main.ts deleted file mode 100644 index 101190a..0000000 --- a/js/src/main.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Hterm } from "./hterm"; -import { Xterm } from "./xterm"; -import { Terminal, WebTTY, protocols } from "./webtty"; -import { ConnectionFactory } from "./websocket"; - -// @TODO remove these -declare var gotty_auth_token: string; -declare var gotty_term: string; - -const elem = document.getElementById("terminal") - -if (elem !== null) { - var term: Terminal; - if (gotty_term == "hterm") { - term = new Hterm(elem); - } else { - term = new Xterm(elem); - } - const httpsEnabled = window.location.protocol == "https:"; - const url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws'; - const args = window.location.search; - const factory = new ConnectionFactory(url, protocols); - const wt = new WebTTY(term, factory, args, gotty_auth_token); - const closer = wt.open(); - - window.addEventListener("unload", () => { - closer(); - term.close(); - }); -}; diff --git a/js/src/websocket.ts b/js/src/websocket.ts deleted file mode 100644 index 7f65177..0000000 --- a/js/src/websocket.ts +++ /dev/null @@ -1,60 +0,0 @@ -export class ConnectionFactory { - url: string; - protocols: string[]; - - constructor(url: string, protocols: string[]) { - this.url = url; - this.protocols = protocols; - }; - - create(): Connection { - return new Connection(this.url, this.protocols); - }; -} - -export class Connection { - bare: WebSocket; - - - constructor(url: string, protocols: string[]) { - this.bare = new WebSocket(url, protocols); - } - - open() { - // nothing todo for websocket - }; - - close() { - this.bare.close(); - }; - - send(data: string) { - this.bare.send(data); - }; - - isOpen(): boolean { - if (this.bare.readyState == WebSocket.CONNECTING || - this.bare.readyState == WebSocket.OPEN) { - return true - } - return false - } - - onOpen(callback: () => void) { - this.bare.onopen = (event) => { - callback(); - } - }; - - onReceive(callback: (data: string) => void) { - this.bare.onmessage = (event) => { - callback(event.data); - } - }; - - onClose(callback: () => void) { - this.bare.onclose = (event) => { - callback(); - }; - }; -} diff --git a/js/src/webtty.ts b/js/src/webtty.ts deleted file mode 100644 index 636f633..0000000 --- a/js/src/webtty.ts +++ /dev/null @@ -1,162 +0,0 @@ -export const protocols = ["webtty"]; - -export const msgInputUnknown = '0'; -export const msgInput = '1'; -export const msgPing = '2'; -export const msgResizeTerminal = '3'; - -export const msgUnknownOutput = '0'; -export const msgOutput = '1'; -export const msgPong = '2'; -export const msgSetWindowTitle = '3'; -export const msgSetPreferences = '4'; -export const msgSetReconnect = '5'; -export const msgSetBufferSize = '6'; - - -export interface Terminal { - info(): { columns: number, rows: number }; - output(data: string): void; - showMessage(message: string, timeout: number): void; - removeMessage(): void; - setWindowTitle(title: string): void; - setPreferences(value: object): void; - onInput(callback: (input: string) => void): void; - onResize(callback: (colmuns: number, rows: number) => void): void; - reset(): void; - deactivate(): void; - close(): void; -} - -export interface Connection { - open(): void; - close(): void; - send(data: string): void; - isOpen(): boolean; - onOpen(callback: () => void): void; - onReceive(callback: (data: string) => void): void; - onClose(callback: () => void): void; -} - -export interface ConnectionFactory { - create(): Connection; -} - - -export class WebTTY { - term: Terminal; - connectionFactory: ConnectionFactory; - args: string; - authToken: string; - reconnect: number; - bufSize: number; - - constructor(term: Terminal, connectionFactory: ConnectionFactory, args: string, authToken: string) { - this.term = term; - this.connectionFactory = connectionFactory; - this.args = args; - this.authToken = authToken; - this.reconnect = -1; - this.bufSize = 1024; - }; - - open() { - let connection = this.connectionFactory.create(); - let pingTimer: NodeJS.Timeout; - let reconnectTimeout: NodeJS.Timeout; - - const setup = () => { - connection.onOpen(() => { - const termInfo = this.term.info(); - - connection.send(JSON.stringify( - { - Arguments: this.args, - AuthToken: this.authToken, - } - )); - - - const resizeHandler = (colmuns: number, rows: number) => { - connection.send( - msgResizeTerminal + JSON.stringify( - { - columns: colmuns, - rows: rows - } - ) - ); - }; - - this.term.onResize(resizeHandler); - resizeHandler(termInfo.columns, termInfo.rows); - - this.term.onInput( - (input: string) => { - // Leave room for message type id - let effectiveBufferSize = this.bufSize - 1; - - // Split input into buffer sized chunks - for (let i = 0; i < Math.ceil(input.length/effectiveBufferSize); i++) { - let inputChunk = input.substring(i*effectiveBufferSize, Math.min((i+1)*effectiveBufferSize, input.length)) - connection.send(msgInput + inputChunk); - } - } - ); - - pingTimer = setInterval(() => { - connection.send(msgPing) - }, 30 * 1000); - - }); - - connection.onReceive((data) => { - const payload = data.slice(1); - switch (data[0]) { - case msgOutput: - this.term.output(atob(payload)); - break; - case msgPong: - break; - case msgSetWindowTitle: - this.term.setWindowTitle(payload); - break; - case msgSetPreferences: - const preferences = JSON.parse(payload); - this.term.setPreferences(preferences); - break; - case msgSetReconnect: - const autoReconnect = JSON.parse(payload); - console.log("Enabling reconnect: " + autoReconnect + " seconds") - this.reconnect = autoReconnect; - break; - case msgSetBufferSize: - const bufSize = JSON.parse(payload); - this.bufSize = bufSize; - break; - } - }); - - connection.onClose(() => { - clearInterval(pingTimer); - this.term.deactivate(); - this.term.showMessage("Connection Closed", 0); - if (this.reconnect > 0) { - reconnectTimeout = setTimeout(() => { - connection = this.connectionFactory.create(); - this.term.reset(); - setup(); - }, this.reconnect * 1000); - } - }); - - connection.open(); - } - - setup(); - return () => { - clearTimeout(reconnectTimeout); - connection.close(); - } - }; -}; diff --git a/js/src/xterm.ts b/js/src/xterm.ts deleted file mode 100644 index 0c3552a..0000000 --- a/js/src/xterm.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as bare from "xterm"; -import { lib } from "libapps" - - -bare.loadAddon("fit"); - -export class Xterm { - elem: HTMLElement; - term: bare; - resizeListener: () => void; - decoder: lib.UTF8Decoder; - - message: HTMLElement; - messageTimeout: number; - messageTimer: NodeJS.Timeout; - - - constructor(elem: HTMLElement) { - this.elem = elem; - this.term = new bare(); - - this.message = elem.ownerDocument.createElement("div"); - this.message.className = "xterm-overlay"; - this.messageTimeout = 2000; - - this.resizeListener = () => { - this.term.fit(); - this.term.scrollToBottom(); - this.showMessage(String(this.term.cols) + "x" + String(this.term.rows), this.messageTimeout); - }; - - this.term.on("open", () => { - this.resizeListener(); - window.addEventListener("resize", () => { this.resizeListener(); }); - }); - - this.term.open(elem, true); - - this.decoder = new lib.UTF8Decoder() - }; - - info(): { columns: number, rows: number } { - return { columns: this.term.cols, rows: this.term.rows }; - }; - - output(data: string) { - this.term.write(this.decoder.decode(data)); - }; - - showMessage(message: string, timeout: number) { - this.message.textContent = message; - this.elem.appendChild(this.message); - - if (this.messageTimer) { - clearTimeout(this.messageTimer); - } - if (timeout > 0) { - this.messageTimer = setTimeout(() => { - this.elem.removeChild(this.message); - }, timeout); - } - }; - - removeMessage(): void { - if (this.message.parentNode == this.elem) { - this.elem.removeChild(this.message); - } - } - - setWindowTitle(title: string) { - document.title = title; - }; - - setPreferences(value: object) { - }; - - onInput(callback: (input: string) => void) { - this.term.on("data", (data) => { - callback(data); - }); - - }; - - onResize(callback: (colmuns: number, rows: number) => void) { - this.term.on("resize", (data) => { - callback(data.cols, data.rows); - }); - }; - - deactivate(): void { - this.term.off("data"); - this.term.off("resize"); - this.term.blur(); - } - - reset(): void { - this.removeMessage(); - this.term.clear(); - } - - close(): void { - window.removeEventListener("resize", this.resizeListener); - this.term.destroy(); - } -} diff --git a/js/tsconfig.json b/js/tsconfig.json deleted file mode 100644 index a49a8f0..0000000 --- a/js/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./dist/", - "strictNullChecks": true, - "noUnusedLocals" : true, - "noImplicitThis": true, - "alwaysStrict": true, - "outDir": "./dist/", - "declaration": true, - "sourceMap": true, - "target": "es5", - "module": "commonJS", - "baseUrl": ".", - "paths": { - "*": ["./typings/*"] - } - }, - "exclude": [ - "node_modules" - ] -} diff --git a/js/typings/libapps/index.d.ts b/js/typings/libapps/index.d.ts deleted file mode 100644 index 81eb66d..0000000 --- a/js/typings/libapps/index.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export declare namespace hterm { - export class Terminal { - io: IO; - onTerminalReady: () => void; - - constructor(); - getPrefs(): Prefs; - decorate(HTMLElement); - installKeyboard(): void; - uninstallKeyboard(): void; - setWindowTitle(title: string): void; - reset(): void; - softReset(): void; - } - - export class IO { - writeUTF8: ((data: string) => void); - writeUTF16: ((data: string) => void); - onVTKeystroke: ((data: string) => void) | null; - sendString: ((data: string) => void) | null; - onTerminalResize: ((columns: number, rows: number) => void) | null; - - push(): IO; - writeUTF(data: string); - showOverlay(message: string, timeout: number | null); - } - - export class Prefs { - set(key: string, value: string): void; - } - - export var defaultStorage: lib.Storage; -} - -export declare namespace lib { - export interface Storage { - } - - export interface Memory { - new (): Storage; - Memory(): Storage - } - - export var Storage: { - Memory: Memory - } - - export class UTF8Decoder { - decode(str: string) - } -} diff --git a/js/webpack.config.js b/js/webpack.config.js deleted file mode 100644 index 0593d18..0000000 --- a/js/webpack.config.js +++ /dev/null @@ -1,33 +0,0 @@ -const path = require('path'); - -module.exports = { - entry: "./src/main.ts", - entry: { - "gotty": "./src/main.ts", - }, - output: { - path: path.resolve(__dirname, '../bindata/static/js/'), - }, - devtool: "source-map", - resolve: { - extensions: [".ts", ".tsx", ".js"], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - loader: "ts-loader", - exclude: /node_modules/ - }, - { - test: /\.css$/i, - use: ["style-loader", "css-loader"], - }, - { - test: /\.js$/, - include: /node_modules/, - loader: 'license-loader' - }, - ], - }, -}; diff --git a/main.go b/main.go index 4bf1ee7..5ac3461 100644 --- a/main.go +++ b/main.go @@ -1,152 +1,6 @@ package main -import ( - "context" - "fmt" - "log" - "os" - "os/signal" - "strings" - "syscall" - - cli "github.com/urfave/cli/v2" - - "github.com/sorenisanerd/gotty/backend/localcommand" - "github.com/sorenisanerd/gotty/pkg/homedir" - "github.com/sorenisanerd/gotty/server" - "github.com/sorenisanerd/gotty/utils" -) func main() { - app := cli.NewApp() - app.Name = "gotty" - app.Version = Version + "+" + CommitID - app.Usage = "Share your terminal as a web application" - app.HideHelpCommand = true - appOptions := &server.Options{} - - if err := utils.ApplyDefaultValues(appOptions); err != nil { - exit(err, 1) - } - backendOptions := &localcommand.Options{} - if err := utils.ApplyDefaultValues(backendOptions); err != nil { - exit(err, 1) - } - - cliFlags, flagMappings, err := utils.GenerateFlags(appOptions, backendOptions) - if err != nil { - exit(err, 3) - } - - app.Flags = append( - cliFlags, - &cli.StringFlag{ - Name: "config", - Value: "~/.gotty", - Usage: "Config file path", - EnvVars: []string{"GOTTY_CONFIG"}, - }, - ) - - app.Action = func(c *cli.Context) error { - if c.NArg() == 0 { - msg := "Error: No command given." - cli.ShowAppHelp(c) - exit(fmt.Errorf(msg), 1) - } - - configFile := c.String("config") - _, err := os.Stat(homedir.Expand(configFile)) - if configFile != "~/.gotty" || !os.IsNotExist(err) { - if err := utils.ApplyConfigFile(configFile, appOptions, backendOptions); err != nil { - exit(err, 2) - } - } - - utils.ApplyFlags(cliFlags, flagMappings, c, appOptions, backendOptions) - - appOptions.EnableBasicAuth = c.IsSet("credential") - appOptions.EnableTLSClientAuth = c.IsSet("tls-ca-crt") - - err = appOptions.Validate() - if err != nil { - exit(err, 6) - } - - args := c.Args() - factory, err := localcommand.NewFactory(args.First(), args.Tail(), backendOptions) - if err != nil { - exit(err, 3) - } - - hostname, _ := os.Hostname() - appOptions.TitleVariables = map[string]interface{}{ - "command": args.First(), - "argv": args.Tail(), - "hostname": hostname, - } - - srv, err := server.New(factory, appOptions) - if err != nil { - exit(err, 3) - } - - ctx, cancel := context.WithCancel(context.Background()) - gCtx, gCancel := context.WithCancel(context.Background()) - - log.Printf("GoTTY is starting with command: %s", strings.Join(args.Slice(), " ")) - - errs := make(chan error, 1) - go func() { - errs <- srv.Run(ctx, server.WithGracefullContext(gCtx)) - }() - err = waitSignals(errs, cancel, gCancel) - - if err != nil && err != context.Canceled { - fmt.Printf("Error: %s\n", err) - exit(err, 8) - } - - return nil - } - app.Run(os.Args) -} - -func exit(err error, code int) { - if err != nil { - fmt.Println(err) - } - os.Exit(code) -} - -func waitSignals(errs chan error, cancel context.CancelFunc, gracefullCancel context.CancelFunc) error { - sigChan := make(chan os.Signal, 1) - signal.Notify( - sigChan, - syscall.SIGINT, - syscall.SIGTERM, - ) - - select { - case err := <-errs: - return err - - case s := <-sigChan: - switch s { - case syscall.SIGINT: - gracefullCancel() - fmt.Println("C-C to force close") - select { - case err := <-errs: - return err - case <-sigChan: - fmt.Println("Force closing...") - cancel() - return <-errs - } - default: - cancel() - return <-errs - } - } + fmt.Println("Deprecated. Use v1") } diff --git a/pkg/homedir/expand.go b/pkg/homedir/expand.go deleted file mode 100644 index 724a203..0000000 --- a/pkg/homedir/expand.go +++ /dev/null @@ -1,13 +0,0 @@ -package homedir - -import ( - "os" -) - -func Expand(path string) string { - if path[0:2] == "~/" { - return os.Getenv("HOME") + path[1:] - } else { - return path - } -} diff --git a/pkg/randomstring/generate.go b/pkg/randomstring/generate.go deleted file mode 100644 index b5062ce..0000000 --- a/pkg/randomstring/generate.go +++ /dev/null @@ -1,18 +0,0 @@ -package randomstring - -import ( - "crypto/rand" - "math/big" - "strconv" -) - -func Generate(length int) string { - const base = 36 - size := big.NewInt(base) - n := make([]byte, length) - for i, _ := range n { - c, _ := rand.Int(rand.Reader, size) - n[i] = strconv.FormatInt(c.Int64(), base)[0] - } - return string(n) -} diff --git a/resources/favicon.png b/resources/favicon.png deleted file mode 100644 index 3b1eb39..0000000 Binary files a/resources/favicon.png and /dev/null differ diff --git a/resources/icon_192.png b/resources/icon_192.png deleted file mode 100644 index 3a336b7..0000000 Binary files a/resources/icon_192.png and /dev/null differ diff --git a/resources/index.css b/resources/index.css deleted file mode 100644 index 26c6f33..0000000 --- a/resources/index.css +++ /dev/null @@ -1,7 +0,0 @@ -html, body, #terminal { - background: black; - height: 100%; - width: 100%; - padding: 0%; - margin: 0%; -} \ No newline at end of file diff --git a/resources/index.html b/resources/index.html deleted file mode 100644 index be2558e..0000000 --- a/resources/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - {{ .title }} - - - - - - - -
- - - - - diff --git a/resources/manifest.json b/resources/manifest.json deleted file mode 100644 index 8a53b58..0000000 --- a/resources/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "short_name": "{{ .title }}", - "name": "{{ .title }}", - "start_url": "./", - "icons": [ - { - "src": "./icon_192.png", - "type": "image/png", - "sizes": "192x192" - } - ], - "display": "minimal-ui", - "theme_color": "#000000", - "background_color": "#000000" -} diff --git a/resources/xterm_customize.css b/resources/xterm_customize.css deleted file mode 100644 index 8e4ddd9..0000000 --- a/resources/xterm_customize.css +++ /dev/null @@ -1,19 +0,0 @@ -.terminal { - font-family: "DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, "Apple Symbols"; -} - -.xterm-overlay { - font-family: "DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, "Apple Symbols"; - border-radius: 15px; - font-size: xx-large; - color: black; - background: white; - opacity: 0.75; - padding: 0.2em 0.5em 0.2em 0.5em; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - user-select: none; - transition: opacity 180ms ease-in; -} \ No newline at end of file diff --git a/screenshot.gif b/screenshot.gif deleted file mode 100644 index 6d13c83..0000000 Binary files a/screenshot.gif and /dev/null differ diff --git a/server/handler_atomic.go b/server/handler_atomic.go deleted file mode 100644 index 326d1bd..0000000 --- a/server/handler_atomic.go +++ /dev/null @@ -1,70 +0,0 @@ -package server - -import ( - "sync" - "time" -) - -type counter struct { - duration time.Duration - zeroTimer *time.Timer - wg sync.WaitGroup - connections int - mutex sync.Mutex -} - -func newCounter(duration time.Duration) *counter { - zeroTimer := time.NewTimer(duration) - - // when duration is 0, drain the expire event here - // so that user will never get the event. - if duration == 0 { - <-zeroTimer.C - } - - return &counter{ - duration: duration, - zeroTimer: zeroTimer, - } -} - -func (counter *counter) add(n int) int { - counter.mutex.Lock() - defer counter.mutex.Unlock() - - if counter.duration > 0 { - counter.zeroTimer.Stop() - } - counter.wg.Add(n) - counter.connections += n - - return counter.connections -} - -func (counter *counter) done() int { - counter.mutex.Lock() - defer counter.mutex.Unlock() - - counter.connections-- - counter.wg.Done() - if counter.connections == 0 && counter.duration > 0 { - counter.zeroTimer.Reset(counter.duration) - } - - return counter.connections -} - -func (counter *counter) count() int { - counter.mutex.Lock() - defer counter.mutex.Unlock() - - return counter.connections -} - -func (counter *counter) wait() { - counter.wg.Wait() -} - -func (counter *counter) timer() *time.Timer { - return counter.zeroTimer -} diff --git a/server/handlers.go b/server/handlers.go deleted file mode 100644 index d4a0ba3..0000000 --- a/server/handlers.go +++ /dev/null @@ -1,260 +0,0 @@ -package server - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "log" - "net/http" - "net/url" - "sync/atomic" - - "github.com/gorilla/websocket" - "github.com/pkg/errors" - - "github.com/sorenisanerd/gotty/webtty" -) - -func (server *Server) generateHandleWS(ctx context.Context, cancel context.CancelFunc, counter *counter) http.HandlerFunc { - once := new(int64) - - go func() { - select { - case <-counter.timer().C: - cancel() - case <-ctx.Done(): - } - }() - - return func(w http.ResponseWriter, r *http.Request) { - if server.options.Once { - success := atomic.CompareAndSwapInt64(once, 0, 1) - if !success { - http.Error(w, "Server is shutting down", http.StatusServiceUnavailable) - return - } - } - - num := counter.add(1) - closeReason := "unknown reason" - - defer func() { - num := counter.done() - log.Printf( - "Connection closed by %s: %s, connections: %d/%d", - closeReason, r.RemoteAddr, num, server.options.MaxConnection, - ) - - if server.options.Once { - cancel() - } - }() - - if int64(server.options.MaxConnection) != 0 { - if num > server.options.MaxConnection { - closeReason = "exceeding max number of connections" - return - } - } - - log.Printf("New client connected: %s, connections: %d/%d", r.RemoteAddr, num, server.options.MaxConnection) - - if r.Method != "GET" { - http.Error(w, "Method not allowed", 405) - return - } - - conn, err := server.upgrader.Upgrade(w, r, nil) - if err != nil { - closeReason = err.Error() - return - } - defer conn.Close() - - err = server.processWSConn(ctx, conn) - - switch err { - case ctx.Err(): - closeReason = "cancelation" - case webtty.ErrSlaveClosed: - closeReason = server.factory.Name() - case webtty.ErrMasterClosed: - closeReason = "client" - default: - closeReason = fmt.Sprintf("an error: %s", err) - } - } -} - -func (server *Server) processWSConn(ctx context.Context, conn *websocket.Conn) error { - typ, initLine, err := conn.ReadMessage() - if err != nil { - return errors.Wrapf(err, "failed to authenticate websocket connection") - } - if typ != websocket.TextMessage { - return errors.New("failed to authenticate websocket connection: invalid message type") - } - - var init InitMessage - err = json.Unmarshal(initLine, &init) - if err != nil { - return errors.Wrapf(err, "failed to authenticate websocket connection") - } - if init.AuthToken != server.options.Credential { - return errors.New("failed to authenticate websocket connection") - } - - queryPath := "?" - if server.options.PermitArguments && init.Arguments != "" { - queryPath = init.Arguments - } - - query, err := url.Parse(queryPath) - if err != nil { - return errors.Wrapf(err, "failed to parse arguments") - } - params := query.Query() - var slave Slave - slave, err = server.factory.New(params) - if err != nil { - return errors.Wrapf(err, "failed to create backend") - } - defer slave.Close() - - titleVars := server.titleVariables( - []string{"server", "master", "slave"}, - map[string]map[string]interface{}{ - "server": server.options.TitleVariables, - "master": map[string]interface{}{ - "remote_addr": conn.RemoteAddr(), - }, - "slave": slave.WindowTitleVariables(), - }, - ) - - titleBuf := new(bytes.Buffer) - err = server.titleTemplate.Execute(titleBuf, titleVars) - if err != nil { - return errors.Wrapf(err, "failed to fill window title template") - } - - opts := []webtty.Option{ - webtty.WithWindowTitle(titleBuf.Bytes()), - } - if server.options.PermitWrite { - opts = append(opts, webtty.WithPermitWrite()) - } - if server.options.EnableReconnect { - opts = append(opts, webtty.WithReconnect(server.options.ReconnectTime)) - } - if server.options.Width > 0 { - opts = append(opts, webtty.WithFixedColumns(server.options.Width)) - } - if server.options.Height > 0 { - opts = append(opts, webtty.WithFixedRows(server.options.Height)) - } - if server.options.Preferences != nil { - opts = append(opts, webtty.WithMasterPreferences(server.options.Preferences)) - } - - tty, err := webtty.New(&wsWrapper{conn}, slave, opts...) - if err != nil { - return errors.Wrapf(err, "failed to create webtty") - } - - err = tty.Run(ctx) - - return err -} - -func (server *Server) handleIndex(w http.ResponseWriter, r *http.Request) { - indexVars, err := server.indexVariables(r) - if err != nil { - http.Error(w, "Internal Server Error", 500) - return - } - - indexBuf := new(bytes.Buffer) - err = server.indexTemplate.Execute(indexBuf, indexVars) - if err != nil { - http.Error(w, "Internal Server Error", 500) - return - } - - w.Write(indexBuf.Bytes()) -} - -func (server *Server) handleManifest(w http.ResponseWriter, r *http.Request) { - indexVars, err := server.indexVariables(r) - if err != nil { - http.Error(w, "Internal Server Error", 500) - return - } - - indexBuf := new(bytes.Buffer) - err = server.manifestTemplate.Execute(indexBuf, indexVars) - if err != nil { - http.Error(w, "Internal Server Error", 500) - return - } - - w.Write(indexBuf.Bytes()) -} - -func (server *Server) indexVariables(r *http.Request) (map[string]interface{}, error) { - titleVars := server.titleVariables( - []string{"server", "master"}, - map[string]map[string]interface{}{ - "server": server.options.TitleVariables, - "master": map[string]interface{}{ - "remote_addr": r.RemoteAddr, - }, - }, - ) - - titleBuf := new(bytes.Buffer) - err := server.titleTemplate.Execute(titleBuf, titleVars) - if err != nil { - return nil, err - } - - indexVars := map[string]interface{}{ - "title": titleBuf.String(), - } - return indexVars, err -} - -func (server *Server) handleAuthToken(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/javascript") - // @TODO hashing? - w.Write([]byte("var gotty_auth_token = '" + server.options.Credential + "';")) -} - -func (server *Server) handleConfig(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/javascript") - w.Write([]byte("var gotty_term = '" + server.options.Term + "';")) -} - -// titleVariables merges maps in a specified order. -// varUnits are name-keyed maps, whose names will be iterated using order. -func (server *Server) titleVariables(order []string, varUnits map[string]map[string]interface{}) map[string]interface{} { - titleVars := map[string]interface{}{} - - for _, name := range order { - vars, ok := varUnits[name] - if !ok { - panic("title variable name error") - } - for key, val := range vars { - titleVars[key] = val - } - } - - // safe net for conflicted keys - for _, name := range order { - titleVars[name] = varUnits[name] - } - - return titleVars -} diff --git a/server/init_message.go b/server/init_message.go deleted file mode 100644 index 60801bf..0000000 --- a/server/init_message.go +++ /dev/null @@ -1,6 +0,0 @@ -package server - -type InitMessage struct { - Arguments string `json:"Arguments,omitempty"` - AuthToken string `json:"AuthToken,omitempty"` -} diff --git a/server/list_address.go b/server/list_address.go deleted file mode 100644 index de2e8b2..0000000 --- a/server/list_address.go +++ /dev/null @@ -1,28 +0,0 @@ -package server - -import ( - "net" -) - -func listAddresses() (addresses []string) { - ifaces, err := net.Interfaces() - if err != nil { - return []string{} - } - - addresses = make([]string, 0, len(ifaces)) - - for _, iface := range ifaces { - ifAddrs, _ := iface.Addrs() - for _, ifAddr := range ifAddrs { - switch v := ifAddr.(type) { - case *net.IPNet: - addresses = append(addresses, v.IP.String()) - case *net.IPAddr: - addresses = append(addresses, v.IP.String()) - } - } - } - - return addresses -} diff --git a/server/log_response_writer.go b/server/log_response_writer.go deleted file mode 100644 index 1b75fd8..0000000 --- a/server/log_response_writer.go +++ /dev/null @@ -1,23 +0,0 @@ -package server - -import ( - "bufio" - "net" - "net/http" -) - -type logResponseWriter struct { - http.ResponseWriter - status int -} - -func (w *logResponseWriter) WriteHeader(status int) { - w.status = status - w.ResponseWriter.WriteHeader(status) -} - -func (w *logResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) { - hj, _ := w.ResponseWriter.(http.Hijacker) - w.status = http.StatusSwitchingProtocols - return hj.Hijack() -} diff --git a/server/middleware.go b/server/middleware.go deleted file mode 100644 index ee89176..0000000 --- a/server/middleware.go +++ /dev/null @@ -1,51 +0,0 @@ -package server - -import ( - "encoding/base64" - "log" - "net/http" - "strings" -) - -func (server *Server) wrapLogger(handler http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - rw := &logResponseWriter{w, 200} - handler.ServeHTTP(rw, r) - log.Printf("%s %d %s %s", r.RemoteAddr, rw.status, r.Method, r.URL.Path) - }) -} - -func (server *Server) wrapHeaders(handler http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // todo add version - w.Header().Set("Server", "GoTTY") - handler.ServeHTTP(w, r) - }) -} - -func (server *Server) wrapBasicAuth(handler http.Handler, credential string) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - token := strings.SplitN(r.Header.Get("Authorization"), " ", 2) - - if len(token) != 2 || strings.ToLower(token[0]) != "basic" { - w.Header().Set("WWW-Authenticate", `Basic realm="GoTTY"`) - http.Error(w, "Bad Request", http.StatusUnauthorized) - return - } - - payload, err := base64.StdEncoding.DecodeString(token[1]) - if err != nil { - http.Error(w, "Internal Server Error", http.StatusInternalServerError) - return - } - - if credential != string(payload) { - w.Header().Set("WWW-Authenticate", `Basic realm="GoTTY"`) - http.Error(w, "authorization failed", http.StatusUnauthorized) - return - } - - log.Printf("Basic Authentication Succeeded: %s", r.RemoteAddr) - handler.ServeHTTP(w, r) - }) -} diff --git a/server/options.go b/server/options.go deleted file mode 100644 index 4c371cc..0000000 --- a/server/options.go +++ /dev/null @@ -1,99 +0,0 @@ -package server - -import ( - "github.com/pkg/errors" -) - -type Options struct { - Address string `hcl:"address" flagName:"address" flagSName:"a" flagDescribe:"IP address to listen" default:"0.0.0.0"` - Port string `hcl:"port" flagName:"port" flagSName:"p" flagDescribe:"Port number to liten" default:"8080"` - PermitWrite bool `hcl:"permit_write" flagName:"permit-write" flagSName:"w" flagDescribe:"Permit clients to write to the TTY (BE CAREFUL)" default:"false"` - EnableBasicAuth bool `hcl:"enable_basic_auth" default:"false"` - Credential string `hcl:"credential" flagName:"credential" flagSName:"c" flagDescribe:"Credential for Basic Authentication (ex: user:pass, default disabled)" default:""` - EnableRandomUrl bool `hcl:"enable_random_url" flagName:"random-url" flagSName:"r" flagDescribe:"Add a random string to the URL" default:"false"` - RandomUrlLength int `hcl:"random_url_length" flagName:"random-url-length" flagDescribe:"Random URL length" default:"8"` - EnableTLS bool `hcl:"enable_tls" flagName:"tls" flagSName:"t" flagDescribe:"Enable TLS/SSL" default:"false"` - TLSCrtFile string `hcl:"tls_crt_file" flagName:"tls-crt" flagDescribe:"TLS/SSL certificate file path" default:"~/.gotty.crt"` - TLSKeyFile string `hcl:"tls_key_file" flagName:"tls-key" flagDescribe:"TLS/SSL key file path" default:"~/.gotty.key"` - EnableTLSClientAuth bool `hcl:"enable_tls_client_auth" default:"false"` - TLSCACrtFile string `hcl:"tls_ca_crt_file" flagName:"tls-ca-crt" flagDescribe:"TLS/SSL CA certificate file for client certifications" default:"~/.gotty.ca.crt"` - IndexFile string `hcl:"index_file" flagName:"index" flagDescribe:"Custom index.html file" default:""` - TitleFormat string `hcl:"title_format" flagName:"title-format" flagSName:"" flagDescribe:"Title format of browser window" default:"{{ .command }}@{{ .hostname }}"` - EnableReconnect bool `hcl:"enable_reconnect" flagName:"reconnect" flagDescribe:"Enable reconnection" default:"false"` - ReconnectTime int `hcl:"reconnect_time" flagName:"reconnect-time" flagDescribe:"Time to reconnect" default:"10"` - MaxConnection int `hcl:"max_connection" flagName:"max-connection" flagDescribe:"Maximum connection to gotty" default:"0"` - Once bool `hcl:"once" flagName:"once" flagDescribe:"Accept only one client and exit on disconnection" default:"false"` - Timeout int `hcl:"timeout" flagName:"timeout" flagDescribe:"Timeout seconds for waiting a client(0 to disable)" default:"0"` - PermitArguments bool `hcl:"permit_arguments" flagName:"permit-arguments" flagDescribe:"Permit clients to send command line arguments in URL (e.g. http://example.com:8080/?arg=AAA&arg=BBB)" default:"true"` - Preferences *HtermPrefernces `hcl:"preferences"` - Width int `hcl:"width" flagName:"width" flagDescribe:"Static width of the screen, 0(default) means dynamically resize" default:"0"` - Height int `hcl:"height" flagName:"height" flagDescribe:"Static height of the screen, 0(default) means dynamically resize" default:"0"` - WSOrigin string `hcl:"ws_origin" flagName:"ws-origin" flagDescribe:"A regular expression that matches origin URLs to be accepted by WebSocket. No cross origin requests are acceptable by default" default:""` - Term string `hcl:"term" flagName:"term" flagDescribe:"Terminal name to use on the browser, one of xterm or hterm." default:"hterm"` - - TitleVariables map[string]interface{} -} - -func (options *Options) Validate() error { - if options.EnableTLSClientAuth && !options.EnableTLS { - return errors.New("TLS client authentication is enabled, but TLS is not enabled") - } - return nil -} - -type HtermPrefernces struct { - AltGrMode *string `hcl:"alt_gr_mode" json:"alt-gr-mode,omitempty"` - AltBackspaceIsMetaBackspace bool `hcl:"alt_backspace_is_meta_backspace" json:"alt-backspace-is-meta-backspace,omitempty"` - AltIsMeta bool `hcl:"alt_is_meta" json:"alt-is-meta,omitempty"` - AltSendsWhat string `hcl:"alt_sends_what" json:"alt-sends-what,omitempty"` - AudibleBellSound string `hcl:"audible_bell_sound" json:"audible-bell-sound,omitempty"` - DesktopNotificationBell bool `hcl:"desktop_notification_bell" json:"desktop-notification-bell,omitempty"` - BackgroundColor string `hcl:"background_color" json:"background-color,omitempty"` - BackgroundImage string `hcl:"background_image" json:"background-image,omitempty"` - BackgroundSize string `hcl:"background_size" json:"background-size,omitempty"` - BackgroundPosition string `hcl:"background_position" json:"background-position,omitempty"` - BackspaceSendsBackspace bool `hcl:"backspace_sends_backspace" json:"backspace-sends-backspace,omitempty"` - CharacterMapOverrides map[string]map[string]string `hcl:"character_map_overrides" json:"character-map-overrides,omitempty"` - CloseOnExit bool `hcl:"close_on_exit" json:"close-on-exit,omitempty"` - CursorBlink bool `hcl:"cursor_blink" json:"cursor-blink,omitempty"` - CursorBlinkCycle [2]int `hcl:"cursor_blink_cycle" json:"cursor-blink-cycle,omitempty"` - CursorColor string `hcl:"cursor_color" json:"cursor-color,omitempty"` - ColorPaletteOverrides []*string `hcl:"color_palette_overrides" json:"color-palette-overrides,omitempty"` - CopyOnSelect bool `hcl:"copy_on_select" json:"copy-on-select,omitempty"` - UseDefaultWindowCopy bool `hcl:"use_default_window_copy" json:"use-default-window-copy,omitempty"` - ClearSelectionAfterCopy bool `hcl:"clear_selection_after_copy" json:"clear-selection-after-copy,omitempty"` - CtrlPlusMinusZeroZoom bool `hcl:"ctrl_plus_minus_zero_zoom" json:"ctrl-plus-minus-zero-zoom,omitempty"` - CtrlCCopy bool `hcl:"ctrl_c_copy" json:"ctrl-c-copy,omitempty"` - CtrlVPaste bool `hcl:"ctrl_v_paste" json:"ctrl-v-paste,omitempty"` - EastAsianAmbiguousAsTwoColumn bool `hcl:"east_asian_ambiguous_as_two_column" json:"east-asian-ambiguous-as-two-column,omitempty"` - Enable8BitControl *bool `hcl:"enable_8_bit_control" json:"enable-8-bit-control,omitempty"` - EnableBold *bool `hcl:"enable_bold" json:"enable-bold,omitempty"` - EnableBoldAsBright bool `hcl:"enable_bold_as_bright" json:"enable-bold-as-bright,omitempty"` - EnableClipboardNotice bool `hcl:"enable_clipboard_notice" json:"enable-clipboard-notice,omitempty"` - EnableClipboardWrite bool `hcl:"enable_clipboard_write" json:"enable-clipboard-write,omitempty"` - EnableDec12 bool `hcl:"enable_dec12" json:"enable-dec12,omitempty"` - Environment map[string]string `hcl:"environment" json:"environment,omitempty"` - FontFamily string `hcl:"font_family" json:"font-family,omitempty"` - FontSize int `hcl:"font_size" json:"font-size,omitempty"` - FontSmoothing string `hcl:"font_smoothing" json:"font-smoothing,omitempty"` - ForegroundColor string `hcl:"foreground_color" json:"foreground-color,omitempty"` - HomeKeysScroll bool `hcl:"home_keys_scroll" json:"home-keys-scroll,omitempty"` - Keybindings map[string]string `hcl:"keybindings" json:"keybindings,omitempty"` - MaxStringSequence int `hcl:"max_string_sequence" json:"max-string-sequence,omitempty"` - MediaKeysAreFkeys bool `hcl:"media_keys_are_fkeys" json:"media-keys-are-fkeys,omitempty"` - MetaSendsEscape bool `hcl:"meta_sends_escape" json:"meta-sends-escape,omitempty"` - MousePasteButton *int `hcl:"mouse_paste_button" json:"mouse-paste-button,omitempty"` - PageKeysScroll bool `hcl:"page_keys_scroll" json:"page-keys-scroll,omitempty"` - PassAltNumber *bool `hcl:"pass_alt_number" json:"pass-alt-number,omitempty"` - PassCtrlNumber *bool `hcl:"pass_ctrl_number" json:"pass-ctrl-number,omitempty"` - PassMetaNumber *bool `hcl:"pass_meta_number" json:"pass-meta-number,omitempty"` - PassMetaV bool `hcl:"pass_meta_v" json:"pass-meta-v,omitempty"` - ReceiveEncoding string `hcl:"receive_encoding" json:"receive-encoding,omitempty"` - ScrollOnKeystroke bool `hcl:"scroll_on_keystroke" json:"scroll-on-keystroke,omitempty"` - ScrollOnOutput bool `hcl:"scroll_on_output" json:"scroll-on-output,omitempty"` - ScrollbarVisible bool `hcl:"scrollbar_visible" json:"scrollbar-visible,omitempty"` - ScrollWheelMoveMultiplier int `hcl:"scroll_wheel_move_multiplier" json:"scroll-wheel-move-multiplier,omitempty"` - SendEncoding string `hcl:"send_encoding" json:"send-encoding,omitempty"` - ShiftInsertPaste bool `hcl:"shift_insert_paste" json:"shift-insert-paste,omitempty"` - UserCss string `hcl:"user_css" json:"user-css,omitempty"` -} diff --git a/server/run_option.go b/server/run_option.go deleted file mode 100644 index 2939d63..0000000 --- a/server/run_option.go +++ /dev/null @@ -1,21 +0,0 @@ -package server - -import ( - "context" -) - -// RunOptions holds a set of configurations for Server.Run(). -type RunOptions struct { - gracefullCtx context.Context -} - -// RunOption is an option of Server.Run(). -type RunOption func(*RunOptions) - -// WithGracefullContext accepts a context to shutdown a Server -// with care for existing client connections. -func WithGracefullContext(ctx context.Context) RunOption { - return func(options *RunOptions) { - options.gracefullCtx = ctx - } -} diff --git a/server/server.go b/server/server.go deleted file mode 100644 index b4253cf..0000000 --- a/server/server.go +++ /dev/null @@ -1,259 +0,0 @@ -package server - -import ( - "context" - "crypto/tls" - "crypto/x509" - "html/template" - "io/ioutil" - "log" - "net" - "net/http" - "regexp" - noesctmpl "text/template" - "time" - - "github.com/NYTimes/gziphandler" - assetfs "github.com/elazarl/go-bindata-assetfs" - "github.com/gorilla/websocket" - "github.com/pkg/errors" - - "github.com/sorenisanerd/gotty/pkg/homedir" - "github.com/sorenisanerd/gotty/pkg/randomstring" - "github.com/sorenisanerd/gotty/webtty" -) - -// Server provides a webtty HTTP endpoint. -type Server struct { - factory Factory - options *Options - - upgrader *websocket.Upgrader - indexTemplate *template.Template - titleTemplate *noesctmpl.Template - manifestTemplate *template.Template -} - -// New creates a new instance of Server. -// Server will use the New() of the factory provided to handle each request. -func New(factory Factory, options *Options) (*Server, error) { - indexData, err := Asset("static/index.html") - if err != nil { - panic("index not found") // must be in bindata - } - if options.IndexFile != "" { - path := homedir.Expand(options.IndexFile) - indexData, err = ioutil.ReadFile(path) - if err != nil { - return nil, errors.Wrapf(err, "failed to read custom index file at `%s`", path) - } - } - indexTemplate, err := template.New("index").Parse(string(indexData)) - if err != nil { - panic("index template parse failed") // must be valid - } - - manifestData, err := Asset("static/manifest.json") - if err != nil { - panic("manifest not found") // must be in bindata - } - manifestTemplate, err := template.New("manifest").Parse(string(manifestData)) - if err != nil { - panic("manifest template parse failed") // must be valid - } - - titleTemplate, err := noesctmpl.New("title").Parse(options.TitleFormat) - if err != nil { - return nil, errors.Wrapf(err, "failed to parse window title format `%s`", options.TitleFormat) - } - - var originChekcer func(r *http.Request) bool - if options.WSOrigin != "" { - matcher, err := regexp.Compile(options.WSOrigin) - if err != nil { - return nil, errors.Wrapf(err, "failed to compile regular expression of Websocket Origin: %s", options.WSOrigin) - } - originChekcer = func(r *http.Request) bool { - return matcher.MatchString(r.Header.Get("Origin")) - } - } - - return &Server{ - factory: factory, - options: options, - - upgrader: &websocket.Upgrader{ - ReadBufferSize: 1024, - WriteBufferSize: 1024, - Subprotocols: webtty.Protocols, - CheckOrigin: originChekcer, - }, - indexTemplate: indexTemplate, - titleTemplate: titleTemplate, - manifestTemplate: manifestTemplate, - }, nil -} - -// Run starts the main process of the Server. -// The cancelation of ctx will shutdown the server immediately with aborting -// existing connections. Use WithGracefullContext() to support gracefull shutdown. -func (server *Server) Run(ctx context.Context, options ...RunOption) error { - cctx, cancel := context.WithCancel(ctx) - opts := &RunOptions{gracefullCtx: context.Background()} - for _, opt := range options { - opt(opts) - } - - counter := newCounter(time.Duration(server.options.Timeout) * time.Second) - - path := "/" - if server.options.EnableRandomUrl { - path = "/" + randomstring.Generate(server.options.RandomUrlLength) + "/" - } - - handlers := server.setupHandlers(cctx, cancel, path, counter) - srv, err := server.setupHTTPServer(handlers) - if err != nil { - return errors.Wrapf(err, "failed to setup an HTTP server") - } - - if server.options.PermitWrite { - log.Printf("Permitting clients to write input to the PTY.") - } - if server.options.Once { - log.Printf("Once option is provided, accepting only one client") - } - - if server.options.Port == "0" { - log.Printf("Port number configured to `0`, choosing a random port") - } - hostPort := net.JoinHostPort(server.options.Address, server.options.Port) - listener, err := net.Listen("tcp", hostPort) - if err != nil { - return errors.Wrapf(err, "failed to listen at `%s`", hostPort) - } - - scheme := "http" - if server.options.EnableTLS { - scheme = "https" - } - host, port, _ := net.SplitHostPort(listener.Addr().String()) - log.Printf("HTTP server is listening at: %s", scheme+"://"+net.JoinHostPort(host, port)+path) - if server.options.Address == "0.0.0.0" { - for _, address := range listAddresses() { - log.Printf("Alternative URL: %s", scheme+"://"+net.JoinHostPort(address, port)+path) - } - } - - srvErr := make(chan error, 1) - go func() { - if server.options.EnableTLS { - crtFile := homedir.Expand(server.options.TLSCrtFile) - keyFile := homedir.Expand(server.options.TLSKeyFile) - log.Printf("TLS crt file: " + crtFile) - log.Printf("TLS key file: " + keyFile) - - err = srv.ServeTLS(listener, crtFile, keyFile) - } else { - err = srv.Serve(listener) - } - if err != nil { - srvErr <- err - } - }() - - go func() { - select { - case <-opts.gracefullCtx.Done(): - srv.Shutdown(context.Background()) - case <-cctx.Done(): - } - }() - - select { - case err = <-srvErr: - if err == http.ErrServerClosed { // by gracefull ctx - err = nil - } else { - cancel() - } - case <-cctx.Done(): - srv.Close() - err = cctx.Err() - } - - conn := counter.count() - if conn > 0 { - log.Printf("Waiting for %d connections to be closed", conn) - } - counter.wait() - - return err -} - -func (server *Server) setupHandlers(ctx context.Context, cancel context.CancelFunc, pathPrefix string, counter *counter) http.Handler { - staticFileHandler := http.FileServer( - &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "static"}, - ) - - var siteMux = http.NewServeMux() - siteMux.HandleFunc(pathPrefix, server.handleIndex) - siteMux.Handle(pathPrefix+"js/", http.StripPrefix(pathPrefix, staticFileHandler)) - siteMux.Handle(pathPrefix+"favicon.png", http.StripPrefix(pathPrefix, staticFileHandler)) - siteMux.Handle(pathPrefix+"css/", http.StripPrefix(pathPrefix, staticFileHandler)) - siteMux.Handle(pathPrefix+"icon_192.png", http.StripPrefix(pathPrefix, staticFileHandler)) - - siteMux.HandleFunc(pathPrefix+"manifest.json", server.handleManifest) - siteMux.HandleFunc(pathPrefix+"auth_token.js", server.handleAuthToken) - siteMux.HandleFunc(pathPrefix+"config.js", server.handleConfig) - - siteHandler := http.Handler(siteMux) - - if server.options.EnableBasicAuth { - log.Printf("Using Basic Authentication") - siteHandler = server.wrapBasicAuth(siteHandler, server.options.Credential) - } - - withGz := gziphandler.GzipHandler(server.wrapHeaders(siteHandler)) - siteHandler = server.wrapLogger(withGz) - - wsMux := http.NewServeMux() - wsMux.Handle("/", siteHandler) - wsMux.HandleFunc(pathPrefix+"ws", server.generateHandleWS(ctx, cancel, counter)) - siteHandler = http.Handler(wsMux) - - return siteHandler -} - -func (server *Server) setupHTTPServer(handler http.Handler) (*http.Server, error) { - srv := &http.Server{ - Handler: handler, - } - - if server.options.EnableTLSClientAuth { - tlsConfig, err := server.tlsConfig() - if err != nil { - return nil, errors.Wrapf(err, "failed to setup TLS configuration") - } - srv.TLSConfig = tlsConfig - } - - return srv, nil -} - -func (server *Server) tlsConfig() (*tls.Config, error) { - caFile := homedir.Expand(server.options.TLSCACrtFile) - caCert, err := ioutil.ReadFile(caFile) - if err != nil { - return nil, errors.New("could not open CA crt file " + caFile) - } - caCertPool := x509.NewCertPool() - if !caCertPool.AppendCertsFromPEM(caCert) { - return nil, errors.New("could not parse CA crt file data in " + caFile) - } - tlsConfig := &tls.Config{ - ClientCAs: caCertPool, - ClientAuth: tls.RequireAndVerifyClientCert, - } - return tlsConfig, nil -} diff --git a/server/slave.go b/server/slave.go deleted file mode 100644 index 52cd9fe..0000000 --- a/server/slave.go +++ /dev/null @@ -1,17 +0,0 @@ -package server - -import ( - "github.com/sorenisanerd/gotty/webtty" -) - -// Slave is webtty.Slave with some additional methods. -type Slave interface { - webtty.Slave - - Close() error -} - -type Factory interface { - Name() string - New(params map[string][]string) (Slave, error) -} diff --git a/server/ws_wrapper.go b/server/ws_wrapper.go deleted file mode 100644 index 819c393..0000000 --- a/server/ws_wrapper.go +++ /dev/null @@ -1,33 +0,0 @@ -package server - -import ( - "github.com/gorilla/websocket" -) - -type wsWrapper struct { - *websocket.Conn -} - -func (wsw *wsWrapper) Write(p []byte) (n int, err error) { - writer, err := wsw.Conn.NextWriter(websocket.TextMessage) - if err != nil { - return 0, err - } - defer writer.Close() - return writer.Write(p) -} - -func (wsw *wsWrapper) Read(p []byte) (n int, err error) { - for { - msgType, reader, err := wsw.Conn.NextReader() - if err != nil { - return 0, err - } - - if msgType != websocket.TextMessage { - continue - } - - return reader.Read(p) - } -} diff --git a/utils/default.go b/utils/default.go deleted file mode 100644 index e813b3b..0000000 --- a/utils/default.go +++ /dev/null @@ -1,41 +0,0 @@ -package utils - -import ( - "fmt" - "github.com/fatih/structs" - "reflect" - "strconv" -) - -func ApplyDefaultValues(struct_ interface{}) (err error) { - o := structs.New(struct_) - - for _, field := range o.Fields() { - defaultValue := field.Tag("default") - if defaultValue == "" { - continue - } - var val interface{} - switch field.Kind() { - case reflect.String: - val = defaultValue - case reflect.Bool: - if defaultValue == "true" { - val = true - } else if defaultValue == "false" { - val = false - } else { - return fmt.Errorf("invalid bool expression: %v, use true/false", defaultValue) - } - case reflect.Int: - val, err = strconv.Atoi(defaultValue) - if err != nil { - return err - } - default: - val = field.Value() - } - field.Set(val) - } - return nil -} diff --git a/utils/flags.go b/utils/flags.go deleted file mode 100644 index dc24783..0000000 --- a/utils/flags.go +++ /dev/null @@ -1,128 +0,0 @@ -package utils - -import ( - "io/ioutil" - "log" - "os" - "reflect" - "strings" - - "github.com/fatih/structs" - "github.com/urfave/cli/v2" - "github.com/yudai/hcl" - - "github.com/sorenisanerd/gotty/pkg/homedir" -) - -func GenerateFlags(options ...interface{}) (flags []cli.Flag, mappings map[string]string, err error) { - mappings = make(map[string]string) - - for _, struct_ := range options { - o := structs.New(struct_) - for _, field := range o.Fields() { - flagName := field.Tag("flagName") - if flagName == "" { - continue - } - envName := "GOTTY_" + strings.ToUpper(strings.Join(strings.Split(flagName, "-"), "_")) - mappings[flagName] = field.Name() - - flagShortName := field.Tag("flagSName") - var aliases []string - if flagShortName != "" { - aliases = []string{flagShortName} - } - - flagDescription := field.Tag("flagDescribe") - - switch field.Kind() { - case reflect.String: - flags = append(flags, &cli.StringFlag{ - Name: flagName, - Value: field.Value().(string), - Usage: flagDescription, - EnvVars: []string{envName}, - Aliases: aliases, - }) - case reflect.Bool: - flags = append(flags, &cli.BoolFlag{ - Name: flagName, - Usage: flagDescription, - EnvVars: []string{envName}, - Aliases: aliases, - }) - case reflect.Int: - flags = append(flags, &cli.IntFlag{ - Name: flagName, - Value: field.Value().(int), - Usage: flagDescription, - EnvVars: []string{envName}, - Aliases: aliases, - }) - } - } - } - - return -} - -func ApplyFlags( - flags []cli.Flag, - mappingHint map[string]string, - c *cli.Context, - options ...interface{}, -) { - objects := make([]*structs.Struct, len(options)) - for i, struct_ := range options { - objects[i] = structs.New(struct_) - } - - for flagName, fieldName := range mappingHint { - if !c.IsSet(flagName) { - continue - } - var field *structs.Field - var ok bool - for _, o := range objects { - field, ok = o.FieldOk(fieldName) - if ok { - break - } - } - if field == nil { - continue - } - var val interface{} - switch field.Kind() { - case reflect.String: - val = c.String(flagName) - case reflect.Bool: - val = c.Bool(flagName) - case reflect.Int: - val = c.Int(flagName) - } - field.Set(val) - } -} - -func ApplyConfigFile(filePath string, options ...interface{}) error { - filePath = homedir.Expand(filePath) - if _, err := os.Stat(filePath); os.IsNotExist(err) { - return err - } - - fileString := []byte{} - log.Printf("Loading config file at: %s", filePath) - fileString, err := ioutil.ReadFile(filePath) - if err != nil { - return err - } - - for _, object := range options { - if err := hcl.Decode(object, string(fileString)); err != nil { - return err - } - } - - return nil -} diff --git a/version.go b/version.go deleted file mode 100644 index ab7b913..0000000 --- a/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package main - -var Version = "unknown_version" -var CommitID = "unknown_commit" diff --git a/webtty/doc.go b/webtty/doc.go deleted file mode 100644 index b7d76b9..0000000 --- a/webtty/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package webtty provides a protocl and an implementation to -// controll terminals thorough networks. -package webtty diff --git a/webtty/errors.go b/webtty/errors.go deleted file mode 100644 index 0ea6473..0000000 --- a/webtty/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package webtty - -import ( - "errors" -) - -var ( - // ErrSlaveClosed indicates the function has exited by the slave - ErrSlaveClosed = errors.New("slave closed") - - // ErrSlaveClosed is returned when the slave connection is closed. - ErrMasterClosed = errors.New("master closed") -) diff --git a/webtty/master.go b/webtty/master.go deleted file mode 100644 index 7f30f47..0000000 --- a/webtty/master.go +++ /dev/null @@ -1,8 +0,0 @@ -package webtty - -import ( - "io" -) - -// Master represents a PTY master, usually it's a websocket connection. -type Master io.ReadWriter diff --git a/webtty/message_types.go b/webtty/message_types.go deleted file mode 100644 index 9cbc8e8..0000000 --- a/webtty/message_types.go +++ /dev/null @@ -1,33 +0,0 @@ -package webtty - -// Protocols defines the name of this protocol, -// which is supposed to be used to the subprotocol of Websockt streams. -var Protocols = []string{"webtty"} - -const ( - // Unknown message type, maybe sent by a bug - UnknownInput = '0' - // User input typically from a keyboard - Input = '1' - // Ping to the server - Ping = '2' - // Notify that the browser size has been changed - ResizeTerminal = '3' -) - -const ( - // Unknown message type, maybe set by a bug - UnknownOutput = '0' - // Normal output to the terminal - Output = '1' - // Pong to the browser - Pong = '2' - // Set window title of the terminal - SetWindowTitle = '3' - // Set terminal preference - SetPreferences = '4' - // Make terminal to reconnect - SetReconnect = '5' - // Set the input buffer size - SetBufferSize = '6' -) diff --git a/webtty/option.go b/webtty/option.go deleted file mode 100644 index 1618e89..0000000 --- a/webtty/option.go +++ /dev/null @@ -1,62 +0,0 @@ -package webtty - -import ( - "encoding/json" - - "github.com/pkg/errors" -) - -// Option is an option for WebTTY. -type Option func(*WebTTY) error - -// WithPermitWrite sets a WebTTY to accept input from slaves. -func WithPermitWrite() Option { - return func(wt *WebTTY) error { - wt.permitWrite = true - return nil - } -} - -// WithFixedColumns sets a fixed width to TTY master. -func WithFixedColumns(columns int) Option { - return func(wt *WebTTY) error { - wt.columns = columns - return nil - } -} - -// WithFixedRows sets a fixed height to TTY master. -func WithFixedRows(rows int) Option { - return func(wt *WebTTY) error { - wt.rows = rows - return nil - } -} - -// WithWindowTitle sets the default window title of the session -func WithWindowTitle(windowTitle []byte) Option { - return func(wt *WebTTY) error { - wt.windowTitle = windowTitle - return nil - } -} - -// WithReconnect enables reconnection on the master side. -func WithReconnect(timeInSeconds int) Option { - return func(wt *WebTTY) error { - wt.reconnect = timeInSeconds - return nil - } -} - -// WithMasterPreferences sets an optional configuration of master. -func WithMasterPreferences(preferences interface{}) Option { - return func(wt *WebTTY) error { - prefs, err := json.Marshal(preferences) - if err != nil { - return errors.Wrapf(err, "failed to marshal preferences as JSON") - } - wt.masterPrefs = prefs - return nil - } -} diff --git a/webtty/slave.go b/webtty/slave.go deleted file mode 100644 index b9893ba..0000000 --- a/webtty/slave.go +++ /dev/null @@ -1,17 +0,0 @@ -package webtty - -import ( - "io" -) - -// Slave represents a PTY slave, typically it's a local command. -type Slave interface { - io.ReadWriter - - // WindowTitleVariables returns any values that can be used to fill out - // the title of a terminal. - WindowTitleVariables() map[string]interface{} - - // ResizeTerminal sets a new size of the terminal. - ResizeTerminal(columns int, rows int) error -} diff --git a/webtty/webtty.go b/webtty/webtty.go deleted file mode 100644 index 0ce5fea..0000000 --- a/webtty/webtty.go +++ /dev/null @@ -1,225 +0,0 @@ -package webtty - -import ( - "context" - "encoding/base64" - "encoding/json" - "sync" - - "github.com/pkg/errors" -) - -// WebTTY bridges a PTY slave and its PTY master. -// To support text-based streams and side channel commands such as -// terminal resizing, WebTTY uses an original protocol. -type WebTTY struct { - // PTY Master, which probably a connection to browser - masterConn Master - // PTY Slave - slave Slave - - windowTitle []byte - permitWrite bool - columns int - rows int - reconnect int // in seconds - masterPrefs []byte - - bufferSize int - writeMutex sync.Mutex -} - -// New creates a new instance of WebTTY. -// masterConn is a connection to the PTY master, -// typically it's a websocket connection to a client. -// slave is a PTY slave such as a local command with a PTY. -func New(masterConn Master, slave Slave, options ...Option) (*WebTTY, error) { - wt := &WebTTY{ - masterConn: masterConn, - slave: slave, - - permitWrite: false, - columns: 0, - rows: 0, - - bufferSize: 1024, - } - - for _, option := range options { - option(wt) - } - - return wt, nil -} - -// Run starts the main process of the WebTTY. -// This method blocks until the context is canceled. -// Note that the master and slave are left intact even -// after the context is canceled. Closing them is caller's -// responsibility. -// If the connection to one end gets closed, returns ErrSlaveClosed or ErrMasterClosed. -func (wt *WebTTY) Run(ctx context.Context) error { - err := wt.sendInitializeMessage() - if err != nil { - return errors.Wrapf(err, "failed to send initializing message") - } - - errs := make(chan error, 2) - - go func() { - errs <- func() error { - buffer := make([]byte, wt.bufferSize) - for { - n, err := wt.slave.Read(buffer) - if err != nil { - return ErrSlaveClosed - } - - err = wt.handleSlaveReadEvent(buffer[:n]) - if err != nil { - return err - } - } - }() - }() - - go func() { - errs <- func() error { - buffer := make([]byte, wt.bufferSize) - for { - n, err := wt.masterConn.Read(buffer) - if err != nil { - return ErrMasterClosed - } - - err = wt.handleMasterReadEvent(buffer[:n]) - if err != nil { - return err - } - } - }() - }() - - select { - case <-ctx.Done(): - err = ctx.Err() - case err = <-errs: - } - - return err -} - -func (wt *WebTTY) sendInitializeMessage() error { - err := wt.masterWrite(append([]byte{SetWindowTitle}, wt.windowTitle...)) - if err != nil { - return errors.Wrapf(err, "failed to send window title") - } - - bufSizeMsg, _ := json.Marshal(wt.bufferSize) - err = wt.masterWrite(append([]byte{SetBufferSize}, bufSizeMsg...)) - if err != nil { - return errors.Wrapf(err, "failed to send buffer size") - } - - if wt.reconnect > 0 { - reconnect, _ := json.Marshal(wt.reconnect) - err := wt.masterWrite(append([]byte{SetReconnect}, reconnect...)) - if err != nil { - return errors.Wrapf(err, "failed to set reconnect") - } - } - - if wt.masterPrefs != nil { - err := wt.masterWrite(append([]byte{SetPreferences}, wt.masterPrefs...)) - if err != nil { - return errors.Wrapf(err, "failed to set preferences") - } - } - - return nil -} - -func (wt *WebTTY) handleSlaveReadEvent(data []byte) error { - safeMessage := base64.StdEncoding.EncodeToString(data) - err := wt.masterWrite(append([]byte{Output}, []byte(safeMessage)...)) - if err != nil { - return errors.Wrapf(err, "failed to send message to master") - } - - return nil -} - -func (wt *WebTTY) masterWrite(data []byte) error { - wt.writeMutex.Lock() - defer wt.writeMutex.Unlock() - - _, err := wt.masterConn.Write(data) - if err != nil { - return errors.Wrapf(err, "failed to write to master") - } - - return nil -} - -func (wt *WebTTY) handleMasterReadEvent(data []byte) error { - if len(data) == 0 { - return errors.New("unexpected zero length read from master") - } - - switch data[0] { - case Input: - if !wt.permitWrite { - return nil - } - - if len(data) <= 1 { - return nil - } - - _, err := wt.slave.Write(data[1:]) - if err != nil { - return errors.Wrapf(err, "failed to write received data to slave") - } - - case Ping: - err := wt.masterWrite([]byte{Pong}) - if err != nil { - return errors.Wrapf(err, "failed to return Pong message to master") - } - - case ResizeTerminal: - if wt.columns != 0 && wt.rows != 0 { - break - } - - if len(data) <= 1 { - return errors.New("received malformed remote command for terminal resize: empty payload") - } - - var args argResizeTerminal - err := json.Unmarshal(data[1:], &args) - if err != nil { - return errors.Wrapf(err, "received malformed data for terminal resize") - } - rows := wt.rows - if rows == 0 { - rows = int(args.Rows) - } - - columns := wt.columns - if columns == 0 { - columns = int(args.Columns) - } - - wt.slave.ResizeTerminal(columns, rows) - default: - return errors.Errorf("unknown message type `%c`", data[0]) - } - - return nil -} - -type argResizeTerminal struct { - Columns float64 - Rows float64 -} diff --git a/webtty/webtty_test.go b/webtty/webtty_test.go deleted file mode 100644 index 92a3620..0000000 --- a/webtty/webtty_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package webtty - -import ( - "bytes" - "context" - "encoding/base64" - "io" - "sync" - "testing" -) - -type pipePair struct { - *io.PipeReader - *io.PipeWriter -} - -func TestWriteFromPTY(t *testing.T) { - connInPipeReader, connInPipeWriter := io.Pipe() // in to conn - connOutPipeReader, _ := io.Pipe() // out from conn - - conn := pipePair{ - connOutPipeReader, - connInPipeWriter, - } - dt, err := New(conn) - if err != nil { - t.Fatalf("Unexpected error from New(): %s", err) - } - - ctx, cancel := context.WithCancel(context.Background()) - var wg sync.WaitGroup - wg.Add(1) - go func() { - wg.Done() - err := dt.Run(ctx) - if err != nil { - t.Fatalf("Unexpected error from Run(): %s", err) - } - }() - - message := []byte("foobar") - n, err := dt.TTY().Write(message) - if err != nil { - t.Fatalf("Unexpected error from Write(): %s", err) - } - if n != len(message) { - t.Fatalf("Write() accepted `%d` for message `%s`", n, message) - } - - buf := make([]byte, 1024) - n, err = connInPipeReader.Read(buf) - if err != nil { - t.Fatalf("Unexpected error from Read(): %s", err) - } - if buf[0] != Output { - t.Fatalf("Unexpected message type `%c`", buf[0]) - } - decoded := make([]byte, 1024) - n, err = base64.StdEncoding.Decode(decoded, buf[1:n]) - if err != nil { - t.Fatalf("Unexpected error from Decode(): %s", err) - } - if !bytes.Equal(decoded[:n], message) { - t.Fatalf("Unexpected message received: `%s`", decoded[:n]) - } - - cancel() - wg.Wait() -} - -func TestWriteFromConn(t *testing.T) { - connInPipeReader, connInPipeWriter := io.Pipe() // in to conn - connOutPipeReader, connOutPipeWriter := io.Pipe() // out from conn - - conn := pipePair{ - connOutPipeReader, - connInPipeWriter, - } - - dt, err := New(conn) - if err != nil { - t.Fatalf("Unexpected error from New(): %s", err) - } - - ctx, cancel := context.WithCancel(context.Background()) - var wg sync.WaitGroup - wg.Add(1) - go func() { - wg.Done() - err := dt.Run(ctx) - if err != nil { - t.Fatalf("Unexpected error from Run(): %s", err) - } - }() - - var ( - message []byte - n int - ) - readBuf := make([]byte, 1024) - - // input - message = []byte("0hello\n") // line buffered canonical mode - n, err = connOutPipeWriter.Write(message) - if err != nil { - t.Fatalf("Unexpected error from Write(): %s", err) - } - if n != len(message) { - t.Fatalf("Write() accepted `%d` for message `%s`", n, message) - } - - n, err = dt.TTY().Read(readBuf) - if err != nil { - t.Fatalf("Unexpected error from Write(): %s", err) - } - if !bytes.Equal(readBuf[:n], message[1:]) { - t.Fatalf("Unexpected message received: `%s`", readBuf[:n]) - } - - // ping - message = []byte("1\n") // line buffered canonical mode - n, err = connOutPipeWriter.Write(message) - if n != len(message) { - t.Fatalf("Write() accepted `%d` for message `%s`", n, message) - } - - n, err = connInPipeReader.Read(readBuf) - if err != nil { - t.Fatalf("Unexpected error from Read(): %s", err) - } - if !bytes.Equal(readBuf[:n], []byte{'1'}) { - t.Fatalf("Unexpected message received: `%s`", readBuf[:n]) - } - - // TODO: resize - - cancel() - wg.Wait() -}