Skip to content

Commit

Permalink
feat: CORS support
Browse files Browse the repository at this point in the history
Support setting origins for socket.io, fixes #240
  • Loading branch information
billchurch committed May 11, 2021
1 parent 043c03e commit b324f33
Show file tree
Hide file tree
Showing 12 changed files with 13,084 additions and 3,735 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ docker run --name webssh2 -d -p 2222:2222 -v `pwd`/app/config.json:/usr/src/conf

* **listen.port** - _integer_ - Port node should listen on for client connections, defaults to `2222`

* **http.origins** - _array_ - COORS origins to allow connections from to socket.io server, defaults to `localhost:2222`. Changed in 0.3.1, to enable previous, less secure, default behavior of everything use `*:*` (not recommended). Check [#240](../../issues/240)

* **user.name** - _string_ - Specify user name to authenticate with. In normal cases this should be left to the default `null` setting.

* **user.password** - _string_ - Specify password to authenticate with. In normal cases this should be left to the default `null` setting.
Expand Down
2 changes: 1 addition & 1 deletion app/client/public/webssh2.bundle.js

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions app/client/public/webssh2.bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
* Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/

/*!
* Socket.IO v2.2.0
* (c) 2014-2018 Guillermo Rauch
* Released under the MIT License.
*/

/*! https://mths.be/utf8js v2.1.2 by @mathias */
11 changes: 6 additions & 5 deletions app/client/public/webssh2.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
*/

.xterm {
font-feature-settings: "liga" 0;
position: relative;
user-select: none;
-ms-user-select: none;
Expand All @@ -59,10 +58,10 @@
}

.xterm .xterm-helper-textarea {
/*
* HACK: to fix IE's blinking cursor
* Move textarea out of the screen to the far left, so that the cursor is not visible.
*/
padding: 0;
border: 0;
margin: 0;
/* Move textarea out of the screen to the far left, so that the cursor is not visible */
position: absolute;
opacity: 0;
left: -9999em;
Expand Down Expand Up @@ -169,6 +168,7 @@
.xterm-underline {
text-decoration: underline;
}

body, html {
font-family: helvetica, sans-serif, arial;
font-size: 1em;
Expand Down Expand Up @@ -316,3 +316,4 @@ body, html {
.dropup:hover .dropbtn {
background-color: #3e8e41;
}

2 changes: 1 addition & 1 deletion app/client/src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

import * as io from 'socket.io-client'
import * as io from 'socket.io-client/dist/socket.io.slim'
import { Terminal } from 'xterm'
import { FitAddon } from 'xterm-addon-fit'
/* import * as fit from 'xterm/dist/addons/fit/fit'
Expand Down
3 changes: 3 additions & 0 deletions app/config.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"ip": "0.0.0.0",
"port": 2222
},
"http": {
"origins": ["localhost:2222"]
},
"user": {
"name": null,
"password": null,
Expand Down
Loading

0 comments on commit b324f33

Please sign in to comment.