From 46599c864cda692527333645d4490eb7b75d44a5 Mon Sep 17 00:00:00 2001
From: AJ ONeal
Date: Thu, 7 Jun 2018 05:26:15 +0000
Subject: [PATCH] add commercial interface
---
lib/extensions.js | 6 +-
lib/extensions/admin/index.html | 89 +++++++++++++++++++++++++++
lib/extensions/admin/js/app.js | 6 ++
lib/extensions/admin/legal/index.html | 28 +++++++++
lib/extensions/admin/setup/index.html | 16 +++++
5 files changed, 144 insertions(+), 1 deletion(-)
create mode 100644 lib/extensions/admin/index.html
create mode 100644 lib/extensions/admin/js/app.js
create mode 100644 lib/extensions/admin/legal/index.html
create mode 100644 lib/extensions/admin/setup/index.html
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 @@
+
+
+
+ Telebit™
+
+
+
+
+
+
+
+ Telebit
+ Access anything, anywhere, anytime.
+
+
+
+
+
1. Install Telebit
+
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.
+
+
2. Claim your device via Email
+
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
+
+
+
3. Enjoy Anytime, Anywhere Access
+
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
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/extensions/admin/js/app.js b/lib/extensions/admin/js/app.js
new file mode 100644
index 0000000..6d2c296
--- /dev/null
+++ b/lib/extensions/admin/js/app.js
@@ -0,0 +1,6 @@
+(function () {
+'use strict';
+
+document.body.hidden = false;
+
+}());
diff --git a/lib/extensions/admin/legal/index.html b/lib/extensions/admin/legal/index.html
new file mode 100644
index 0000000..f777f72
--- /dev/null
+++ b/lib/extensions/admin/legal/index.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+ Terms of Service
+ To be used for good, not evil.
+
+ Privacy
+ We'll keep your info to ourselves.
+
+ License
+ 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 Remote (the "client" daemon)
+ Telebit Relay (the service daemon)
+
+
+ Trademark
+ 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 @@
+
+
+
+ Telebit Relay
+
+
+ [TODO: Setup Interface]
+
+
+ - Admin Server Name
+ - Administrator Email
+ - SSL ToS Agree
+ - Community Member
+
+
+