🐶 Sync 2025-11-02 14:26:26
This commit is contained in:
20
luci-app-mentohust/Makefile
Normal file
20
luci-app-mentohust/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mentohust
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LUCI_TITLE:=LuCI support for MentoHUST
|
||||
LUCI_DEPENDS:=+mentohust
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_MAINTAINER:=sbwml <admin@cooluc.com>
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,144 @@
|
||||
'use strict';
|
||||
'require form';
|
||||
'require poll';
|
||||
'require rpc';
|
||||
'require tools.widgets as widgets';
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
var callServiceList = rpc.declare({
|
||||
object: 'service',
|
||||
method: 'list',
|
||||
params: ['name'],
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
function getServiceStatus() {
|
||||
return L.resolveDefault(callServiceList('mentohust'), {}).then(function (res) {
|
||||
var isRunning = false;
|
||||
try {
|
||||
isRunning = res['mentohust']['instances']['mentohust']['running'];
|
||||
} catch (e) { }
|
||||
return isRunning;
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatus(isRunning) {
|
||||
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
|
||||
var renderHTML;
|
||||
if (isRunning) {
|
||||
renderHTML = spanTemp.format('green', 'MentoHUST', _('RUNNING'));
|
||||
} else {
|
||||
renderHTML = spanTemp.format('red', 'MentoHUST', _('NOT RUNNING'));
|
||||
}
|
||||
|
||||
return renderHTML;
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
render: function() {
|
||||
var m, s, o;
|
||||
|
||||
m = new form.Map('mentohust', _('MentoHUST'),
|
||||
_('MentoHUST is a program that supports Ruijie authentication on Windows, Linux and Mac OS (with support for Searle authentication).'));
|
||||
|
||||
s = m.section(form.TypedSection);
|
||||
s.anonymous = true;
|
||||
s.render = function () {
|
||||
poll.add(function () {
|
||||
return L.resolveDefault(getServiceStatus()).then(function (res) {
|
||||
var view = document.getElementById('service_status');
|
||||
view.innerHTML = renderStatus(res);
|
||||
});
|
||||
});
|
||||
|
||||
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
|
||||
E('p', { id: 'service_status' }, _('Collecting data...'))
|
||||
]);
|
||||
}
|
||||
|
||||
s = m.section(form.NamedSection, 'config', 'mentohust');
|
||||
|
||||
o = s.option(form.Flag, 'enable', _('Enable'));
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'username', _('Username'));
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.option(form.Value, 'password', _('Password'));
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.option(widgets.DeviceSelect, 'interface',
|
||||
_('Network interface'));
|
||||
o.filter = function(section_id, value) {
|
||||
var dev = this.devices.filter(function(dev) { return dev.getName() == value })[0];
|
||||
var excludeDevice = ['docker', 'dummy', 'radio', 'sit', 'teql', 'veth', 'ztly'];
|
||||
return (dev && dev.getName() != null && !excludeDevice.some(prefix => dev.getName().startsWith(prefix)));
|
||||
}
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'ipaddr', _('IP address'),
|
||||
_('Leave blank or set 0.0.0.0 to use local IP (DHCP)'));
|
||||
o.default = '0.0.0.0';
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.option(form.Value, 'gateway', _('Gateway'));
|
||||
o.default = '0.0.0.0';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'mask', _('Subnet Mask'));
|
||||
o.default = '255.255.255.0';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'dns', _('DNS'));
|
||||
o.default = '0.0.0.0';
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.option(form.Value, 'ping', _('Ping Host'),
|
||||
_('Ping host for drop detection, 0.0.0.0 to turn off this feature.'));
|
||||
o.default = '0.0.0.0';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'timeout', _('Authentication Timeout (Seconds)'));
|
||||
o.default = '8';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'interval', _('Response Interval (Seconds)'));
|
||||
o.default = '30';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'wait', _('Await Failure(Seconds)'));
|
||||
o.default = '15';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.Value, 'fail_number', _('Allow Failure Count'),
|
||||
_('Default 0, indicating no limit.'));
|
||||
o.default = '0';
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.option(form.ListValue, 'multicast_address', _('Multicast Address'));
|
||||
o.default = '1';
|
||||
o.value('0', _('Standard'));
|
||||
o.value('1', _('Ruijie'));
|
||||
o.value('2', _('Searle'));
|
||||
|
||||
o = s.option(form.ListValue, 'dhcp_mode', _('DHCP Mode'));
|
||||
o.default = '1';
|
||||
o.value('0', _('None'));
|
||||
o.value('1', _('Two-factor authentication'));
|
||||
o.value('2', _('After authentication'));
|
||||
o.value('3', _('Before authentication'));
|
||||
|
||||
o = s.option(form.Value, 'dhcp_script', _('DHCP Script'),
|
||||
_('Default udhcpc -i'));
|
||||
o.default = 'udhcpc -i';
|
||||
o.rmempty = true;
|
||||
|
||||
o = s.option(form.Value, 'version', _('Client Version Number'),
|
||||
_('Default 0.00,indicating compatibility with xrgsu'));
|
||||
o.default = '0.00';
|
||||
o.rmempty = false;
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
||||
1
luci-app-mentohust/po/zh-cn
Symbolic link
1
luci-app-mentohust/po/zh-cn
Symbolic link
@@ -0,0 +1 @@
|
||||
zh_Hans
|
||||
101
luci-app-mentohust/po/zh_Hans/mentohust.po
Normal file
101
luci-app-mentohust/po/zh_Hans/mentohust.po
Normal file
@@ -0,0 +1,101 @@
|
||||
msgid "MentoHUST"
|
||||
msgstr "锐捷认证"
|
||||
|
||||
msgid "MentoHUST is a program that supports Ruijie authentication on Windows, Linux and Mac OS (with support for Searle authentication)."
|
||||
msgstr "MentoHUST 是一个支持Windows、Linux、Mac OS下锐捷认证的程序(附带支持赛尔认证)"
|
||||
|
||||
msgid "RUNNING"
|
||||
msgstr "运行中"
|
||||
|
||||
msgid "NOT RUNNING"
|
||||
msgstr "未运行"
|
||||
|
||||
msgid "Collecting data..."
|
||||
msgstr "获取数据中..."
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Username"
|
||||
msgstr "用户名"
|
||||
|
||||
msgid "Password"
|
||||
msgstr "密码"
|
||||
|
||||
msgid "Network interface"
|
||||
msgstr "网络接口"
|
||||
|
||||
msgid "IP address"
|
||||
msgstr "IP 地址"
|
||||
|
||||
msgid "Leave blank or set 0.0.0.0 to use local IP (DHCP)"
|
||||
msgstr "留空或设置 0.0.0.0 则使用本机 IP(DHCP)"
|
||||
|
||||
msgid "Gateway"
|
||||
msgstr "网关"
|
||||
|
||||
msgid "Subnet Mask"
|
||||
msgstr "子网掩码"
|
||||
|
||||
msgid "DNS"
|
||||
msgstr "DNS"
|
||||
|
||||
msgid "Ping Host"
|
||||
msgstr "Ping 主机"
|
||||
|
||||
msgid "Ping host for drop detection, 0.0.0.0 to turn off this feature."
|
||||
msgstr "Ping 主机,用于掉线检测,0.0.0.0 表示禁用该功能"
|
||||
|
||||
msgid "Authentication Timeout (Seconds)"
|
||||
msgstr "认证超时(秒)"
|
||||
|
||||
msgid "Response Interval (Seconds)"
|
||||
msgstr "响应间隔(秒)"
|
||||
|
||||
msgid "Await Failure(Seconds)"
|
||||
msgstr "失败等待(秒)"
|
||||
|
||||
msgid "Allow Failure Count"
|
||||
msgstr "允许失败次数"
|
||||
|
||||
msgid "Default 0, indicating no limit."
|
||||
msgstr "默认 0,表示无限制"
|
||||
|
||||
msgid "Multicast Address"
|
||||
msgstr "组播地址"
|
||||
|
||||
msgid "Standard"
|
||||
msgstr "标准"
|
||||
|
||||
msgid "Ruijie"
|
||||
msgstr "锐捷"
|
||||
|
||||
msgid "Searle"
|
||||
msgstr "赛尔"
|
||||
|
||||
msgid "DHCP Mode"
|
||||
msgstr "DHCP 方式"
|
||||
|
||||
msgid "None"
|
||||
msgstr "不使用"
|
||||
|
||||
msgid "Two-factor authentication"
|
||||
msgstr "二次认证"
|
||||
|
||||
msgid "After authentication"
|
||||
msgstr "认证后"
|
||||
|
||||
msgid "Before authentication"
|
||||
msgstr "认证前"
|
||||
|
||||
msgid "DHCP Script"
|
||||
msgstr "DHCP 脚本"
|
||||
|
||||
msgid "Default udhcpc -i"
|
||||
msgstr "默认 udhcpc -i"
|
||||
|
||||
msgid "Client Version Number"
|
||||
msgstr "客户端版本号"
|
||||
|
||||
msgid "Default 0.00,indicating compatibility with xrgsu"
|
||||
msgstr "默认 0.00,表示兼容 xrgsu"
|
||||
13
luci-app-mentohust/root/etc/uci-defaults/luci-mentohust
Executable file
13
luci-app-mentohust/root/etc/uci-defaults/luci-mentohust
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f "/etc/config/ucitrack" ] && {
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@mentohust[-1]
|
||||
add ucitrack mentohust
|
||||
set ucitrack.@mentohust[-1].init=mentohust
|
||||
commit ucitrack
|
||||
EOF
|
||||
}
|
||||
|
||||
rm -rf /tmp/luci-indexcache*
|
||||
exit 0
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"admin/services/mentohust": {
|
||||
"title": "MentoHUST",
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "mentohust"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-mentohust" ],
|
||||
"uci": { "mentohust": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"luci-app-mentohust": {
|
||||
"description": "Grant UCI access for luci-app-mentohust",
|
||||
"read": {
|
||||
"ubus": {
|
||||
"service": [ "list" ]
|
||||
},
|
||||
"uci": [ "mentohust" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "mentohust" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"config": "mentohust",
|
||||
"init": "mentohust"
|
||||
}
|
||||
Reference in New Issue
Block a user