Compare commits
2 Commits
9827267620
...
f2e60dae5e
Author | SHA1 | Date | |
---|---|---|---|
f2e60dae5e | |||
07e9bd7ed9 |
@ -123,13 +123,10 @@ function askForConfig(state, mainCb) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (200 !== resp.statusCode || (Buffer.isBuffer(body) || 'object' !== typeof body) || !body.api_host) {
|
if (200 !== resp.statusCode || (Buffer.isBuffer(body) || 'object' !== typeof body) || !body.api_host) {
|
||||||
console.warn("===================");
|
console.warn(TPLS.remote.setup.fail_relay_check
|
||||||
console.warn(" WARNING ");
|
.replace(/{{\s*status_code\s*}}/, resp.statusCode)
|
||||||
console.warn("===================");
|
.replace(/{{\s*url\s*}}/, urlstr)
|
||||||
console.warn("");
|
);
|
||||||
console.warn("[" + resp.statusCode + "] '" + urlstr + "'");
|
|
||||||
console.warn("This server does not describe a current telebit version (but it may still work).");
|
|
||||||
console.warn("");
|
|
||||||
console.warn(body);
|
console.warn(body);
|
||||||
} else if (body && body.pair_request) {
|
} else if (body && body.pair_request) {
|
||||||
state._can_pair = true;
|
state._can_pair = true;
|
||||||
@ -158,7 +155,7 @@ function askForConfig(state, mainCb) {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
var standardSet = [
|
var standardSet = [
|
||||||
// There are questions that we need to aks in the CLI
|
// There are questions that we need to ask in the CLI
|
||||||
// if we can't guarantee that they are being asked in the web interface
|
// if we can't guarantee that they are being asked in the web interface
|
||||||
function askAgree(cb) {
|
function askAgree(cb) {
|
||||||
if (state.config.agreeTos) { cb(); return; }
|
if (state.config.agreeTos) { cb(); return; }
|
||||||
|
@ -400,6 +400,12 @@ function handleApi(req, res) {
|
|||||||
res.end('{"error":{"message":"module \'init\' needs more arguments"}}');
|
res.end('{"error":{"message":"module \'init\' needs more arguments"}}');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!Array.isArray(opts.body)) {
|
||||||
|
// TODO
|
||||||
|
res.statusCode = 500;
|
||||||
|
res.end('{"error":{"message":"[internal error (our fault)] module \'init\' expected an array"}}');
|
||||||
|
return;
|
||||||
|
}
|
||||||
// relay, email, agree_tos, servernames, ports
|
// relay, email, agree_tos, servernames, ports
|
||||||
//
|
//
|
||||||
opts.body.forEach(function (opt) {
|
opts.body.forEach(function (opt) {
|
||||||
|
60
lib/admin/documentation/index.html
Normal file
60
lib/admin/documentation/index.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Telebit Documentation</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="v-app">
|
||||||
|
<h1>Telebit (Remote) Documentation</h1>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>GET /api/config</h2>
|
||||||
|
<pre><code>{{ config }}</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>GET /api/status</h2>
|
||||||
|
<pre><code>{{ status }}</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>POST /api/init</h2>
|
||||||
|
<form v-on:submit.stop.prevent="initialize">
|
||||||
|
|
||||||
|
<label for="-email">Email:</label>
|
||||||
|
<input id="-email" v-model="init.email" type="text" placeholder="john@example.com">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<label for="-teletos"><input id="-teletos" v-model="init.teletos" type="checkbox">
|
||||||
|
Accept Telebit Terms of Service</label>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<label for="-letos"><input id="-letos" v-model="init.letos" type="checkbox">
|
||||||
|
Accept Let's Encrypt Terms of Service</label>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<pre><code>{{ init }}</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>POST /api/http</h2>
|
||||||
|
<pre><code>{{ http }}</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>POST /api/tcp</h2>
|
||||||
|
<pre><code>{{ tcp }}</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>POST /api/ssh</h2>
|
||||||
|
<pre><code>{{ ssh }}</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="/js/vue.js"></script>
|
||||||
|
<script src="/js/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,60 +1,85 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Telebit Admin</title>
|
<title>Telebit Setup</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="v-app">
|
<div class="v-app">
|
||||||
<h1>Telebit Admin</h1>
|
<h1>Telebit (Remote) Setup</h1>
|
||||||
|
|
||||||
<section>
|
<section v-if="views.section.create">
|
||||||
<h2>GET /api/config</h2>
|
<h2>Create Account</h2>
|
||||||
<pre><code>{{ config }}</code></pre>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>GET /api/status</h2>
|
|
||||||
<pre><code>{{ status }}</code></pre>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>POST /api/init</h2>
|
|
||||||
<form v-on:submit.stop.prevent="initialize">
|
<form v-on:submit.stop.prevent="initialize">
|
||||||
|
|
||||||
<label for="-email">Email:</label>
|
<label for="-email">Email:</label>
|
||||||
<input id="-email" v-model="init.email" type="text" placeholder="john@example.com">
|
<input id="-email" v-model="init.email" type="text" placeholder="john@example.com" required>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<label for="-teletos"><input id="-teletos" v-model="init.teletos" type="checkbox">
|
<label for="-teletos"><input id="-teletos" v-model="init.teletos" type="checkbox" required>
|
||||||
Accept Telebit Terms of Service</label>
|
Accept Telebit Terms of Service</label>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<label for="-letos"><input id="-letos" v-model="init.letos" type="checkbox">
|
<label for="-letos"><input id="-letos" v-model="init.letos" type="checkbox" required>
|
||||||
Accept Let's Encrypt Terms of Service</label>
|
Accept Let's Encrypt Terms of Service</label>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<label for="-notifications">Notification Preferences</label>
|
||||||
|
<select id="-notifications" v-model="init.notifications">
|
||||||
|
<option value="newsletter">Occassional Newsletter</option>
|
||||||
|
<option value="important" default><strong>Important Messages Only</strong></option>
|
||||||
|
<option value="required">Required Only</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<small>
|
||||||
|
<p v-if="'newsletter' == init.notifications">
|
||||||
|
You'll receive a friendly note now and then in addition to the important updates.
|
||||||
|
</p>
|
||||||
|
<p v-if="'important' == init.notifications">
|
||||||
|
You'll only receive updates that we believe will be of the most value to you, and the required updates.
|
||||||
|
</p>
|
||||||
|
<p v-if="'required' == init.notifications">
|
||||||
|
You'll only receive security updates, transactional and account-related messages, and legal notices.
|
||||||
|
</p>
|
||||||
|
</small>
|
||||||
|
|
||||||
|
<label for="-relay">[Advanced] Relay:</label>
|
||||||
|
<input id="-relay" v-model="init.relay" type="text" placeholder="telebit.cloud">
|
||||||
|
<br>
|
||||||
|
<button type="button" v-on:click="defaultRelay">Use Default</button>
|
||||||
|
<button type="button" v-on:click="betaRelay">Use Beta</button>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<button type="submit">Accept & Continue</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<pre><code>{{ init }}</code></pre>
|
<pre><code>{{ init }}</code></pre>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section v-if="views.section.advanced">
|
||||||
<h2>POST /api/http</h2>
|
<h2>Advanced Setup</h2>
|
||||||
<pre><code>{{ http }}</code></pre>
|
<form v-on:submit.stop.prevent="initialize">
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
<label for="-secret">Relay Secret:</label>
|
||||||
<h2>POST /api/tcp</h2>
|
<input id="-secret" v-model="init.secret" type="text" placeholder="ex: xxxxxxxxxxxx">
|
||||||
<pre><code>{{ tcp }}</code></pre>
|
<br>
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
<label for="-telemetry"><input id="-telemetry" v-model="init.telemetry" type="checkbox">
|
||||||
<h2>POST /api/ssh</h2>
|
Contribute to Telebit by sharing telemetry</label>
|
||||||
<pre><code>{{ ssh }}</code></pre>
|
<br>
|
||||||
|
|
||||||
|
<label for="-relay">[Advanced] Relay:</label>
|
||||||
|
<input id="-relay" v-model="init.relay" type="text" placeholder="telebit.cloud">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<button type="submit">Accept & Continue</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<pre><code>{{ init }}</code></pre>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/vue.js"></script>
|
<script src="/js/vue.js"></script>
|
||||||
<script src="js/app.js"></script>
|
<script src="/js/app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -23,17 +23,42 @@ api.status = function apiStatus() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO test for internet connectivity (and telebit connectivity)
|
||||||
|
var DEFAULT_RELAY = 'telebit.cloud';
|
||||||
|
var BETA_RELAY = 'telebit.ppl.family';
|
||||||
var appData = {
|
var appData = {
|
||||||
config: null
|
config: null
|
||||||
, status: null
|
, status: null
|
||||||
, init: {}
|
, init: {
|
||||||
|
teletos: true
|
||||||
|
, letos: true
|
||||||
|
, notifications: "important"
|
||||||
|
, relay: DEFAULT_RELAY
|
||||||
|
}
|
||||||
, http: null
|
, http: null
|
||||||
, tcp: null
|
, tcp: null
|
||||||
, ssh: null
|
, ssh: null
|
||||||
|
, views: {
|
||||||
|
section: {
|
||||||
|
create: true
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
var appMethods = {
|
var appMethods = {
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
console.log("call initialize");
|
console.log("call initialize");
|
||||||
|
if (!appData.init.relay) {
|
||||||
|
appData.init.relay = DEFAULT_RELAY;
|
||||||
|
}
|
||||||
|
if (DEFAULT_RELAY !== appData.init.relay) {
|
||||||
|
window.alert("TODO: Custom Relay Not Implemented Yet");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
, defaultRelay: function () {
|
||||||
|
appData.init.relay = DEFAULT_RELAY;
|
||||||
|
}
|
||||||
|
, betaRelay: function () {
|
||||||
|
appData.init.relay = BETA_RELAY;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -476,5 +476,13 @@ By using Telebit you agree to:
|
|||||||
Enter your email to agree and login/create your account:
|
Enter your email to agree and login/create your account:
|
||||||
"
|
"
|
||||||
|
|
||||||
|
fail_relay_check = "===================
|
||||||
|
WARNING
|
||||||
|
===================
|
||||||
|
|
||||||
|
[{{status_code}}] '{{url}}'
|
||||||
|
This server does not describe a current telebit version (but it may still work).
|
||||||
|
"
|
||||||
|
|
||||||
[daemon]
|
[daemon]
|
||||||
version = "telebit daemon v{version}"
|
version = "telebit daemon v{version}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user