nastools: some fixes

This commit is contained in:
jjm2473 2022-07-15 11:34:43 +08:00
parent d628a21e96
commit 6d1047c683
6 changed files with 16 additions and 17 deletions

View File

@ -2,8 +2,8 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=1.0.0
PKG_RELEASE:=20220629
PKG_VERSION:=1.0.1-20220715
PKG_RELEASE:=
LUCI_TITLE:=LuCI support for nastools
LUCI_PKGARCH:=all

View File

@ -77,12 +77,12 @@ function get_schema(data)
}
end
local _ = luci.i18n.translate
local access = _('access homepage: ')
local access = _('Access homepage:')
local homepage = '<a href=\"https://github.com/jxxghp/nas-tools\" target=\"_blank\">NasTools</a>'
local schema = {
actions = actions,
containers = get_containers(data),
description = _("NasTools is a tools for resource aggregation running in NAS.")..access..homepage,
description = _("NasTools is a tools for resource aggregation running in NAS.")..access.." "..homepage,
title = _("NasTools")
}
return schema
@ -133,7 +133,7 @@ function main_container(data)
type = "string"
},
{
name = "auto_update",
name = "auto_upgrade",
required = true,
title = "自动更新",
type = "boolean"
@ -171,7 +171,7 @@ function get_data()
local http_port = tonumber(uci:get_first(appname, appname, "http_port", "3003"))
local data = {
http_port = http_port,
auto_update = false,
auto_upgrade = uci:get_first(appname, appname, "auto_upgrade", default_path) == "1",
config_path = uci:get_first(appname, appname, "config_path", default_path),
blocks = blk1,
container_install = container_install
@ -213,19 +213,19 @@ end
function install_upgrade_nastools(req)
local http_port = req["http_port"]
local auto_update = req["auto_update"]
local auto_update_num
if auto_update then
auto_update_num = 1
local auto_upgrade = req["auto_upgrade"]
local auto_upgrade_num
if auto_upgrade then
auto_upgrade_num = 1
else
auto_update_num = 0
auto_upgrade_num = 0
end
-- save config
local uci = require "luci.model.uci".cursor()
uci:tset(appname, "@"..appname.."[0]", {
http_port = http_port or "3003",
auto_update = auto_update_num,
auto_upgrade = auto_upgrade_num,
config_path = req["config_path"],
})
uci:save(appname)

View File

@ -16,7 +16,7 @@
var c1 = resp.result.schema.containers[0];
var idx = 1;
if (resp.result.data.container_install) {
c1.labels[idx].value = '<a href="http://'+location.host+':'+resp.result.data.http_port+'" target="_blank">NasTools HTTP 链接</a>';
c1.labels[idx].value = '<a href="http://'+location.hostname+':'+resp.result.data.http_port+'" target="_blank">打开 NasTools</a>(默认用户名/密码admin/password';
} else {
c1.labels[idx].value = "安装并运行之后,才能用网页访问";
}

View File

@ -1,7 +1,7 @@
msgid "NasTools"
msgstr "NasTool 工具集"
msgid "access homepage: "
msgid "Access homepage:"
msgstr "访问主页:"
msgid "NasTools is a tools for resource aggregation running in NAS."

View File

@ -1,5 +1,4 @@
config nastools
option 'config_path' ''
option 'http_port' '3003'
option 'auto_upgrade' '0'
option 'auto_upgrade' '0'

View File

@ -41,7 +41,7 @@ run_action() {
do_install() {
local CONFIG_PATH=`uci get nastools.@nastools[0].config_path 2>/dev/null`
local HTTP_PORT=`uci get nastools.@nastools[0].http_port 2>/dev/null`
local AUTO_UPDATE=`uci get nastools.@nastools[0].https_port 2>/dev/null`
local AUTO_UPDATE=`uci get nastools.@nastools[0].auto_upgrade 2>/dev/null`
if [ -z "${CONFIG_PATH}" ]; then
echo "config path is empty!" >${LOGFILE}
exit 1