chore: move root path for all resources under /ssh
This commit is contained in:
parent
9a96637cb4
commit
dd33a8b6b0
5 changed files with 22 additions and 18 deletions
|
@ -5,7 +5,7 @@
|
|||
<style>
|
||||
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/webssh2.css" />
|
||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
|
@ -20,6 +20,6 @@
|
|||
<div id="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/webssh2.bundle.js" defer></script>
|
||||
<script src="/ssh/webssh2.bundle.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,7 +5,7 @@
|
|||
<style>
|
||||
html, body {background-color: #000;height: 100%;margin: 0;}.dropup-content {display: none;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/webssh2.css" />
|
||||
<link rel="stylesheet" href="/ssh/webssh2.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
|
@ -20,6 +20,6 @@
|
|||
<div id="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/webssh2.bundle.js" defer></script>
|
||||
<script src="/ssh/webssh2.bundle.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -40,16 +40,20 @@ function resizeScreen () {
|
|||
socket.emit('resize', { cols: term.cols, rows: term.rows })
|
||||
}
|
||||
|
||||
if (document.location.pathname) {
|
||||
var parts = document.location.pathname.split('/')
|
||||
var base = parts.slice(0, parts.length - 1).join('/') + '/'
|
||||
var resource = base.substring(1) + 'socket.io'
|
||||
socket = io.connect(null, {
|
||||
resource: resource
|
||||
// if (document.location.pathname) {
|
||||
// var parts = document.location.pathname.split('/')
|
||||
// var base = parts.slice(0, parts.length - 1).join('/') + '/'
|
||||
// var resource = base.substring(1) + 'socket.io'
|
||||
// console.log('document.location.pathname resource: ' + resource)
|
||||
|
||||
// socket = io.connect(null, {
|
||||
// resource: resource,
|
||||
// path: "/ssh/socket.io"
|
||||
// })
|
||||
// } else {
|
||||
socket = io.connect({
|
||||
path: "/ssh/socket.io"
|
||||
})
|
||||
} else {
|
||||
socket = io.connect()
|
||||
}
|
||||
|
||||
term.onData(function (data) {
|
||||
socket.emit('data', data)
|
||||
|
@ -173,7 +177,7 @@ function drawMenu (data) {
|
|||
// reauthenticate
|
||||
function reauthSession () { // eslint-disable-line
|
||||
console.log('re-authenticating')
|
||||
window.location.href = '/reauth'
|
||||
window.location.href = '/ssh/reauth'
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ var server = require('http').Server(app)
|
|||
var myutil = require('./util')
|
||||
myutil.setDefaultCredentials(config.user.name, config.user.password, config.user.privatekey);
|
||||
var validator = require('validator')
|
||||
var io = require('socket.io')(server, { serveClient: false })
|
||||
var io = require('socket.io')(server, { serveClient: false, path: '/ssh/socket.io' })
|
||||
var socket = require('./socket')
|
||||
var expressOptions = require('./expressOptions')
|
||||
|
||||
|
@ -126,9 +126,9 @@ if (config.accesslog) app.use(logger('common'))
|
|||
app.disable('x-powered-by')
|
||||
|
||||
// static files
|
||||
app.use(express.static(publicPath, expressOptions))
|
||||
app.use('/ssh', express.static(publicPath, expressOptions))
|
||||
|
||||
app.get('/reauth', function (req, res, next) {
|
||||
app.get('/ssh/reauth', function (req, res, next) {
|
||||
var r = req.headers.referer || '/'
|
||||
res.status(401).send('<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=' + r + '"></head><body bgcolor="#000"></body></html>')
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue