add commercial interface
This commit is contained in:
		
							parent
							
								
									ab35fdc40e
								
							
						
					
					
						commit
						46599c864c
					
				| @ -25,7 +25,7 @@ module.exports.authenticate = function (opts) { | |||||||
|   auth = jwtoken; |   auth = jwtoken; | ||||||
|   if ('object' === typeof auth && /^.+@.+\..+$/.test(auth.subject)) { |   if ('object' === typeof auth && /^.+@.+\..+$/.test(auth.subject)) { | ||||||
|     console.log('parsed'); |     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"); |     console.log("[DEBUG] gonna send email"); | ||||||
|     return requestAsync({ |     return requestAsync({ | ||||||
|       url: 'https://api.mailgun.net/v3/telebit.cloud/messages' |       url: 'https://api.mailgun.net/v3/telebit.cloud/messages' | ||||||
| @ -92,8 +92,11 @@ module.exports.authenticate = function (opts) { | |||||||
| 
 | 
 | ||||||
|   return state.defaults.authenticate(opts.auth); |   return state.defaults.authenticate(opts.auth); | ||||||
| }; | }; | ||||||
|  | //var loaded = false;
 | ||||||
|  | var path = require('path'); | ||||||
| var express = require('express'); | var express = require('express'); | ||||||
| var app = express(); | var app = express(); | ||||||
|  | app.use('/', express.static(path.join(__dirname, 'extensions/admin'))); | ||||||
| app.use('/login', function (req, res) { | app.use('/login', function (req, res) { | ||||||
|   var tokenData; |   var tokenData; | ||||||
|   var magic = req.query.magic; |   var magic = req.query.magic; | ||||||
| @ -108,6 +111,7 @@ app.use('/login', function (req, res) { | |||||||
|   } |   } | ||||||
| }); | }); | ||||||
| module.exports.webadmin = function (state, req, res) { | module.exports.webadmin = function (state, req, res) { | ||||||
|  |   //if (!loaded) { loaded = true; app.use('/', state.defaults.webadmin); }
 | ||||||
|   console.log('[DEBUG] extensions webadmin'); |   console.log('[DEBUG] extensions webadmin'); | ||||||
|   app(req, res); |   app(req, res); | ||||||
| }; | }; | ||||||
|  | |||||||
							
								
								
									
										89
									
								
								lib/extensions/admin/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								lib/extensions/admin/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,89 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html> | ||||||
|  |   <head> | ||||||
|  |     <title>Telebit™</title> | ||||||
|  |     <meta charset="UTF-8"> | ||||||
|  |     <style> | ||||||
|  |       /* http://www.karlgroves.com/2013/12/17/quick-tip-text-characters-as-visual-separators/ */ | ||||||
|  |       pre { | ||||||
|  |         margin-left: 2em; | ||||||
|  |         background-color: #EFEFFF; | ||||||
|  |         padding: 1em; | ||||||
|  |       } | ||||||
|  |       footer li{ | ||||||
|  |           list-style-type: none; | ||||||
|  |           display: inline; | ||||||
|  |           margin-right: .3 em; | ||||||
|  |       } | ||||||
|  |       footer li:not(:last-of-type):after{ | ||||||
|  |           content: ' | '; | ||||||
|  |       } | ||||||
|  |     </style> | ||||||
|  |   </head> | ||||||
|  |   <body> | ||||||
|  |     <script>document.body.hidden = true;</script> | ||||||
|  | 
 | ||||||
|  |     <center> | ||||||
|  |       <h1>Telebit</h1> | ||||||
|  |       <p>Access anything, anywhere, anytime.</p> | ||||||
|  |     </center> | ||||||
|  | 
 | ||||||
|  |     <div style="width: 500px; margin: auto;"> | ||||||
|  | 
 | ||||||
|  |       <h2>1. Install Telebit</h2> | ||||||
|  |       <p>We have a simple command line installer for Mac and Linux:</p> | ||||||
|  |       <pre><code>curl -fsSL https://get.telebit.cloud/ | bash</code></pre> | ||||||
|  |       <p>Windows requires <a href="https://git.coolaj86.com/coolaj86/telebit.js" target="_blank">manual installation</a>, but it's not too hard.</p> | ||||||
|  | 
 | ||||||
|  |       <h2>2. Claim your device via Email</h2> | ||||||
|  |       <p>You'll get an email that looks like this:</p> | ||||||
|  |       <pre><code>You've installed Telebit on 'Jon's Macbook Pro'. | ||||||
|  | 
 | ||||||
|  | Authenticate your account and claim your device: | ||||||
|  | 
 | ||||||
|  |     https://www.telebit.cloud/login/?magic=xxxxxxxxxxxxxx | ||||||
|  | </code></pre> | ||||||
|  | 
 | ||||||
|  |       <h2>3. Enjoy Anytime, Anywhere Access</h2> | ||||||
|  |       <p>With a free account you'll get a random name and port number, such as "lucky-duck-42" and "22222".</p> | ||||||
|  |       <pre><code>HTTPS | ||||||
|  | 
 | ||||||
|  |   https://lucky-duck-42.telebit.cloud | ||||||
|  | 
 | ||||||
|  | SSH | ||||||
|  | 
 | ||||||
|  |   ssh ssh.telebit.cloud -p 22222 | ||||||
|  | 
 | ||||||
|  | TCP | ||||||
|  | 
 | ||||||
|  |   netcat tcp.telebit.cloud 22222</code></pre> | ||||||
|  | 
 | ||||||
|  | <pre><code>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</code></pre> | ||||||
|  | 
 | ||||||
|  |     <center> | ||||||
|  |       <p><footer> | ||||||
|  |         <h3> | ||||||
|  |           <li><a href="https://git.coolaj86.com/coolaj86/telebit.js" target="_blank">Read the Telebit docs</a></li> | ||||||
|  |           <li><a href="https://git.coolaj86.com/coolaj86/telebitd.js" target="_blank">Host your own Telebit Relay</a></li> | ||||||
|  |         </h3> | ||||||
|  | 
 | ||||||
|  |         <li>©2018 AJ ONeal</li> | ||||||
|  |         <li><a href="https://git.coolaj86.com/coolaj86/telebit.js" target="_blank">git</a></li> | ||||||
|  |         <li><a href="/legal/" target="_blank">License</a></li> | ||||||
|  |         <li><a href="/legal/" target="_blank">Terms</a></li> | ||||||
|  |         <li><a href="/legal/" target="_blank">Privacy</a></li> | ||||||
|  |       </footer></p> | ||||||
|  |     </center> | ||||||
|  | 
 | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|  |     <script src="js/app.js"></script> | ||||||
|  |   </body> | ||||||
|  | </html> | ||||||
							
								
								
									
										6
									
								
								lib/extensions/admin/js/app.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								lib/extensions/admin/js/app.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | |||||||
|  | (function () { | ||||||
|  | 'use strict'; | ||||||
|  | 
 | ||||||
|  | document.body.hidden = false; | ||||||
|  | 
 | ||||||
|  | }()); | ||||||
							
								
								
									
										28
									
								
								lib/extensions/admin/legal/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								lib/extensions/admin/legal/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | <head> | ||||||
|  |   <style> | ||||||
|  |     body { | ||||||
|  |       margin: 1em; | ||||||
|  |     } | ||||||
|  |   </style> | ||||||
|  | </head> | ||||||
|  | 
 | ||||||
|  | <body> | ||||||
|  |   <h1>Terms of Service</h1> | ||||||
|  |   <p>To be used for good, not evil.</p> | ||||||
|  | 
 | ||||||
|  |   <h1>Privacy</h1> | ||||||
|  |   <p>We'll keep your info to ourselves.</p> | ||||||
|  | 
 | ||||||
|  |   <h1>License</h1> | ||||||
|  |   <p>There are Commercial and Open Source versions of Telebit<br>(kinda like how Google has Chrome and Chromium). | ||||||
|  |   </p> | ||||||
|  |   <p> | ||||||
|  |   The Open Source versions are available as | ||||||
|  |   <li><a href="https://git.coolaj86.com/coolaj86/telebit.js" target="_blank">Telebit Remote</a> (the "client" daemon)</li> | ||||||
|  |   <li><a href="https://git.coolaj86.com/coolaj86/telebit.js" target="_blank">Telebit Relay</a> (the service daemon)</li> | ||||||
|  |   </p> | ||||||
|  | 
 | ||||||
|  |   <h1>Trademark</h1> | ||||||
|  |   <p>Telebit is a trademark of AJ ONeal | ||||||
|  |   </p> | ||||||
|  | </body> | ||||||
							
								
								
									
										16
									
								
								lib/extensions/admin/setup/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								lib/extensions/admin/setup/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | <!DOCTYPE html> | ||||||
|  | <html> | ||||||
|  |   <head> | ||||||
|  |     <title>Telebit Relay</title> | ||||||
|  |   </head> | ||||||
|  |   <body> | ||||||
|  |     [TODO: Setup Interface] | ||||||
|  |     <br> | ||||||
|  |     <ul> | ||||||
|  |       <li>Admin Server Name</li> | ||||||
|  |       <li>Administrator Email</li> | ||||||
|  |       <li>SSL ToS Agree</li> | ||||||
|  |       <li>Community Member</li> | ||||||
|  |     </ul> | ||||||
|  |   </body> | ||||||
|  | </html> | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user