mirror of
https://github.com/yudai/gotty.git
synced 2025-12-24 11:20:13 +01:00
commit
b9c9db20a7
12 changed files with 89 additions and 21 deletions
3
.gotty
3
.gotty
|
|
@ -201,6 +201,9 @@
|
|||
// [bool] Respect the host's attempt to change the cursor blink status using DEC Private Mode 12.
|
||||
// enable_dec12 = false
|
||||
|
||||
// [bool] Enable webgl rendering in the browser client terminal(hterm)
|
||||
// enable_webgl = false
|
||||
|
||||
// [map[string]string] The default environment variables, as an object.
|
||||
// environment = {"TERM" = "xterm-256color"}
|
||||
|
||||
|
|
|
|||
6
Makefile
6
Makefile
|
|
@ -14,10 +14,10 @@ server/asset.go: bindata/static/js/gotty-bundle.js bindata/static/js/gotty-bundl
|
|||
all: server/asset.go gotty
|
||||
|
||||
bindata:
|
||||
mkdir bindata
|
||||
mkdir -p bindata
|
||||
|
||||
bindata/static: bindata
|
||||
mkdir bindata/static
|
||||
mkdir -p bindata/static
|
||||
|
||||
bindata/static/index.html: bindata/static resources/index.html
|
||||
cp resources/index.html bindata/static/index.html
|
||||
|
|
@ -55,7 +55,7 @@ js/node_modules/xterm/css/xterm.css:
|
|||
|
||||
js/dist/gotty-bundle.js: js/src/* js/node_modules/webpack
|
||||
cd js && \
|
||||
/usr/bin/node $$(npm bin)/webpack
|
||||
npx webpack
|
||||
|
||||
js/dist/gotty-bundle.js.LICENSE.txt: js/dist/gotty-bundle.js
|
||||
js/dist/gotty-bundle.js.map: js/dist/gotty-bundle.js
|
||||
|
|
|
|||
13
README.md
13
README.md
|
|
@ -103,6 +103,19 @@ preferences {
|
|||
|
||||
See the [`.gotty`](https://github.com/ghthor/gotty/blob/master/.gotty) file in this repository for the list of configuration options.
|
||||
|
||||
#### Enable WebGL
|
||||
|
||||
The WebGL renderer is much better than the default canvas renderer for text; it
|
||||
can handle italics without clipping the letters. I think this is because
|
||||
upstream xtermjs is focusing on the WebGL renderer. To enable WebGL you need to
|
||||
add the following to your `~/.gotty` config file.
|
||||
|
||||
```hcl
|
||||
preferences {
|
||||
enable_webgl = true
|
||||
}
|
||||
```
|
||||
|
||||
### 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).
|
||||
|
|
|
|||
2
js/dist/gotty-bundle.js
vendored
2
js/dist/gotty-bundle.js
vendored
File diff suppressed because one or more lines are too long
26
js/dist/gotty-bundle.js.LICENSE.txt
vendored
26
js/dist/gotty-bundle.js.LICENSE.txt
vendored
|
|
@ -85,3 +85,29 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* xterm-addon-webgl (https://npmjs.com/package/xterm-addon-webgl)
|
||||
* @license MIT
|
||||
* @version 0.11.4
|
||||
* ==xterm-addon-webgl/LICENSE==
|
||||
* Copyright (c) 2018, The xterm.js authors (https://github.com/xtermjs/xterm.js)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
|
|
|||
2
js/dist/gotty-bundle.js.map
vendored
2
js/dist/gotty-bundle.js.map
vendored
File diff suppressed because one or more lines are too long
17
js/package-lock.json
generated
17
js/package-lock.json
generated
|
|
@ -7,7 +7,8 @@
|
|||
"dependencies": {
|
||||
"libapps": "github:yudai/libapps#release-hterm-1.70",
|
||||
"xterm": "^4.17",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"xterm-addon-webgl": "^0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"license-loader": "^0.5.0",
|
||||
|
|
@ -1568,6 +1569,14 @@
|
|||
"peerDependencies": {
|
||||
"xterm": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xterm-addon-webgl": {
|
||||
"version": "0.11.4",
|
||||
"resolved": "https://registry.npmjs.org/xterm-addon-webgl/-/xterm-addon-webgl-0.11.4.tgz",
|
||||
"integrity": "sha512-/a/VFeftc+etGXQYWaaks977j1P7/wickBXn15zDxZzXYYMT9RN17ztqyIDVLXg9krtg28+icKK6lvgIYghJ0w==",
|
||||
"peerDependencies": {
|
||||
"xterm": "^4.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
@ -2740,6 +2749,12 @@
|
|||
"resolved": "https://registry.npmjs.org/xterm-addon-fit/-/xterm-addon-fit-0.5.0.tgz",
|
||||
"integrity": "sha512-DsS9fqhXHacEmsPxBJZvfj2la30Iz9xk+UKjhQgnYNkrUIN5CYLbw7WEfz117c7+S86S/tpHPfvNxJsF5/G8wQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"xterm-addon-webgl": {
|
||||
"version": "0.11.4",
|
||||
"resolved": "https://registry.npmjs.org/xterm-addon-webgl/-/xterm-addon-webgl-0.11.4.tgz",
|
||||
"integrity": "sha512-/a/VFeftc+etGXQYWaaks977j1P7/wickBXn15zDxZzXYYMT9RN17ztqyIDVLXg9krtg28+icKK6lvgIYghJ0w==",
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
"dependencies": {
|
||||
"libapps": "github:yudai/libapps#release-hterm-1.70",
|
||||
"xterm": "^4.17",
|
||||
"xterm-addon-fit": "^0.5.0"
|
||||
"xterm-addon-fit": "^0.5.0",
|
||||
"xterm-addon-webgl": "^0.11.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,11 @@ export class Hterm {
|
|||
};
|
||||
|
||||
setPreferences(value: object) {
|
||||
Object.keys(value).forEach((key) => {
|
||||
this.term.getPrefs().set(key, value[key]);
|
||||
});
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key != "enable-webgl") {
|
||||
this.term.getPrefs().set(key, value[key]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onInput(callback: (input: string) => void) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {lib} from "libapps";
|
|||
|
||||
import {IDisposable, Terminal} from 'xterm';
|
||||
import {FitAddon} from "xterm-addon-fit";
|
||||
import {WebglAddon} from "xterm-addon-webgl";
|
||||
|
||||
|
||||
export class Xterm {
|
||||
|
|
@ -84,6 +85,11 @@ export class Xterm {
|
|||
};
|
||||
|
||||
setPreferences(value: object) {
|
||||
Object.keys(value).forEach((key) => {
|
||||
if (key && key == "enable-webgl") {
|
||||
this.term.loadAddon(new WebglAddon());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onInput(callback: (input: string) => void) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -41,6 +41,7 @@ func (options *Options) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// TODO(ghthor): add defaults to all these options that match the example .gotty file
|
||||
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"`
|
||||
|
|
@ -72,6 +73,7 @@ type HtermPrefernces struct {
|
|||
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"`
|
||||
EnableWebGL bool `hcl:"enable_webgl" json:"enable-webgl,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"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue