Compare commits
3 Commits
master
...
fix-relay-
Author | SHA1 | Date | |
---|---|---|---|
|
74b551c250 | ||
|
f034fa4105 | ||
|
d0f9a45e8d |
37
README.md
37
README.md
@ -10,7 +10,7 @@ Follow us on [![alt @key_networks on Twitter](https://i.imgur.com/wWzX9uB.png)](
|
||||
Instructions for installing on Linux from RPM or DEB packges are available at [key-networks.com/ztncui](https://key-networks.com/ztncui).
|
||||
|
||||
## Docker Container Image
|
||||
See [https://github.com/key-networks/ztncui-aio](https://github.com/key-networks/ztncui-aio)
|
||||
See [github.com/key-networks/ztncui-containerized](https://github.com/key-networks/ztncui-containerized)
|
||||
|
||||
## Getting Started
|
||||
|
||||
@ -45,9 +45,21 @@ npm install
|
||||
|
||||
##### 3. authtoken.secret
|
||||
|
||||
The app needs to know the zerotier-one authtoken.secret.
|
||||
The app needs to know the zerotier-one authtoken.secret. There are two options:
|
||||
|
||||
###### Make a .env file
|
||||
###### A: Allow access to /var/lib/zerotier-one/authtoken.secret
|
||||
The user running the ztncui app needs read access to authtoken.secret. This can be achieved with:
|
||||
```shell
|
||||
sudo usermod -aG zerotier-one username
|
||||
sudo chmod g+r /var/lib/zerotier-one/authtoken.secret
|
||||
```
|
||||
Where:
|
||||
* username is the user running the ztncui app
|
||||
|
||||
Note that you need to log out and in again to apply the new group membership.
|
||||
|
||||
###### OR
|
||||
###### B: Make a .env file
|
||||
In the root of the ztncui directory, create a `.env` file with the content:
|
||||
```
|
||||
ZT_TOKEN=########################
|
||||
@ -55,19 +67,17 @@ ZT_TOKEN=########################
|
||||
Where:
|
||||
* ######################## is the token string.
|
||||
|
||||
After all edits to the `.env file` (see other options below), make the `.env` readable by the user running ztncui only:
|
||||
```shell
|
||||
chmod 400 .env
|
||||
chown ztncui.ztncui .env
|
||||
```
|
||||
|
||||
##### 4. Zerotier-one API port
|
||||
|
||||
You can specify in the `.env` file a different address for the zerotier-one API (which defaults to localhost:9993):
|
||||
You can also specify in the `.env` file a different address for the zerotier-one API (which defaults to localhost:9993):
|
||||
```
|
||||
ZT_ADDR=localhost:9995
|
||||
```
|
||||
|
||||
Make `.env` readable by the user running ztncui only:
|
||||
```shell
|
||||
chmod 600 .env
|
||||
```
|
||||
|
||||
The `.env` file should make it easier to run ztncui on a non-Linux platform.
|
||||
|
||||
##### 4. Run in production mode
|
||||
To run the server in production mode, add the following to the `.env` file (see 3B above):
|
||||
@ -305,5 +315,4 @@ Problems with ztncui can be reported using the GitHub issue tracking system. Pl
|
||||
The ztncui code is open source code, licensed under the GNU GPLv3, and is free to use on those terms. If you are interested in commercial licensing, please contact us via the contact form at [key-networks.com](https://key-networks.com) .
|
||||
|
||||
## Thanks
|
||||
- @lideming for a rework and improvement of the network details page, adding DNS support, peer status/address/latency and other improvements.
|
||||
- @Koromix for a fix for incompatibility with ZeroTier 1.12.
|
||||
@lideming for a rework and improvement of the network details page, adding DNS support, peer status/address/latency and other improvements.
|
||||
|
@ -1,8 +0,0 @@
|
||||
getent passwd ztncui || useradd --system --home-dir /opt/key-networks/ztncui --shell /bin/false ztncui
|
||||
if [ $(getent group zerotier-one) ]; then
|
||||
echo "Adding user ztncui to group zerotier-one..."
|
||||
usermod -a -G zerotier-one ztncui
|
||||
chmod g+r /var/lib/zerotier-one/authtoken.secret
|
||||
else
|
||||
echo "Could not add user ztncui to group zerotier-one... is zerotier-one installed?"
|
||||
fi
|
@ -4,7 +4,7 @@
|
||||
],
|
||||
"cflags+": ["-Wno-cast-function-type"],
|
||||
"include_dirs+": ["<!(node -e \"require('nan')\")"],
|
||||
+ "libraries": ["/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++fs.a"],
|
||||
+ "libraries": ["/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a"],
|
||||
"dependencies": ["libargon2"],
|
||||
"configurations": {
|
||||
"Debug": {
|
||||
|
@ -26,7 +26,7 @@ BINDINGGYP='node_modules/argon2/binding.gyp'
|
||||
|
||||
NODE_VER='v16'
|
||||
|
||||
if [ ! -f /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++fs.a ]; then
|
||||
if [ ! -f /usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.a ]; then
|
||||
echo "You must install libstdc++-static"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -17,26 +17,15 @@ async function get_network_with_members(nwid) {
|
||||
zt.network_detail(nwid),
|
||||
zt.peers(),
|
||||
zt.members(nwid)
|
||||
.then(member_ids => {
|
||||
// Fix weird data returned by ZeroTier 1.12
|
||||
if (Array.isArray(member_ids)) {
|
||||
let obj = {};
|
||||
for (let id of member_ids) {
|
||||
let key = Object.keys(id)[0];
|
||||
let value = Object.values(id)[0];
|
||||
obj[key] = value;
|
||||
}
|
||||
member_ids = obj;
|
||||
}
|
||||
|
||||
return Promise.all(
|
||||
.then(member_ids =>
|
||||
Promise.all(
|
||||
Object.keys(member_ids)
|
||||
.map(id => Promise.all([
|
||||
zt.member_detail(nwid, id),
|
||||
storage.getItem(id)
|
||||
]))
|
||||
);
|
||||
}).then(results => results.map(([member, name]) => {
|
||||
)
|
||||
).then(results => results.map(([member, name]) => {
|
||||
member.name = name || '';
|
||||
return member;
|
||||
}))
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ztncui",
|
||||
"version": "0.8.14",
|
||||
"version": "0.8.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www",
|
||||
@ -19,7 +19,7 @@
|
||||
"got": "^7.1.0",
|
||||
"helmet": "^3.23.0",
|
||||
"ip-address": "^5.8.9",
|
||||
"jquery": "^3.6.1",
|
||||
"jquery": "~3.6.0",
|
||||
"morgan": "~1.9.1",
|
||||
"node-persist": "^2.1.0",
|
||||
"pug": "^3.0.2",
|
||||
|
@ -21,7 +21,7 @@ function guest_only(req, res, next) {
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', guest_only, function(req, res, next) {
|
||||
res.render('front_door', {title: '经纬飞行网络'});
|
||||
res.render('front_door', {title: 'ztncui'});
|
||||
});
|
||||
|
||||
router.get('/logout', function(req, res) {
|
||||
@ -33,13 +33,13 @@ router.get('/logout', function(req, res) {
|
||||
router.get('/login', guest_only, function(req, res) {
|
||||
let message = null;
|
||||
if (req.session.error) {
|
||||
if (req.session.error !== '无权限!') {
|
||||
if (req.session.error !== 'Access denied!') {
|
||||
message = req.session.error;
|
||||
}
|
||||
} else {
|
||||
message = req.session.success;
|
||||
}
|
||||
res.render('login', { title: '登录', message: message });
|
||||
res.render('login', { title: 'Login', message: message });
|
||||
});
|
||||
|
||||
router.post('/login', async function(req, res) {
|
||||
@ -55,7 +55,7 @@ router.post('/login', async function(req, res) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
req.session.error = '登录失败,请检查用户名和密码.'
|
||||
req.session.error = 'Authentication failed, please check your username and password.'
|
||||
res.redirect('/login');
|
||||
}
|
||||
});
|
||||
|
@ -9,5 +9,5 @@ block login_content
|
||||
h1!= title
|
||||
|
||||
h2
|
||||
a(href='https://www.jingweiht.com/zerotier' target='_blank') ZeroTier
|
||||
| 网络控制器
|
||||
a(href='https://zerotier.com' target='_blank') ZeroTier
|
||||
| network controller UI
|
||||
|
@ -31,9 +31,9 @@ html(lang='en')
|
||||
span.icon-bar
|
||||
span.icon-bar
|
||||
span.icon-bar
|
||||
a.navbar-brand(href='https://www.jingweiht.com' target='_blank')
|
||||
a.navbar-brand(href='https://key-networks.com' target='_blank')
|
||||
img(src='/images/key-logo.svg' alt='Key Networks logo' height='25px' width='25px' style='display: inline')
|
||||
| 飞行网络
|
||||
| Key Networks
|
||||
.collapse.navbar-collapse(id='BarNav')
|
||||
ul.nav.navbar-nav
|
||||
block nav_items
|
||||
@ -42,5 +42,5 @@ html(lang='en')
|
||||
block nav_login
|
||||
a(href='/logout')
|
||||
span.glyphicon.glyphicon-log-out
|
||||
| 退出
|
||||
| Logout
|
||||
block body_content
|
||||
|
@ -9,14 +9,14 @@ block content
|
||||
h1!= title
|
||||
|
||||
h2
|
||||
a(href='https://www.jingweiht.com/zerotier' target='_blank') ZeroTier
|
||||
| 飞行网络控制器
|
||||
a(href='https://www.jingweiht.com/key-networks' target='_blank') Key Networks
|
||||
a(href='https://zerotier.com' target='_blank') ZeroTier
|
||||
| network controller UI by
|
||||
a(href='https://key-networks.com' target='_blank') Key Networks
|
||||
|
||||
if error
|
||||
b #{error}
|
||||
else
|
||||
h4 ZeroTier 网络地址 <b>#{zt_status.address}</b>
|
||||
h4 ZeroTier 版本 <b>#{zt_status.version}</b>
|
||||
h4 This network controller has a ZeroTier address of <b>#{zt_status.address}</b>
|
||||
h4 ZeroTier version <b>#{zt_status.version}</b>
|
||||
h4
|
||||
a(href='/controller/networks') 列表当前控制器下的所有网络
|
||||
a(href='/controller/networks') List all networks on this network controller
|
||||
|
@ -21,7 +21,7 @@ block login_content
|
||||
form.form-horizontal(method='POST' action='')
|
||||
.form-group.row
|
||||
.col-sm-2
|
||||
label.control-label(for='username') 用户名:
|
||||
label.control-label(for='username') Username:
|
||||
.col-sm-10
|
||||
.input-group
|
||||
span.input-group-addon
|
||||
@ -30,7 +30,7 @@ block login_content
|
||||
|
||||
.form-group.row
|
||||
.col-sm-2
|
||||
label.control-label(for='password') 密码:
|
||||
label.control-label(for='password') Password:
|
||||
.col-sm-10
|
||||
.input-group
|
||||
span.input-group-addon
|
||||
@ -40,6 +40,6 @@ block login_content
|
||||
.form-group.row
|
||||
.col-sm-2
|
||||
.col-sm-10
|
||||
button.btn.btn-primary(type='submit') 登录
|
||||
button.btn.btn-primary(type='submit') Login
|
||||
= ' '
|
||||
a.btn.btn-default(href='/' name='cancel' role='button') 取消
|
||||
a.btn.btn-default(href='/' name='cancel' role='button') Cancel
|
||||
|
@ -1,6 +1,6 @@
|
||||
//-
|
||||
ztncui - ZeroTier network controller UI
|
||||
Copyright (C) 2017-2023 Key Networks (https://key-networks.com)
|
||||
Copyright (C) 2017-2021 Key Networks (https://key-networks.com)
|
||||
Licensed under GPLv3 - see LICENSE for details.
|
||||
|
||||
extends network_layout
|
||||
@ -121,7 +121,7 @@ block net_content
|
||||
a(href=nwurl + '/member/' + member.id + '/ipAssignments')
|
||||
| IP assignment
|
||||
td
|
||||
if (peer && peer.latency != -1 && peer.versionMajor != -1)
|
||||
if (peer && (peer.latency != -1 || peer.versionMajor != -1))
|
||||
if (peer.latency != -1)
|
||||
span(style='color: green;')
|
||||
| ONLINE (v#{peer.version})
|
||||
@ -135,7 +135,6 @@ block net_content
|
||||
td
|
||||
if (peer)
|
||||
each path in peer.paths
|
||||
if (path.preferred == true)
|
||||
- const [ip, port] = path.address.split('/');
|
||||
= ip
|
||||
span(style='color: gray;') /#{port}
|
||||
@ -143,7 +142,6 @@ block net_content
|
||||
if (peer.latency != -1)
|
||||
br
|
||||
| (#{peer.latency} ms)
|
||||
- break
|
||||
else
|
||||
.alert.alert-info
|
||||
strong There are no members on this network - invite users to join #{network.nwid}
|
||||
|
Loading…
Reference in New Issue
Block a user