diff --git a/lib/extensions.js b/lib/extensions.js index 01793c7..d04d638 100644 --- a/lib/extensions.js +++ b/lib/extensions.js @@ -25,7 +25,7 @@ module.exports.authenticate = function (opts) { auth = jwtoken; if ('object' === typeof auth && /^.+@.+\..+$/.test(auth.subject)) { console.log('parsed'); - var id = crypto.randomBytes(16).toString('hex'); + var id = crypto.randomBytes(16).toString('base64').replace(/\+/,'-').replace(/\//g,'_').replace(/=/g,''); console.log("[DEBUG] gonna send email"); return requestAsync({ url: 'https://api.mailgun.net/v3/telebit.cloud/messages' @@ -92,8 +92,11 @@ module.exports.authenticate = function (opts) { return state.defaults.authenticate(opts.auth); }; +//var loaded = false; +var path = require('path'); var express = require('express'); var app = express(); +app.use('/', express.static(path.join(__dirname, 'extensions/admin'))); app.use('/login', function (req, res) { var tokenData; var magic = req.query.magic; @@ -108,6 +111,7 @@ app.use('/login', function (req, res) { } }); module.exports.webadmin = function (state, req, res) { + //if (!loaded) { loaded = true; app.use('/', state.defaults.webadmin); } console.log('[DEBUG] extensions webadmin'); app(req, res); }; diff --git a/lib/extensions/admin/index.html b/lib/extensions/admin/index.html new file mode 100644 index 0000000..a307304 --- /dev/null +++ b/lib/extensions/admin/index.html @@ -0,0 +1,89 @@ + + +
+Access anything, anywhere, anytime.
+We have a simple command line installer for Mac and Linux:
+curl -fsSL https://get.telebit.cloud/ | bash
+ Windows requires manual installation, but it's not too hard.
+ +You'll get an email that looks like this:
+You've installed Telebit on 'Jon's Macbook Pro'.
+
+Authenticate your account and claim your device:
+
+ https://www.telebit.cloud/login/?magic=xxxxxxxxxxxxxx
+
+
+ With a free account you'll get a random name and port number, such as "lucky-duck-42" and "22222".
+HTTPS
+
+ https://lucky-duck-42.telebit.cloud
+
+SSH
+
+ ssh ssh.telebit.cloud -p 22222
+
+TCP
+
+ netcat tcp.telebit.cloud 22222
+
+SSH over HTTPS (not blocked by firewalls)
+
+ # Add the following to ~/.ssh/config:
+ Host lucky-duck-42.telebit.cloud
+ ProxyCommand openssl s_client -quiet -connect %h:443
+
+ # Run ssh with (your domain, no port):
+ ssh lucky-duck-42.telebit.cloud
+
+ To be used for good, not evil.
+ +We'll keep your info to ourselves.
+ +There are Commercial and Open Source versions of Telebit
(kinda like how Google has Chrome and Chromium).
+
+ The Open Source versions are available as +
Telebit is a trademark of AJ ONeal +
+ diff --git a/lib/extensions/admin/setup/index.html b/lib/extensions/admin/setup/index.html new file mode 100644 index 0000000..30084ea --- /dev/null +++ b/lib/extensions/admin/setup/index.html @@ -0,0 +1,16 @@ + + + +