-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (23 loc) · 862 Bytes
/
Copy pathindex.js
File metadata and controls
31 lines (23 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var url = require('url')
var querystring = require('querystring')
var adventureTime = require('adventure-time')
var production = !location.port // a bit hackish but assume production if no custom port
var qs = url.parse(window.location.href, true).query
if (!qs.id) {
qs.id = Math.random().toString(36).slice(2)
window.location.href = window.location.href.split('?')[0] + '?' + querystring.stringify(qs)
}
var opts = {
guide: 'guide/',
console: 'terminal.html',
server: qs.server || (production ? 'docker.try-dat.com' : 'dev.try-dat.com:8080'),
id: qs.id,
secure: production
}
if (production) qs.secure = 'true'
if (!qs.server) qs.server = opts.server
// for debugging production w/ local frontend
// qs.server = 'docker.try-dat.com'
// qs.secure = 'true'
opts.console += '?'+querystring.stringify(qs)
var adventure = adventureTime(opts)