Some changes, including DNS support (#57)

* remove CDN

* Add a link to "members" in the network detail page

* Show object values as JSON

* remove TLS options

* Minor style improvements

* Show object values as JSON (member_detail)

* Add missing 'const'

* Navbar height fix

* Merge jQuery ready functions

* Change brand

* Merge network pages (name, members, detail) into single page and...

* Show ZT version on controller index page
* Show count of members
* Use <code> tag to display JSON data
* Fix error in some "error" pages caused by missing "navigate" when
  rendering nav items, use pug mixin to render nav items.
* Adjust column widths of network list

* Refactor: move duplicated nav code to `head_layout`

* Remove some debug logging code

* Get network members detail parallelly

* Add missing frontend script for members

* Revert "Change brand"

* Remove "members" and "name" pages which are merged into "detail"

* Add DNS support

* Trivial changes (table width etc.)

* Don't try to read TLS cert files when not using HTTPS

* Validate DNS IP

* Downgrade jquery to 3.4.1 to fix nav bar collapse

* Revert "Navbar height fix"

This reverts commit 8edaa9aa81, which
break the nav item height on mobile.

* Add missing margin for some buttons

* Display current DNS configuration above inputs

* Change network rename UI/UX

* Includes 'jquery.min.js' in pkg

* Improve JSON value rendering

* Get peer status of network members

* Display members with peer status

* Show controller itself as "CONTROLLER"

* Display peer address

* Improve login redirection

* pr57: Doc updates; version bump

* pr57: Year update

Co-authored-by: Key Networks <34238649+key-networks@users.noreply.github.com>
This commit is contained in:
lideming
2021-03-01 15:10:10 +08:00
committed by GitHub
co-authored by Key Networks
parent ce4b0e6d79
commit 1295dd1d07
42 changed files with 503 additions and 388 deletions
+31 -7
View File
@@ -1,6 +1,6 @@
/*
ztncui - ZeroTier network controller UI
Copyright (C) 2017-2018 Key Networks (https://key-networks.com)
Copyright (C) 2017-2021 Key Networks (https://key-networks.com)
Licensed under GPLv3 - see LICENSE for details.
*/
@@ -8,9 +8,9 @@ const got = require('got');
const ipaddr = require('ip-address');
const token = require('./token');
ZT_ADDR = process.env.ZT_ADDR || 'localhost:9993';
const ZT_ADDR = process.env.ZT_ADDR || 'localhost:9993';
init_options = async function() {
const init_options = async function() {
let tok = null;
try {
@@ -29,16 +29,21 @@ init_options = async function() {
return options;
}
get_zt_address = async function() {
const get_zt_status = async function() {
const options = await init_options();
try {
const response = await got(ZT_ADDR + '/status', options);
return response.body.address;
return response.body;
} catch(err) {
throw(err);
}
}
exports.get_zt_status = get_zt_status;
const get_zt_address = async function() {
return (await get_zt_status()).address;
}
exports.get_zt_address = get_zt_address;
exports.network_list = async function() {
@@ -68,7 +73,7 @@ exports.network_list = async function() {
return networks;
}
network_detail = async function(nwid) {
const network_detail = async function(nwid) {
const options = await init_options();
try {
@@ -241,7 +246,7 @@ exports.members = async function(nwid) {
}
}
member_detail = async function(nwid, id) {
const member_detail = async function(nwid, id) {
const options = await init_options();
try {
@@ -303,3 +308,22 @@ exports.network_easy_setup = async function(nwid,
throw(err);
}
}
exports.peers = async function() {
const options = await init_options();
const response = await got(ZT_ADDR + '/peer', options);
return response.body;
}
exports.peer = async function(id) {
const options = await init_options();
try {
const response = await got(ZT_ADDR + '/peer/' + id, options);
return response.body;
} catch (error) {
if (error instanceof got.HTTPError && error.statusCode == 404) {
return null;
}
throw error;
}
}