Compare commits

...

7 Commits

Author SHA1 Message Date
d982e4e038 更新 'src/views/login.pug' 2024-08-27 22:28:07 +08:00
533a14548a 更新 'src/views/index.pug' 2024-08-27 22:27:29 +08:00
4f02ee057f 更新 'src/views/front_door.pug' 2024-08-27 22:24:41 +08:00
b7f4c81f55 更新 'src/views/head_layout.pug' 2024-08-27 22:23:35 +08:00
024ab9d116 更新 'src/views/front_door.pug' 2024-08-27 22:21:57 +08:00
88c8f68260 更新 'src/routes/index.js' 2024-08-27 22:19:43 +08:00
key-networks
1b2284864d Issue#123: compatibility issue with zerotier 1.12.1 (#125)
* issue#123: version bump

* Fix incompatibility with ZeroTier 1.12 (#124)

Co-authored-by: Niels Martignène <niels.martignene@protonmail.com>

* issue#123: Credit to @Koromix for fix

---------

Co-authored-by: Niels Martignène <niels.martignene@protonmail.com>
2023-08-31 20:38:16 +08:00
8 changed files with 37 additions and 25 deletions

View File

@ -305,4 +305,5 @@ 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) . 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 ## Thanks
@lideming for a rework and improvement of the network details page, adding DNS support, peer status/address/latency and other improvements. - @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.

View File

@ -17,15 +17,26 @@ async function get_network_with_members(nwid) {
zt.network_detail(nwid), zt.network_detail(nwid),
zt.peers(), zt.peers(),
zt.members(nwid) zt.members(nwid)
.then(member_ids => .then(member_ids => {
Promise.all( // 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(
Object.keys(member_ids) Object.keys(member_ids)
.map(id => Promise.all([ .map(id => Promise.all([
zt.member_detail(nwid, id), zt.member_detail(nwid, id),
storage.getItem(id) storage.getItem(id)
])) ]))
) );
).then(results => results.map(([member, name]) => { }).then(results => results.map(([member, name]) => {
member.name = name || ''; member.name = name || '';
return member; return member;
})) }))

View File

@ -1,6 +1,6 @@
{ {
"name": "ztncui", "name": "ztncui",
"version": "0.8.13", "version": "0.8.14",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "node ./bin/www", "start": "node ./bin/www",

View File

@ -21,7 +21,7 @@ function guest_only(req, res, next) {
/* GET home page. */ /* GET home page. */
router.get('/', guest_only, function(req, res, next) { router.get('/', guest_only, function(req, res, next) {
res.render('front_door', {title: 'ztncui'}); res.render('front_door', {title: '经纬飞行网络'});
}); });
router.get('/logout', function(req, res) { router.get('/logout', function(req, res) {
@ -33,13 +33,13 @@ router.get('/logout', function(req, res) {
router.get('/login', guest_only, function(req, res) { router.get('/login', guest_only, function(req, res) {
let message = null; let message = null;
if (req.session.error) { if (req.session.error) {
if (req.session.error !== 'Access denied!') { if (req.session.error !== '无权限!') {
message = req.session.error; message = req.session.error;
} }
} else { } else {
message = req.session.success; message = req.session.success;
} }
res.render('login', { title: 'Login', message: message }); res.render('login', { title: '登录', message: message });
}); });
router.post('/login', async function(req, res) { router.post('/login', async function(req, res) {
@ -55,7 +55,7 @@ router.post('/login', async function(req, res) {
} }
}); });
} else { } else {
req.session.error = 'Authentication failed, please check your username and password.' req.session.error = '登录失败,请检查用户名和密码.'
res.redirect('/login'); res.redirect('/login');
} }
}); });

View File

@ -9,5 +9,5 @@ block login_content
h1!= title h1!= title
h2 h2
a(href='https://zerotier.com' target='_blank') ZeroTier a(href='https://www.jingweiht.com/zerotier' target='_blank') ZeroTier
| network controller UI | 网络控制器

View File

@ -31,9 +31,9 @@ html(lang='en')
span.icon-bar span.icon-bar
span.icon-bar span.icon-bar
span.icon-bar span.icon-bar
a.navbar-brand(href='https://key-networks.com' target='_blank') a.navbar-brand(href='https://www.jingweiht.com' target='_blank')
img(src='/images/key-logo.svg' alt='Key Networks logo' height='25px' width='25px' style='display: inline') img(src='/images/key-logo.svg' alt='Key Networks logo' height='25px' width='25px' style='display: inline')
| Key Networks | 飞行网络
.collapse.navbar-collapse(id='BarNav') .collapse.navbar-collapse(id='BarNav')
ul.nav.navbar-nav ul.nav.navbar-nav
block nav_items block nav_items
@ -42,5 +42,5 @@ html(lang='en')
block nav_login block nav_login
a(href='/logout') a(href='/logout')
span.glyphicon.glyphicon-log-out span.glyphicon.glyphicon-log-out
| Logout | 退出
block body_content block body_content

View File

@ -9,14 +9,14 @@ block content
h1!= title h1!= title
h2 h2
a(href='https://zerotier.com' target='_blank') ZeroTier a(href='https://www.jingweiht.com/zerotier' target='_blank') ZeroTier
| network controller UI by | 飞行网络控制器
a(href='https://key-networks.com' target='_blank') Key Networks a(href='https://www.jingweiht.com/key-networks' target='_blank') Key Networks
if error if error
b #{error} b #{error}
else else
h4 This network controller has a ZeroTier address of <b>#{zt_status.address}</b> h4 ZeroTier 网络地址 <b>#{zt_status.address}</b>
h4 ZeroTier version <b>#{zt_status.version}</b> h4 ZeroTier 版本 <b>#{zt_status.version}</b>
h4 h4
a(href='/controller/networks') List all networks on this network controller a(href='/controller/networks') 列表当前控制器下的所有网络

View File

@ -21,7 +21,7 @@ block login_content
form.form-horizontal(method='POST' action='') form.form-horizontal(method='POST' action='')
.form-group.row .form-group.row
.col-sm-2 .col-sm-2
label.control-label(for='username') Username: label.control-label(for='username') 用户名:
.col-sm-10 .col-sm-10
.input-group .input-group
span.input-group-addon span.input-group-addon
@ -30,7 +30,7 @@ block login_content
.form-group.row .form-group.row
.col-sm-2 .col-sm-2
label.control-label(for='password') Password: label.control-label(for='password') 密码:
.col-sm-10 .col-sm-10
.input-group .input-group
span.input-group-addon span.input-group-addon
@ -40,6 +40,6 @@ block login_content
.form-group.row .form-group.row
.col-sm-2 .col-sm-2
.col-sm-10 .col-sm-10
button.btn.btn-primary(type='submit') Login button.btn.btn-primary(type='submit') 登录
= ' ' = ' '
a.btn.btn-default(href='/' name='cancel' role='button') Cancel a.btn.btn-default(href='/' name='cancel' role='button') 取消