diff --git a/docs/API.md b/docs/API.md
index 8b9430a5..d7f645b9 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -107,78 +107,6 @@ $
-### POST /v1/spawn-tty
-
-Starts a web terminal session.
-
-When successful, responds with 200 and the URL of the terminal.
-
-#### Request body
-Has to be a JSON object with an `appId` property, corresponding to the ID of the application the device is running.
-Example:
-```json
-{
- "appId": 2167
-}
-```
-
-#### Examples:
-From the app on the device:
-```bash
-$ curl -X POST --header "Content-Type:application/json" \
- --data '{"appId": }' \
- "$RESIN_SUPERVISOR_ADDRESS/v1/spawn-tty?apikey=$RESIN_SUPERVISOR_API_KEY"
-```
-Response:
-```none
-http://124135325.ngrok.com
-```
-
-Remotely via the API proxy:
-```bash
-$ curl -X POST --header "Content-Type:application/json" \
- --header "Authorization: Bearer " \
- --data '{"deviceId": , "appId": , "data": {"appId": }}' \
- "https://api.resin.io/supervisor/v1/spawn-tty"
-```
-
-
-
-### POST /v1/despawn-tty
-
-Stops a web terminal session.
-
-When successful, responds with an empty 200 response.
-
-#### Request body
-Has to be a JSON object with an `appId` property, corresponding to the ID of the application the device is running.
-Example:
-```json
-{
- "appId": 2167
-}
-```
-
-#### Examples:
-From the app on the device:
-```bash
-$ curl -X POST --header "Content-Type:application/json" \
- --data '{"appId": }' \
- "$RESIN_SUPERVISOR_ADDRESS/v1/despawn-tty?apikey=$RESIN_SUPERVISOR_API_KEY"
-```
-
-(Empty response)
-
-Remotely via the API proxy:
-```bash
-$ curl -X POST --header "Content-Type:application/json" \
- --header "Authorization: Bearer " \
- --data '{"deviceId": , "appId": , "data": {"appId": }}' \
- "https://api.resin.io/supervisor/v1/despawn-tty"
-```
-
-
-
### POST /v1/reboot
Reboots the device
diff --git a/package.json b/package.json
index ea6cb3d3..5303ea76 100644
--- a/package.json
+++ b/package.json
@@ -19,16 +19,13 @@
"lodash": "^3.0.0",
"mixpanel": "0.0.20",
"network-checker": "~0.0.5",
- "ngrok": "~0.1.97",
"pinejs-client": "^1.7.1",
"pubnub": "^3.7.13",
"request": "^2.51.0",
"resin-register-device": "^2.0.0",
"request-progress": "^0.3.1",
"rwlock": "^5.0.0",
- "server-destroy": "^1.0.0",
"sqlite3": "~3.0.4",
- "tty.js": "0.2.14-1",
"typed-error": "~0.1.0"
},
"engines": {
diff --git a/src/api.coffee b/src/api.coffee
index b1d679b0..cc69ca2f 100644
--- a/src/api.coffee
+++ b/src/api.coffee
@@ -1,7 +1,6 @@
Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
utils = require './utils'
-tty = require './lib/tty'
knex = require './db'
express = require 'express'
bodyParser = require 'body-parser'
@@ -37,36 +36,6 @@ module.exports = (application) ->
application.update(req.body.force)
res.sendStatus(204)
- api.post '/v1/spawn-tty', (req, res) ->
- appId = req.body.appId
- utils.mixpanelTrack('Spawn tty', appId)
- if !appId?
- return res.status(400).send('Missing app id')
- knex('app').select().where({ appId })
- .then ([ app ]) ->
- if !app?
- throw new Error('App not found')
- tty.start(app)
- .then ({url}) ->
- res.status(200).send(url)
- .catch (err) ->
- res.status(503).send(err?.message or err or 'Unknown error')
-
- api.post '/v1/despawn-tty', (req, res) ->
- appId = req.body.appId
- utils.mixpanelTrack('Despawn tty', appId)
- if !appId?
- return res.status(400).send('Missing app id')
- knex('app').select().where({ appId })
- .then ([ app ]) ->
- if !app?
- throw new Error('App not found')
- tty.stop(app)
- .then ->
- res.sendStatus(200)
- .catch (err) ->
- res.status(503).send(err?.message or err or 'Unknown error')
-
api.post '/v1/reboot', (req, res) ->
utils.mixpanelTrack('Reboot')
request.post(config.gosuperAddress + '/v1/reboot')
diff --git a/src/application.coffee b/src/application.coffee
index 6892eb20..ff2f9179 100644
--- a/src/application.coffee
+++ b/src/application.coffee
@@ -7,7 +7,6 @@ config = require './config'
dockerUtils = require './docker-utils'
Promise = require 'bluebird'
utils = require './utils'
-tty = require './lib/tty'
logger = require './lib/logger'
{ cachedResinApi } = require './request'
device = require './device'
@@ -100,12 +99,7 @@ application.kill = kill = (app, updateDB = true) ->
logSystemEvent(logTypes.stopApp, app)
device.updateState(status: 'Stopping')
container = docker.getContainer(app.containerId)
- tty.stop(app)
- .catch (err) ->
- console.error('Error stopping tty', err)
- return # Even if stopping the tty fails we want to finish stopping the container
- .then ->
- container.stopAsync(t: 10)
+ container.stopAsync(t: 10)
.then ->
container.removeAsync(v: true)
# Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function.
diff --git a/src/lib/static/user.css b/src/lib/static/user.css
deleted file mode 100644
index 0e57cd2b..00000000
--- a/src/lib/static/user.css
+++ /dev/null
@@ -1,65 +0,0 @@
-html, body {
- display: block;
- margin: 0;
-}
-
-body {
- padding: 20px;
-}
-
-body > h1 {
- display: none;
-}
-
-#help, #lights {
- display: none;
-}
-
-#open {
- position: static;
-
- -ms-user-select: none;
- -moz-user-select: none;
- -webkit-user-select: none;
- user-select: none;
- background: #75ddff;
- border: 1px solid #5cd6ff;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- color: white;
- cursor: pointer;
- outline: 0;
- display: inline-block;
- font-size: 15px;
- font-weight: normal;
- line-height: 21px;
- margin-bottom: 0;
- padding: 6px 12px;
- text-align: center;
- text-decoration: none;
- text-transform: uppercase;
- vertical-align: middle;
- white-space: nowrap;
-}
-
-#open:hover, #open:active {
- outline: 0;
- background-color: #42d0ff;
- border-color: #1ec7ff;
- color: white;
-}
-
-#open:active {
- -moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
- -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
- box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
-}
-
-.window {
- margin-left: 20px;
- margin-top: 20px;
-}
diff --git a/src/lib/static/user.js b/src/lib/static/user.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/src/lib/tty.coffee b/src/lib/tty.coffee
deleted file mode 100644
index 7d1ba042..00000000
--- a/src/lib/tty.coffee
+++ /dev/null
@@ -1,50 +0,0 @@
-_ = require 'lodash'
-Promise = require 'bluebird'
-TypedError = require 'typed-error'
-
-# Only load ngrok/tty when they are actually needed,
-# to reduce memory in the likely case they are never used.
-ngrok = null
-tty = null
-enableDestroy = null
-init = _.once ->
- ngrok = Promise.promisifyAll require 'ngrok'
- tty = Promise.promisifyAll require 'tty.js'
- enableDestroy = require 'server-destroy'
-
-class DisconnectedError extends TypedError
-
-# socat UNIX:/data/host -,raw,echo=0
-
-apps = {}
-nextPort = 81
-exports.start = (app) ->
- init()
- apps[app.id] ?= Promise.rejected()
- return apps[app.id] = apps[app.id].catch ->
- port = nextPort++
- server = tty.createServer
- shell: './src/enterContainer.sh'
- shellArgs: do ->
- i = 0
- return (session) -> [ app.containerId, session.id, i++ ]
- static: __dirname + '/static'
- enableDestroy(server.server)
- Promise.props
- server: server.listenAsync(port, null).return(server.server)
- url: ngrok.connectAsync(port)
-
-exports.stop = (app) ->
- if !apps[app.id]?
- return Promise.resolve()
- apps[app.id] = apps[app.id].then ({server, url}) ->
- destroy = Promise.promisify(server.destroy, server)
- Promise.join(
- destroy()
- # ngrok must have been loaded already or we wouldn't have a url to disconnect from.
- ngrok.disconnectAsync(url)
- ->
- # We throw an error so that `.start` will catch and restart the session.
- throw new DisconnectedError()
- )
- return apps[app.id].catch DisconnectedError, -> # All good, since we want to disconnect here!