mirror of
https://github.com/roacn/openwrt-packages.git
synced 2025-01-05 10:27:05 +08:00
💋 Sync 2023-11-04 01:03
This commit is contained in:
parent
189c1efc94
commit
aaa0e45111
@ -1 +0,0 @@
|
||||
Subproject commit 8131f3e629af25d5443906adf51a723f7be0b5f7
|
@ -1 +0,0 @@
|
||||
Subproject commit bc3223c7fa18cc895aa8c9154229ca23823445a1
|
44
lua-neturl/Makefile
Normal file
44
lua-neturl/Makefile
Normal file
@ -0,0 +1,44 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2022-2023 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=neturl
|
||||
PKG_VERSION:=1.1-1
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/golgote/neturl/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=25f3a94ba9f435ef1395555de2bf17d6f934d789fa515ed965405919e42be27b
|
||||
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICNESE_FILES:=LICENSE.txt
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/lua-neturl
|
||||
SUBMENU:=Lua
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=URL and Query string parser, builder, normalizer for Lua
|
||||
URL:=https://github.com/golgote/neturl
|
||||
DEPENDS:=+lua
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/lua-neturl/description
|
||||
This small Lua library provides a few functions to parse URL with
|
||||
querystring and build new URL easily.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/lua-neturl/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/net/url.lua $(1)/usr/lib/lua/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,lua-neturl))
|
20
lua-neturl/patches/010-userinfo-regex.patch
Normal file
20
lua-neturl/patches/010-userinfo-regex.patch
Normal file
@ -0,0 +1,20 @@
|
||||
--- a/lib/net/url.lua
|
||||
+++ b/lib/net/url.lua
|
||||
@@ -340,7 +340,7 @@ function M:setAuthority(authority)
|
||||
self.password = v
|
||||
return ''
|
||||
end)
|
||||
- if string.find(userinfo, "^[%w%+%.]+$") then
|
||||
+ if string.find(userinfo, "^[%p%w%+%.]+$") then
|
||||
self.user = userinfo
|
||||
else
|
||||
-- incorrect userinfo
|
||||
@@ -369,7 +369,7 @@ function M.parse(url)
|
||||
comp.fragment = v
|
||||
return ''
|
||||
end)
|
||||
- url =url:gsub('^([%w][%w%+%-%.]*)%:', function(v)
|
||||
+ url =url:gsub('^([%w][%w%+%-%_%.]*)%:', function(v)
|
||||
comp.scheme = v:lower()
|
||||
return ''
|
||||
end)
|
@ -1 +0,0 @@
|
||||
Subproject commit 043769207e344e113d7676ba761f549eda2cb633
|
43
luci-app-advanced/Makefile
Normal file
43
luci-app-advanced/Makefile
Normal file
@ -0,0 +1,43 @@
|
||||
# Copyright (C) 2019 sirpdboy <https://github.com/sirpdboy/luci-app-advanced/>
|
||||
#
|
||||
#
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
PKG_NAME:=luci-app-advanced
|
||||
PKG_VERSION:=1.20
|
||||
PKG_RELEASE:=20220218
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
DEPENDS:=
|
||||
TITLE:=LuCI Support for advanced and filebrowser
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
$(CP) ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./root/etc/config/advanced $(1)/etc/config/
|
||||
|
||||
$(INSTALL_DIR) $(1)/www
|
||||
cp -pR ./htdocs/* $(1)/www/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(INSTALL_BIN) ./root/bin/* $(1)/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
53
luci-app-advanced/README.md
Normal file
53
luci-app-advanced/README.md
Normal file
@ -0,0 +1,53 @@
|
||||
## 访问数:[![](https://visitor-badge.glitch.me/badge?page_id=sirpdboy-visitor-badge)] [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
|
||||
|
||||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明1.jpg)
|
||||
|
||||
# luci-app-advanced
|
||||
luci-app-advanced 高级设置,包括smartdns,openclash,防火墙,DHCP等。
|
||||
|
||||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明2.jpg)
|
||||
|
||||
|
||||
|
||||
## 使用与授权相关说明
|
||||
|
||||
- 本人开源的所有源码,任何引用需注明本处出处,如需修改二次发布必告之本人,未经许可不得做于任何商用用途。
|
||||
|
||||
|
||||
# My other project
|
||||
|
||||
- 网络速度测试 :https://github.com/sirpdboy/NetSpeedTest
|
||||
|
||||
- 定时设置插件 : https://github.com/sirpdboy/luci-app-autotimeset
|
||||
|
||||
- 关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice
|
||||
|
||||
- opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd
|
||||
|
||||
- kucat 主题: https://github.com/sirpdboy/luci-theme-kucat
|
||||
|
||||
- 家长控制: https://github.com/sirpdboy/luci-theme-parentcontrol
|
||||
|
||||
- 系统高级设置 : https://github.com/sirpdboy/luci-app-advanced
|
||||
|
||||
- ddns-go动态域名: https://github.com/sirpdboy/luci-app-ddns-go
|
||||
|
||||
- 进阶设置(系统高级设置+主题设置kucat/agron/opentopd): https://github.com/sirpdboy/luci-app-advancedplus
|
||||
|
||||
- 设置向导: https://github.com/sirpdboy/luci-app-wizard
|
||||
|
||||
- 分区扩容: https://github.com/sirpdboy/luci-app-partexp
|
||||
|
||||
- lukcy大吉: https://github.com/sirpdboy/luci-app-lukcy
|
||||
|
||||
## 捐助
|
||||
|
||||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明3.jpg)
|
||||
|
||||
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了😂"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了😂" href="#赞助支持本项目-"/> |
|
||||
| :-----------------: | :-------------: |
|
||||
|![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) |
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了😂" title="返回顶部" align="right"/>
|
||||
</a>
|
@ -0,0 +1,68 @@
|
||||
.fb-container {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.fb-container .cbi-button {
|
||||
height: 2.6rem;
|
||||
}
|
||||
.fb-container .cbi-input-text {
|
||||
margin-bottom: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
.fb-container .panel-title {
|
||||
padding-bottom: 0;
|
||||
width: 50%;
|
||||
border-bottom: none;
|
||||
}
|
||||
.fb-container .panel-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 1rem;
|
||||
border-bottom: 1px solid #aaa;
|
||||
}
|
||||
.fb-container .upload-container {
|
||||
display: none;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
.fb-container .upload-file {
|
||||
margin-right: 2rem;
|
||||
}
|
||||
.fb-container .cbi-value-field {
|
||||
text-align: left;
|
||||
}
|
||||
.fb-container .parent-icon strong {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.fb-container td[class$="-icon"] {
|
||||
cursor: pointer;
|
||||
}
|
||||
.fb-container .file-icon, .fb-container .folder-icon, .fb-container .link-icon {
|
||||
position: relative;
|
||||
}
|
||||
.fb-container .file-icon:before, .fb-container .folder-icon:before, .fb-container .link-icon:before {
|
||||
display: inline-block;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
content: '';
|
||||
background-size: contain;
|
||||
margin: 0 0.5rem 0 1rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.fb-container .file-icon:before {
|
||||
background-image: url(file-icon.png);
|
||||
}
|
||||
.fb-container .folder-icon:before {
|
||||
background-image: url(folder-icon.png);
|
||||
}
|
||||
.fb-container .link-icon:before {
|
||||
background-image: url(link-icon.png);
|
||||
}
|
||||
@media screen and (max-width: 480px) {
|
||||
.fb-container .upload-file {
|
||||
width: 14.6rem;
|
||||
}
|
||||
.fb-container .cbi-value-owner,
|
||||
.fb-container .cbi-value-perm {
|
||||
display: none;
|
||||
}
|
||||
}
|
@ -0,0 +1,288 @@
|
||||
String.prototype.replaceAll = function(search, replacement) {
|
||||
var target = this;
|
||||
return target.replace(new RegExp(search, 'g'), replacement);
|
||||
};
|
||||
(function () {
|
||||
var iwxhr = new XHR();
|
||||
var listElem = document.getElementById("list-content");
|
||||
listElem.onclick = handleClick;
|
||||
var currentPath;
|
||||
var pathElem = document.getElementById("current-path");
|
||||
pathElem.onblur = function () {
|
||||
update_list(this.value.trim());
|
||||
};
|
||||
pathElem.onkeyup = function (evt) {
|
||||
if (evt.keyCode == 13) {
|
||||
this.blur();
|
||||
}
|
||||
};
|
||||
function removePath(filename, isdir) {
|
||||
var c = confirm('你确定要删除 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/delete',
|
||||
{
|
||||
path: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function installPath(filename, isdir) {
|
||||
if (isdir === "1") {
|
||||
alert('这是一个目录,请选择 ipk 文件进行安装!');
|
||||
return;
|
||||
}
|
||||
var isipk = isIPK(filename);
|
||||
if (isipk === 0) {
|
||||
alert('只允许安装 ipk 格式的文件!');
|
||||
return;
|
||||
}
|
||||
var c = confirm('你确定要安装 ' + filename + ' 吗?');
|
||||
if (c) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/install',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
isdir: isdir
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
location.reload();
|
||||
alert('安装成功!');
|
||||
} else {
|
||||
alert('安装失败,请检查文件格式!');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isIPK(filename) {
|
||||
var index= filename.lastIndexOf(".");
|
||||
var ext = filename.substr(index+1);
|
||||
if (ext === 'ipk') {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function renamePath(filename) {
|
||||
var newname = prompt('请输入新的文件名:', filename);
|
||||
if (newname) {
|
||||
newname = newname.trim();
|
||||
if (newname != filename) {
|
||||
var newpath = concatPath(currentPath, newname);
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/rename',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newpath: newpath
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function openpath(filename, dirname) {
|
||||
dirname = dirname || currentPath;
|
||||
window.open('/cgi-bin/luci/admin/system/fileassistant/open?path='
|
||||
+ encodeURIComponent(dirname) + '&filename='
|
||||
+ encodeURIComponent(filename));
|
||||
}
|
||||
|
||||
function getFileElem(elem) {
|
||||
if (elem.className.indexOf('-icon') > -1) {
|
||||
return elem;
|
||||
}
|
||||
else if (elem.parentNode.className.indexOf('-icon') > -1) {
|
||||
return elem.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
function concatPath(path, filename) {
|
||||
if (path === '/') {
|
||||
return path + filename;
|
||||
}
|
||||
else {
|
||||
return path.replace(/\/$/, '') + '/' + filename;
|
||||
}
|
||||
}
|
||||
|
||||
function handleClick(evt) {
|
||||
var targetElem = evt.target;
|
||||
var infoElem;
|
||||
if (targetElem.className.indexOf('cbi-button-remove') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
removePath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-install') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
installPath(infoElem.dataset['filename'] , infoElem.dataset['isdir'])
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-edit') > -1) {
|
||||
renamePath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem = getFileElem(targetElem)) {
|
||||
if (targetElem.className.indexOf('parent-icon') > -1) {
|
||||
update_list(currentPath.replace(/\/[^/]+($|\/$)/, ''));
|
||||
}
|
||||
else if (targetElem.className.indexOf('file-icon') > -1) {
|
||||
openpath(targetElem.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('link-icon') > -1) {
|
||||
infoElem = targetElem.parentNode;
|
||||
var filepath = infoElem.dataset['linktarget'];
|
||||
if (filepath) {
|
||||
if (infoElem.dataset['isdir'] === "1") {
|
||||
update_list(filepath);
|
||||
}
|
||||
else {
|
||||
var lastSlash = filepath.lastIndexOf('/');
|
||||
openpath(filepath.substring(lastSlash + 1), filepath.substring(0, lastSlash));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (targetElem.className.indexOf('folder-icon') > -1) {
|
||||
update_list(concatPath(currentPath, targetElem.parentNode.dataset['filename']))
|
||||
}
|
||||
}
|
||||
}
|
||||
function refresh_list(filenames, path) {
|
||||
var listHtml = '<table class="cbi-section-table"><tbody>';
|
||||
if (path !== '/') {
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-2"><td class="parent-icon" colspan="6"><strong>..返回上级目录</strong></td></tr>';
|
||||
}
|
||||
if (filenames) {
|
||||
for (var i = 0; i < filenames.length; i++) {
|
||||
var line = filenames[i];
|
||||
if (line) {
|
||||
var f = line.match(/(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+([\S\s]+)/);
|
||||
var isLink = f[1][0] === 'z' || f[1][0] === 'l' || f[1][0] === 'x';
|
||||
var o = {
|
||||
displayname: f[9],
|
||||
filename: isLink ? f[9].split(' -> ')[0] : f[9],
|
||||
perms: f[1],
|
||||
date: f[7] + ' ' + f[6] + ' ' + f[8],
|
||||
size: f[5],
|
||||
owner: f[3],
|
||||
icon: (f[1][0] === 'd') ? "folder-icon" : (isLink ? "link-icon" : "file-icon")
|
||||
};
|
||||
|
||||
var install_btn = ' <button class="cbi-button cbi-button-install" style="visibility: hidden;">安装</button>';
|
||||
var index= o.filename.lastIndexOf(".");
|
||||
var ext = o.filename.substr(index+1);
|
||||
if (ext === 'ipk') {
|
||||
install_btn = ' <button class="cbi-button cbi-button-install">安装</button>';
|
||||
}
|
||||
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-' + (1 + i%2)
|
||||
+ '" data-filename="' + o.filename + '" data-isdir="' + Number(f[1][0] === 'd' || f[1][0] === 'z') + '"'
|
||||
+ ((f[1][0] === 'z' || f[1][0] === 'l') ? (' data-linktarget="' + f[9].split(' -> ')[1]) : '')
|
||||
+ '">'
|
||||
+ '<td class="cbi-value-field ' + o.icon + '">'
|
||||
+ '<strong>' + o.displayname + '</strong>'
|
||||
+ '</td>'
|
||||
|
||||
+ '<td class="cbi-value-field cbi-value-date">'+o.date+'</td>'
|
||||
+ '<td class="cbi-value-field cbi-value-size">'+o.size+'</td>'
|
||||
+ '<td class="cbi-value-field cbi-value-perm">'+o.perms+'</td>'
|
||||
+ '<td class="cbi-section-table-cell">\
|
||||
<button class="cbi-button cbi-button-edit">重命名</button>\
|
||||
<button class="cbi-button cbi-button-remove">删除</button>'
|
||||
+ install_btn
|
||||
+ '</td>'
|
||||
+ '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
listHtml += "</table>";
|
||||
listElem.innerHTML = listHtml;
|
||||
}
|
||||
function update_list(path, opt) {
|
||||
opt = opt || {};
|
||||
path = concatPath(path, '');
|
||||
if (currentPath != path) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/system/fileassistant/list',
|
||||
{path: path},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, path);
|
||||
}
|
||||
else {
|
||||
refresh_list([], path);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!opt.popState) {
|
||||
history.pushState({path: path}, null, '?path=' + path);
|
||||
}
|
||||
currentPath = path;
|
||||
pathElem.value = currentPath;
|
||||
}
|
||||
};
|
||||
|
||||
var uploadToggle = document.getElementById('upload-toggle');
|
||||
var uploadContainer = document.getElementById('upload-container');
|
||||
var isUploadHide = true;
|
||||
uploadToggle.onclick = function() {
|
||||
if (isUploadHide) {
|
||||
uploadContainer.style.display = 'inline-flex';
|
||||
}
|
||||
else {
|
||||
uploadContainer.style.display = 'none';
|
||||
}
|
||||
isUploadHide = !isUploadHide;
|
||||
};
|
||||
var uploadBtn = uploadContainer.getElementsByClassName('cbi-input-apply')[0];
|
||||
uploadBtn.onclick = function (evt) {
|
||||
var uploadinput = document.getElementById('upload-file');
|
||||
var fullPath = uploadinput.value;
|
||||
if (!fullPath) {
|
||||
evt.preventDefault();
|
||||
}
|
||||
else {
|
||||
var formData = new FormData();
|
||||
var startIndex = (fullPath.indexOf('\\') >= 0 ? fullPath.lastIndexOf('\\') : fullPath.lastIndexOf('/'));
|
||||
formData.append('upload-filename', fullPath.substring(startIndex + 1));
|
||||
formData.append('upload-dir', concatPath(currentPath, ''));
|
||||
formData.append('upload-file', uploadinput.files[0]);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/system/fileassistant/upload", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
refresh_list(res.data, currentPath);
|
||||
uploadinput.value = '';
|
||||
}
|
||||
else {
|
||||
alert('上传失败,请稍后再试...');
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function(evt) {
|
||||
var initPath = '/';
|
||||
if (/path=([/\w]+)/.test(location.search)) {
|
||||
initPath = RegExp.$1;
|
||||
}
|
||||
update_list(initPath, {popState: true});
|
||||
});
|
||||
window.addEventListener('popstate', function (evt) {
|
||||
var path = '/';
|
||||
if (evt.state && evt.state.path) {
|
||||
path = evt.state.path;
|
||||
}
|
||||
update_list(path, {popState: true});
|
||||
});
|
||||
|
||||
})();
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
9
luci-app-advanced/luasrc/controller/advanced.lua
Normal file
9
luci-app-advanced/luasrc/controller/advanced.lua
Normal file
@ -0,0 +1,9 @@
|
||||
module("luci.controller.advanced",package.seeall)
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/advanced")then
|
||||
return
|
||||
end
|
||||
local e
|
||||
e=entry({"admin","system","advanced"},cbi("advanced"),_("高级设置"),60)
|
||||
e.dependent=true
|
||||
end
|
228
luci-app-advanced/luasrc/controller/fileassistant.lua
Normal file
228
luci-app-advanced/luasrc/controller/fileassistant.lua
Normal file
@ -0,0 +1,228 @@
|
||||
module("luci.controller.fileassistant", package.seeall)
|
||||
|
||||
function index()
|
||||
|
||||
local page
|
||||
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件管理"), 84)
|
||||
page.i18n = "base"
|
||||
page.dependent = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "open"}, call("fileassistant_open"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "delete"}, call("fileassistant_delete"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "rename"}, call("fileassistant_rename"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "upload"}, call("fileassistant_upload"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "system", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page.leaf = true
|
||||
|
||||
end
|
||||
|
||||
function list_response(path, success)
|
||||
luci.http.prepare_content("application/json")
|
||||
local result
|
||||
if success then
|
||||
local rv = scandir(path)
|
||||
result = {
|
||||
ec = 0,
|
||||
data = rv
|
||||
}
|
||||
else
|
||||
result = {
|
||||
ec = 1
|
||||
}
|
||||
end
|
||||
luci.http.write_json(result)
|
||||
end
|
||||
|
||||
function fileassistant_list()
|
||||
local path = luci.http.formvalue("path")
|
||||
list_response(path, true)
|
||||
end
|
||||
|
||||
function fileassistant_open()
|
||||
local path = luci.http.formvalue("path")
|
||||
local filename = luci.http.formvalue("filename")
|
||||
local io = require "io"
|
||||
local mime = to_mime(filename)
|
||||
|
||||
file = path..filename
|
||||
|
||||
local download_fpi = io.open(file, "r")
|
||||
luci.http.header('Content-Disposition', 'inline; filename="'..filename..'"' )
|
||||
luci.http.prepare_content(mime)
|
||||
luci.ltn12.pump.all(luci.ltn12.source.file(download_fpi), luci.http.write)
|
||||
end
|
||||
|
||||
function fileassistant_delete()
|
||||
local path = luci.http.formvalue("path")
|
||||
local isdir = luci.http.formvalue("isdir")
|
||||
path = path:gsub("<>", "/")
|
||||
path = path:gsub(" ", "\ ")
|
||||
local success
|
||||
if isdir then
|
||||
success = os.execute('rm -r "'..path..'"')
|
||||
else
|
||||
success = os.remove(path)
|
||||
end
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
end
|
||||
|
||||
function fileassistant_rename()
|
||||
local filepath = luci.http.formvalue("filepath")
|
||||
local newpath = luci.http.formvalue("newpath")
|
||||
local success = os.execute('mv "'..filepath..'" "'..newpath..'"')
|
||||
list_response(nixio.fs.dirname(filepath), success)
|
||||
end
|
||||
|
||||
function fileassistant_install()
|
||||
local filepath = luci.http.formvalue("filepath")
|
||||
local isdir = luci.http.formvalue("isdir")
|
||||
local ext = filepath:match(".+%.(%w+)$")
|
||||
filepath = filepath:gsub("<>", "/")
|
||||
filepath = filepath:gsub(" ", "\ ")
|
||||
local success
|
||||
if isdir == "1" then
|
||||
success = false
|
||||
elseif ext == "ipk" then
|
||||
success = installIPK(filepath)
|
||||
else
|
||||
success = false
|
||||
end
|
||||
list_response(nixio.fs.dirname(filepath), success)
|
||||
end
|
||||
|
||||
function installIPK(filepath)
|
||||
luci.sys.exec('opkg --force-depends install "'..filepath..'"')
|
||||
luci.sys.exec('rm -rf /tmp/luci-*')
|
||||
return true;
|
||||
end
|
||||
|
||||
function fileassistant_upload()
|
||||
local filecontent = luci.http.formvalue("upload-file")
|
||||
local filename = luci.http.formvalue("upload-filename")
|
||||
local uploaddir = luci.http.formvalue("upload-dir")
|
||||
local filepath = uploaddir..filename
|
||||
|
||||
local fp
|
||||
luci.http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fp and meta and meta.name == "upload-file" then
|
||||
fp = io.open(filepath, "w")
|
||||
end
|
||||
if fp and chunk then
|
||||
fp:write(chunk)
|
||||
end
|
||||
if fp and eof then
|
||||
fp:close()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
list_response(uploaddir, true)
|
||||
end
|
||||
|
||||
function scandir(directory)
|
||||
local i, t, popen = 0, {}, io.popen
|
||||
|
||||
local pfile = popen("ls -lh \""..directory.."\" | egrep '^d' ; ls -lh \""..directory.."\" | egrep -v '^d|^l'")
|
||||
for fileinfo in pfile:lines() do
|
||||
i = i + 1
|
||||
t[i] = fileinfo
|
||||
end
|
||||
pfile:close()
|
||||
pfile = popen("ls -lh \""..directory.."\" | egrep '^l' ;")
|
||||
for fileinfo in pfile:lines() do
|
||||
i = i + 1
|
||||
linkindex, _, linkpath = string.find(fileinfo, "->%s+(.+)$")
|
||||
local finalpath;
|
||||
if string.sub(linkpath, 1, 1) == "/" then
|
||||
finalpath = linkpath
|
||||
else
|
||||
finalpath = nixio.fs.realpath(directory..linkpath)
|
||||
end
|
||||
local linktype;
|
||||
if not finalpath then
|
||||
finalpath = linkpath;
|
||||
linktype = 'x'
|
||||
elseif nixio.fs.stat(finalpath, "type") == "dir" then
|
||||
linktype = 'z'
|
||||
else
|
||||
linktype = 'l'
|
||||
end
|
||||
fileinfo = string.sub(fileinfo, 2, linkindex - 1)
|
||||
fileinfo = linktype..fileinfo.."-> "..finalpath
|
||||
t[i] = fileinfo
|
||||
end
|
||||
pfile:close()
|
||||
return t
|
||||
end
|
||||
|
||||
MIME_TYPES = {
|
||||
["txt"] = "text/plain";
|
||||
["conf"] = "text/plain";
|
||||
["ovpn"] = "text/plain";
|
||||
["log"] = "text/plain";
|
||||
["js"] = "text/javascript";
|
||||
["json"] = "application/json";
|
||||
["css"] = "text/css";
|
||||
["htm"] = "text/html";
|
||||
["html"] = "text/html";
|
||||
["patch"] = "text/x-patch";
|
||||
["c"] = "text/x-csrc";
|
||||
["h"] = "text/x-chdr";
|
||||
["o"] = "text/x-object";
|
||||
["ko"] = "text/x-object";
|
||||
|
||||
["bmp"] = "image/bmp";
|
||||
["gif"] = "image/gif";
|
||||
["png"] = "image/png";
|
||||
["jpg"] = "image/jpeg";
|
||||
["jpeg"] = "image/jpeg";
|
||||
["svg"] = "image/svg+xml";
|
||||
|
||||
["zip"] = "application/zip";
|
||||
["pdf"] = "application/pdf";
|
||||
["xml"] = "application/xml";
|
||||
["xsl"] = "application/xml";
|
||||
["doc"] = "application/msword";
|
||||
["ppt"] = "application/vnd.ms-powerpoint";
|
||||
["xls"] = "application/vnd.ms-excel";
|
||||
["odt"] = "application/vnd.oasis.opendocument.text";
|
||||
["odp"] = "application/vnd.oasis.opendocument.presentation";
|
||||
["pl"] = "application/x-perl";
|
||||
["sh"] = "application/x-shellscript";
|
||||
["php"] = "application/x-php";
|
||||
["deb"] = "application/x-deb";
|
||||
["iso"] = "application/x-cd-image";
|
||||
["tgz"] = "application/x-compressed-tar";
|
||||
|
||||
["mp3"] = "audio/mpeg";
|
||||
["ogg"] = "audio/x-vorbis+ogg";
|
||||
["wav"] = "audio/x-wav";
|
||||
|
||||
["mpg"] = "video/mpeg";
|
||||
["mpeg"] = "video/mpeg";
|
||||
["avi"] = "video/x-msvideo";
|
||||
}
|
||||
|
||||
function to_mime(filename)
|
||||
if type(filename) == "string" then
|
||||
local ext = filename:match("[^%.]+$")
|
||||
|
||||
if ext and MIME_TYPES[ext:lower()] then
|
||||
return MIME_TYPES[ext:lower()]
|
||||
end
|
||||
end
|
||||
|
||||
return "application/octet-stream"
|
||||
end
|
340
luci-app-advanced/luasrc/model/cbi/advanced.lua
Normal file
340
luci-app-advanced/luasrc/model/cbi/advanced.lua
Normal file
@ -0,0 +1,340 @@
|
||||
local e=require"nixio.fs"
|
||||
local t=require"luci.sys"
|
||||
local t=luci.model.uci.cursor()
|
||||
m=Map("advanced",translate("高级进阶设置"),translate("<font color=\"Red\"><strong>配置文档是直接编辑的除非你知道自己在干什么,否则请不要轻易修改这些配置文档。配置不正确可能会导致不能开机等错误。</strong></font><br/>"))
|
||||
m.apply_on_parse=true
|
||||
s=m:section(TypedSection,"advanced")
|
||||
s.anonymous=true
|
||||
|
||||
if nixio.fs.access("/etc/dnsmasq.conf")then
|
||||
|
||||
s:tab("dnsmasqconf",translate("dnsmasq"),translate("本页是配置/etc/dnsmasq.conf的文档内容。应用保存后自动重启生效"))
|
||||
|
||||
conf=s:taboption("dnsmasqconf",Value,"dnsmasqconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/dnsmasq.conf")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/dnsmasq.conf",t)
|
||||
if(luci.sys.call("cmp -s /tmp/dnsmasq.conf /etc/dnsmasq.conf")==1)then
|
||||
e.writefile("/etc/dnsmasq.conf",t)
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/dnsmasq.conf")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/network")then
|
||||
s:tab("netwrokconf",translate("网络"),translate("本页是配置/etc/config/network包含网络配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("netwrokconf",Value,"netwrokconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/network")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/network",t)
|
||||
if(luci.sys.call("cmp -s /tmp/network /etc/config/network")==1)then
|
||||
e.writefile("/etc/config/network",t)
|
||||
luci.sys.call("/etc/init.d/network restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/network")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/wireless")then
|
||||
s:tab("wirelessconf",translate("无线"), translate("本页是/etc/config/wireless的配置文件内容,应用保存后自动重启生效."))
|
||||
|
||||
conf=s:taboption("wirelessconf",Value,"wirelessconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/wireless")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/etc/config/wireless.tmp",t)
|
||||
if(luci.sys.call("cmp -s /etc/config/wireless.tmp /etc/config/wireless")==1)then
|
||||
e.writefile("/etc/config/wireless",t)
|
||||
luci.sys.call("wifi reload >/dev/null &")
|
||||
end
|
||||
e.remove("/tmp//tmp/wireless.tmp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/hosts")then
|
||||
s:tab("hostsconf",translate("hosts"),translate("本页是配置/etc/hosts的文档内容。应用保存后自动重启生效"))
|
||||
|
||||
conf=s:taboption("hostsconf",Value,"hostsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/hosts")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/hosts.tmp",t)
|
||||
if(luci.sys.call("cmp -s /tmp/hosts.tmp /etc/hosts")==1)then
|
||||
e.writefile("/etc/hosts",t)
|
||||
luci.sys.call("/etc/init.d/dnsmasq restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/hosts.tmp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/arpbind")then
|
||||
s:tab("arpbindconf",translate("ARP绑定"),translate("本页是配置/etc/config/arpbind包含APR绑定MAC地址文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("arpbindconf",Value,"arpbindconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/arpbind")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/arpbind",t)
|
||||
if(luci.sys.call("cmp -s /tmp/arpbind /etc/config/arpbind")==1)then
|
||||
e.writefile("/etc/config/arpbind",t)
|
||||
luci.sys.call("/etc/init.d/arpbind restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/arpbind")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/firewall")then
|
||||
s:tab("firewallconf",translate("防火墙"),translate("本页是配置/etc/config/firewall包含防火墙协议设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("firewallconf",Value,"firewallconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/firewall")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/firewall",t)
|
||||
if(luci.sys.call("cmp -s /tmp/firewall /etc/config/firewall")==1)then
|
||||
e.writefile("/etc/config/firewall",t)
|
||||
luci.sys.call("/etc/init.d/firewall restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/firewall")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/mwan3")then
|
||||
s:tab("mwan3conf",translate("负载均衡"),translate("本页是配置/etc/config/mwan3包含负载均衡设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("mwan3conf",Value,"mwan3conf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/mwan3")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/mwan3",t)
|
||||
if(luci.sys.call("cmp -s /tmp/mwan3 /etc/config/mwan3")==1)then
|
||||
e.writefile("/etc/config/mwan3",t)
|
||||
luci.sys.call("/etc/init.d/mwan3 restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/mwan3")
|
||||
end
|
||||
end
|
||||
end
|
||||
if nixio.fs.access("/etc/config/dhcp")then
|
||||
s:tab("dhcpconf",translate("DHCP"),translate("本页是配置/etc/config/DHCP包含机器名等设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("dhcpconf",Value,"dhcpconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/dhcp")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/dhcp",t)
|
||||
if(luci.sys.call("cmp -s /tmp/dhcp /etc/config/dhcp")==1)then
|
||||
e.writefile("/etc/config/dhcp",t)
|
||||
luci.sys.call("/etc/init.d/network restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/dhcp")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/ddns")then
|
||||
s:tab("ddnsconf",translate("DDNS"),translate("本页是配置/etc/config/ddns包含动态域名设置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("ddnsconf",Value,"ddnsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/ddns")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/ddns",t)
|
||||
if(luci.sys.call("cmp -s /tmp/ddns /etc/config/ddns")==1)then
|
||||
e.writefile("/etc/config/ddns",t)
|
||||
luci.sys.call("/etc/init.d/ddns restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/ddns")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/parentcontrol")then
|
||||
s:tab("parentcontrolconf",translate("家长控制"),translate("本页是配置/etc/config/parentcontrol包含家长控制配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("parentcontrolconf",Value,"parentcontrolconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/parentcontrol")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/parentcontrol",t)
|
||||
if(luci.sys.call("cmp -s /tmp/parentcontrol /etc/config/parentcontrol")==1)then
|
||||
e.writefile("/etc/config/parentcontrol",t)
|
||||
luci.sys.call("/etc/init.d/parentcontrol restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/parentcontrol")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/autotimeset")then
|
||||
s:tab("autotimesetconf",translate("定时设置"),translate("本页是配置/etc/config/autotimeset包含定时设置任务配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("autotimesetconf",Value,"autotimesetconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/autotimeset")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/autotimeset",t)
|
||||
if(luci.sys.call("cmp -s /tmp/autotimeset /etc/config/autotimeset")==1)then
|
||||
e.writefile("/etc/config/autotimeset",t)
|
||||
luci.sys.call("/etc/init.d/autotimeset restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/autotimeset")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/wolplus")then
|
||||
s:tab("wolplusconf",translate("网络唤醒"),translate("本页是配置/etc/config/wolplus包含网络唤醒配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("wolplusconf",Value,"wolplusconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/wolplus")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/wolplus",t)
|
||||
if(luci.sys.call("cmp -s /tmp/wolplus /etc/config/wolplus")==1)then
|
||||
e.writefile("/etc/config/wolplus",t)
|
||||
luci.sys.call("/etc/init.d/wolplus restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/wolplus")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/smartdns")then
|
||||
s:tab("smartdnsconf",translate("SMARTDNS"),translate("本页是配置/etc/config/smartdns包含smartdns配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("smartdnsconf",Value,"smartdnsconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/smartdns")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/smartdns",t)
|
||||
if(luci.sys.call("cmp -s /tmp/smartdns /etc/config/smartdns")==1)then
|
||||
e.writefile("/etc/config/smartdns",t)
|
||||
luci.sys.call("/etc/init.d/smartdns restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/smartdns")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/bypass")then
|
||||
s:tab("bypassconf",translate("BYPASS"),translate("本页是配置/etc/config/bypass包含bypass配置文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("bypassconf",Value,"bypassconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/bypass")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/bypass",t)
|
||||
if(luci.sys.call("cmp -s /tmp/bypass /etc/config/bypass")==1)then
|
||||
e.writefile("/etc/config/bypass",t)
|
||||
luci.sys.call("/etc/init.d/bypass restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/bypass")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/openclash")then
|
||||
s:tab("openclashconf",translate("openclash"),translate("本页是配置/etc/config/openclash的文档内容。应用保存后自动重启生效"))
|
||||
conf=s:taboption("openclashconf",Value,"openclashconf",nil,translate("开头的数字符号(#)或分号的每一行(;)被视为注释;删除(;)启用指定选项。"))
|
||||
conf.template="cbi/tvalue"
|
||||
conf.rows=20
|
||||
conf.wrap="off"
|
||||
conf.cfgvalue=function(t,t)
|
||||
return e.readfile("/etc/config/openclash")or""
|
||||
end
|
||||
conf.write=function(a,a,t)
|
||||
if t then
|
||||
t=t:gsub("\r\n?","\n")
|
||||
e.writefile("/tmp/openclash",t)
|
||||
if(luci.sys.call("cmp -s /tmp/openclash /etc/config/openclash")==1)then
|
||||
e.writefile("/etc/config/openclash",t)
|
||||
luci.sys.call("/etc/init.d/openclash restart >/dev/null")
|
||||
end
|
||||
e.remove("/tmp/openclash")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return m
|
20
luci-app-advanced/luasrc/view/fileassistant.htm
Normal file
20
luci-app-advanced/luasrc/view/fileassistant.htm
Normal file
@ -0,0 +1,20 @@
|
||||
<%+header%>
|
||||
|
||||
<link rel="stylesheet" href="/luci-static/resources/fileassistant/fb.css?v=@ver">
|
||||
<h2 name="content">文件管理【集成上传删除及安装,非专业人员请谨慎操作】</h2>
|
||||
<fieldset class="cbi-section fb-container">
|
||||
<input id="current-path" type="text" class="current-path cbi-input-text" value="/"/>
|
||||
<div class="panel-container">
|
||||
<div class="panel-title">文件列表</div>
|
||||
<button id="upload-toggle" class="upload-toggle cbi-button cbi-button-edit">上传文件</button>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
<button type="button" class="cbi-button cbi-input-apply">执行上传</button>
|
||||
</div>
|
||||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fileassistant/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
20
luci-app-advanced/luasrc/view/filebrowser.htm
Normal file
20
luci-app-advanced/luasrc/view/filebrowser.htm
Normal file
@ -0,0 +1,20 @@
|
||||
<%+header%>
|
||||
|
||||
<link rel="stylesheet" href="/luci-static/resources/fb/fb.css?v=@ver">
|
||||
<h2 name="content">文件管理</h2>
|
||||
<fieldset class="cbi-section fb-container">
|
||||
<input id="current-path" type="text" class="current-path cbi-input-text" value="/"/>
|
||||
<div class="panel-container">
|
||||
<div class="panel-title">文件列表:</div>
|
||||
<button id="upload-toggle" class="upload-toggle cbi-button cbi-button-edit">上传</button>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
<button type="button" class="cbi-button cbi-input-apply">点我上传</button>
|
||||
</div>
|
||||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fb/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
26
luci-app-advanced/root/bin/ipmode4
Normal file
26
luci-app-advanced/root/bin/ipmode4
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
uci set network.@globals[0].ula_prefix=''
|
||||
uci set network.lan.delegate='0'
|
||||
uci set network.wan.mtu=1460
|
||||
uci set network.wan.metric='41'
|
||||
uci set network.wan.delegate='0'
|
||||
uci set network.wan.ipv6='0'
|
||||
uci commit network
|
||||
uci set dhcp.@dnsmasq[0].cachesize='15000'
|
||||
uci set dhcp.@dnsmasq[0].min_ttl='3600'
|
||||
uci set dhcp.@dnsmasq[0].filter_aaaa='1'
|
||||
uci set dhcp.@dnsmasq[0].localservice='0'
|
||||
uci set dhcp.@dnsmasq[0].nonwildcard='0'
|
||||
uci set dhcp.@dnsmasq[0].rebind_protection='0'
|
||||
uci set dhcp.@dnsmasq[0].noresolv='0'
|
||||
uci set dhcp.lan.ra=''
|
||||
uci set dhcp.lan.ndp=''
|
||||
uci set dhcp.lan.dhcpv6=''
|
||||
uci set dhcp.lan.ignore='0'
|
||||
uci set dhcp.lan.ra_management='1'
|
||||
uci set dhcp.lan.ra_default='1'
|
||||
uci set dhcp.lan.force='1'
|
||||
uci commit dhcp
|
||||
sed -i "/list server/d" /etc/config/dhcp
|
||||
/etc/init.d/network restart
|
||||
/etc/init.d/dnsmasq restart
|
27
luci-app-advanced/root/bin/ipmode6
Normal file
27
luci-app-advanced/root/bin/ipmode6
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set dhcp.@dnsmasq[0].cachesize='15000'
|
||||
uci set dhcp.@dnsmasq[0].min_ttl='3600'
|
||||
uci set dhcp.@dnsmasq[0].filter_aaaa='0'
|
||||
uci set dhcp.@dnsmasq[0].localservice='0'
|
||||
uci set dhcp.@dnsmasq[0].nonwildcard='0'
|
||||
uci set dhcp.@dnsmasq[0].rebind_protection='0'
|
||||
uci set dhcp.@dnsmasq[0].noresolv='1'
|
||||
uci set dhcp.lan.ra='server'
|
||||
uci set dhcp.lan.ndp=''
|
||||
uci set dhcp.lan.dhcpv6=''
|
||||
uci set dhcp.lan.ignore='0'
|
||||
uci set dhcp.lan.ra_management='1'
|
||||
uci set dhcp.lan.ra_default='1'
|
||||
uci set dhcp.lan.force='1'
|
||||
uci commit dhcp
|
||||
uci set network.@globals[0].ula_prefix=''
|
||||
uci set network.lan.delegate='0'
|
||||
uci set network.wan.mtu=1460
|
||||
uci set network.wan.metric='41'
|
||||
uci set network.wan.delegate='0'
|
||||
uci set network.wan.ipv6='auto'
|
||||
uci commit network
|
||||
sed -i "/list server/d" /etc/config/dhcp
|
||||
/etc/init.d/network restart
|
||||
/etc/init.d/dnsmasq restart
|
30
luci-app-advanced/root/bin/normalmode
Normal file
30
luci-app-advanced/root/bin/normalmode
Normal file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci set system.@system[0].hostname="Openwrt"
|
||||
uci commit
|
||||
|
||||
cat > /etc/config/network <<EOF
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'lan'
|
||||
option type 'bridge'
|
||||
option proto 'static'
|
||||
option ipaddr '192.168.1.1'
|
||||
option netmask '255.255.255.0'
|
||||
option ifname 'eth0 eth2 eth3'
|
||||
|
||||
config interface 'wan'
|
||||
option ifname 'eth1'
|
||||
option proto 'dhcp'
|
||||
option hostname 'Openwrt'
|
||||
EOF
|
||||
|
||||
sed -i '/REDIRECT --to-ports 53/d' /etc/firewall.user
|
||||
sed -i '/MASQUERADE/d' /etc/firewall.user
|
||||
echo "iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53" >> /etc/firewall.user
|
||||
echo "iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53" >> /etc/firewall.user
|
||||
reboot
|
80
luci-app-advanced/root/bin/nuc
Normal file
80
luci-app-advanced/root/bin/nuc
Normal file
@ -0,0 +1,80 @@
|
||||
#!/bin/sh
|
||||
ip=/usr/sbin/ip
|
||||
vconfig=/sbin/vconfig
|
||||
ifconfig=/sbin/ifconfig
|
||||
|
||||
uci set system.@system[0].hostname="Openwrt"
|
||||
uci commit
|
||||
cat > /etc/config/network <<EOF
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'lan'
|
||||
option type 'bridge'
|
||||
option ifname 'eth0 eth1 eth2 eth3 eth4 eth5 eth0.12 eth0.13 eth0.14 eth0.15 eth0.16 eth0.17 eth0.18'
|
||||
option proto 'static'
|
||||
option ipaddr '192.168.1.2'
|
||||
option netmask '255.255.255.0'
|
||||
option gateway '192.168.1.1'
|
||||
option dns '223.5.5.5'
|
||||
|
||||
config interface 'wan'
|
||||
option ifname 'eth0.11'
|
||||
option proto 'dhcp'
|
||||
option hostname 'Openwrt'
|
||||
EOF
|
||||
|
||||
#for eth1
|
||||
$ip link add link eth0 eth0.11 type vlan proto 802.1ad id 11
|
||||
$ifconfig eth0.11 hw ether 58:b0:35:86:cf:11
|
||||
$vconfig set_flag eth0.11 1 1
|
||||
$ifconfig eth0.11 up
|
||||
|
||||
#for eth2
|
||||
$ip link add link eth0 eth0.12 type vlan proto 802.1ad id 12
|
||||
$ifconfig eth0.12 hw ether 58:b0:35:86:cf:12
|
||||
$vconfig set_flag eth0.12 1 2
|
||||
$ifconfig eth0.12 up
|
||||
|
||||
#for eth3
|
||||
$ip link add link eth0 eth0.13 type vlan proto 802.1ad id 13
|
||||
$ifconfig eth0.13 hw ether 58:b0:35:86:cf:13
|
||||
$vconfig set_flag eth0.13 1 3
|
||||
$ifconfig eth0.13 up
|
||||
|
||||
#for eth4
|
||||
$ip link add link eth0 eth0.14 type vlan proto 802.1ad id 14
|
||||
$ifconfig eth0.14 hw ether 58:b0:35:86:cf:14
|
||||
$vconfig set_flag eth0.14 1 3
|
||||
$ifconfig eth0.14 up
|
||||
|
||||
#for eth5
|
||||
$ip link add link eth0 eth0.15 type vlan proto 802.1ad id 15
|
||||
$ifconfig eth0.15 hw ether 58:b0:35:86:cf:15
|
||||
$vconfig set_flag eth0.15 1 3
|
||||
$ifconfig eth0.15 up
|
||||
|
||||
#for eth6
|
||||
$ip link add link eth0 eth0.16 type vlan proto 802.1ad id 16
|
||||
$ifconfig eth0.16 hw ether 58:b0:35:86:cf:16
|
||||
$vconfig set_flag eth0.16 1 3
|
||||
$ifconfig eth0.16 up
|
||||
|
||||
#for eth7
|
||||
$ip link add link eth0 eth0.17 type vlan proto 802.1ad id 17
|
||||
$ifconfig eth0.17 hw ether 58:b0:35:86:cf:17
|
||||
$vconfig set_flag eth0.17 1 3
|
||||
$ifconfig eth0.17 up
|
||||
|
||||
#for eth8
|
||||
$ip link add link eth0 eth0.18 type vlan proto 802.1ad id 18
|
||||
$ifconfig eth0.18 hw ether 58:b0:35:86:cf:18
|
||||
$vconfig set_flag eth0.18 1 3
|
||||
$ifconfig eth0.18 up
|
||||
|
||||
sed -i '/MASQUERADE/d' /etc/firewall.user
|
||||
echo "iptables -t nat -I POSTROUTING -j MASQUERADE" >> /etc/firewall.user
|
||||
reboot
|
2
luci-app-advanced/root/etc/config/advanced
Normal file
2
luci-app-advanced/root/etc/config/advanced
Normal file
@ -0,0 +1,2 @@
|
||||
config advanced
|
||||
option enabled '1'
|
7
luci-app-advanced/root/etc/uci-defaults/40_luci-fb
Normal file
7
luci-app-advanced/root/etc/uci-defaults/40_luci-fb
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
ver=$(date +%s)
|
||||
sed -i "s/@ver/$ver/g" /usr/lib/lua/luci/view/filebrowser.htm
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-advanced": {
|
||||
"description": "Grant UCI access for luci-app-advanced",
|
||||
"read": {
|
||||
"uci": [ "advanced" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "advanced" ]
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit 560350b1cb330d1cd1b7f6b72ecef63ff4ea093e
|
21
luci-app-aliddns/LICENSE
Normal file
21
luci-app-aliddns/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 chenhw2
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
84
luci-app-aliddns/Makefile
Normal file
84
luci-app-aliddns/Makefile
Normal file
@ -0,0 +1,84 @@
|
||||
#
|
||||
# Copyright (C) 2018-2021 chenhw2 <https://github.com/chenhw2/>
|
||||
#
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-aliddns
|
||||
PKG_VERSION:=0.4.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=chenhw2 <https://github.com/chenhw2/>
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-aliddns
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI Support for aliddns
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+openssl-util +curl
|
||||
endef
|
||||
|
||||
define Package/luci-app-aliddns/description
|
||||
LuCI Support for ALiDDNS.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \
|
||||
po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/luci-app-aliddns/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
if [ -f /etc/uci-defaults/luci-aliddns ]; then
|
||||
( . /etc/uci-defaults/luci-aliddns ) && \
|
||||
rm -f /etc/uci-defaults/luci-aliddns
|
||||
fi
|
||||
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/luci-app-aliddns/prerm
|
||||
#!/bin/sh
|
||||
/etc/init.d/aliddns stop
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/luci-app-aliddns/conffiles
|
||||
/etc/config/aliddns
|
||||
endef
|
||||
|
||||
define Package/luci-app-aliddns/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/aliddns.*.lmo $(1)/usr/lib/lua/luci/i18n/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./files/luci/controller/*.lua $(1)/usr/lib/lua/luci/controller/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/aliddns
|
||||
$(INSTALL_DATA) ./files/luci/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/root/etc/config/aliddns $(1)/etc/config/aliddns
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/root/etc/init.d/aliddns $(1)/etc/init.d/aliddns
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/root/etc/uci-defaults/luci-aliddns $(1)/etc/uci-defaults/luci-aliddns
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/root/usr/sbin/aliddns $(1)/usr/sbin/aliddns
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-aliddns))
|
68
luci-app-aliddns/README.md
Normal file
68
luci-app-aliddns/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
# luci-app-aliddns
|
||||
LEDE/OpenWrt LuCI for AliDDNS
|
||||
===
|
||||
|
||||
简介
|
||||
---
|
||||
|
||||
本软件包是 AliDDNS 的 LuCI 控制界面,
|
||||
|
||||
软件包文件结构:
|
||||
```
|
||||
/
|
||||
├── etc/
|
||||
│ ├── config/
|
||||
│ │ └── aliddns // UCI 配置文件
|
||||
│ │── init.d/
|
||||
│ │ └── aliddns // init 脚本
|
||||
│ └── uci-defaults/
|
||||
│ └── luci-aliddns // uci-defaults 脚本
|
||||
└── usr/
|
||||
├── sbin/
|
||||
│ └── aliddns // 主程序
|
||||
└── lib/
|
||||
└── lua/
|
||||
└── luci/ // LuCI 部分
|
||||
├── controller/
|
||||
│ └── aliddns.lua // LuCI 菜单配置
|
||||
├── i18n/ // LuCI 语言文件目录
|
||||
│ └── aliddns.zh-cn.lmo
|
||||
└── model/
|
||||
└── cbi/
|
||||
└── aliddns.lua // LuCI 基本设置
|
||||
```
|
||||
|
||||
依赖
|
||||
---
|
||||
|
||||
软件包的正常使用需要依赖 `openssl-util` 和 `curl`.
|
||||
|
||||
配置
|
||||
---
|
||||
|
||||
软件包的配置文件路径: `/etc/config/aliddns`
|
||||
此文件为 UCI 配置文件, 配置方式可参考 [Wiki][uci]
|
||||
|
||||
编译
|
||||
---
|
||||
|
||||
从 LEDE 的 [SDK][lede-sdk] 编译
|
||||
```bash
|
||||
# 解压下载好的 SDK
|
||||
tar axvf lede-sdk-17.01.*-ar71xx-generic_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz
|
||||
cd lede-sdk-17.01.*-ar71xx-*
|
||||
# Clone 项目
|
||||
mkdir -p package/feeds
|
||||
git clone https://github.com/chenhw2/luci-app-aliddns.git package/feeds/luci-app-aliddns
|
||||
# 编译 po2lmo (如果有po2lmo可跳过)
|
||||
pushd package/feeds/luci-app-aliddns/tools/po2lmo
|
||||
make && sudo make install
|
||||
popd
|
||||
# 选择要编译的包 LuCI -> 3. Applications
|
||||
make menuconfig
|
||||
# 开始编译
|
||||
make package/feeds/luci-app-aliddns/compile V=s
|
||||
```
|
||||
|
||||
[lede-sdk]: https://lede-project.org/docs/guide-developer/compile_packages_for_lede_with_the_sdk
|
||||
[uci]: https://lede-project.org/docs/user-guide/introduction_to_lede_configuration
|
4
luci-app-aliddns/files/luci/controller/aliddns.lua
Normal file
4
luci-app-aliddns/files/luci/controller/aliddns.lua
Normal file
@ -0,0 +1,4 @@
|
||||
module("luci.controller.aliddns",package.seeall)
|
||||
function index()
|
||||
entry({"admin","services","aliddns"},cbi("aliddns"),_("AliDDNS"),58)
|
||||
end
|
56
luci-app-aliddns/files/luci/i18n/aliddns.zh-cn.po
Normal file
56
luci-app-aliddns/files/luci/i18n/aliddns.zh-cn.po
Normal file
@ -0,0 +1,56 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "AliDDNS"
|
||||
msgstr "阿里DDNS"
|
||||
|
||||
msgid "enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Clean Before Update"
|
||||
msgstr "清除所有同名记录"
|
||||
|
||||
msgid "Enabled IPv6"
|
||||
msgstr "启用 IPv6"
|
||||
|
||||
msgid "Base"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "WAN-IP Source"
|
||||
msgstr "WAN-IP来源"
|
||||
|
||||
msgid "Select WAN-IP Source"
|
||||
msgstr "选择WAN-IP来源"
|
||||
|
||||
msgid "Select the WAN-IP Source for AliDDNS, like wan/internet"
|
||||
msgstr "动态域名的IP来源,如wan/internet"
|
||||
|
||||
msgid "WAN6-IP Source"
|
||||
msgstr "WAN6-IP来源"
|
||||
|
||||
msgid "Select WAN6-IP Source"
|
||||
msgstr "选择WAN6-IP来源"
|
||||
|
||||
msgid "Select the WAN6-IP Source for AliDDNS, like wan6/internet"
|
||||
msgstr "动态域名的IPv6来源,如wan6/internet"
|
||||
|
||||
msgid "Main Domain"
|
||||
msgstr "主域名"
|
||||
|
||||
msgid "Sub Domain"
|
||||
msgstr "子域名"
|
||||
|
||||
msgid "For example: test.github.com -> github.com"
|
||||
msgstr "例如: test.github.com 则填: github.com"
|
||||
|
||||
msgid "For example: test.github.com -> test"
|
||||
msgstr "例如: test.github.com, 则填: test"
|
||||
|
||||
msgid "Inspection Time"
|
||||
msgstr "检查时间"
|
||||
|
||||
msgid "Unit: Minute, Range: 1-59"
|
||||
msgstr "域名检查间隔时间,单位分钟,范围1-59"
|
||||
|
||||
msgid "Update Log"
|
||||
msgstr "更新记录"
|
71
luci-app-aliddns/files/luci/model/cbi/aliddns.lua
Normal file
71
luci-app-aliddns/files/luci/model/cbi/aliddns.lua
Normal file
@ -0,0 +1,71 @@
|
||||
local a = require"luci.sys"
|
||||
local e = luci.model.uci.cursor()
|
||||
local e = require"nixio.fs"
|
||||
require("luci.sys")
|
||||
local t, e ,o
|
||||
|
||||
t = Map("aliddns", translate("AliDDNS"))
|
||||
|
||||
e = t:section(TypedSection, "base", translate("Base"))
|
||||
e.anonymous = true
|
||||
|
||||
enable = e:option(Flag, "enable", translate("enable"))
|
||||
enable.rmempty = false
|
||||
|
||||
enable = e:option(Flag, "clean", translate("Clean Before Update"))
|
||||
enable.rmempty = false
|
||||
|
||||
ipv6 = e:option(Flag,"ipv6",translate("Enabled IPv6"))
|
||||
ipv6.rmempty=false
|
||||
|
||||
token = e:option(Value, "app_key", translate("Access Key ID"))
|
||||
|
||||
email = e:option(Value, "app_secret", translate("Access Key Secret"))
|
||||
|
||||
iface = e:option(ListValue, "interface", translate("WAN-IP Source"), translate("Select the WAN-IP Source for AliDDNS, like wan/internet"))
|
||||
iface:value("", translate("Select WAN-IP Source"))
|
||||
iface:value("internet")
|
||||
iface:value("wan")
|
||||
iface.rmempty = false
|
||||
|
||||
iface6 = e:option(ListValue, "interface6", translate("WAN6-IP Source"),translate("Select the WAN6-IP Source for AliDDNS, like wan6/internet"))
|
||||
iface6:value("",translate("Select WAN6-IP Source"))
|
||||
iface6:value("internet")
|
||||
iface6:value("wan")
|
||||
iface6:value("wan6")
|
||||
iface6.rmempty = true
|
||||
|
||||
main = e:option(Value, "main_domain", translate("Main Domain"), translate("For example: test.github.com -> github.com"))
|
||||
main.rmempty = false
|
||||
|
||||
sub = e:option(Value, "sub_domain", translate("Sub Domain"), translate("For example: test.github.com -> test"))
|
||||
sub.rmempty = false
|
||||
|
||||
time = e:option(Value, "time", translate("Inspection Time"), translate("Unit: Minute, Range: 1-59"))
|
||||
time.rmempty = false
|
||||
|
||||
e = t:section(TypedSection, "base", translate("Update Log"))
|
||||
e.anonymous = true
|
||||
local a = "/var/log/aliddns.log"
|
||||
tvlog = e:option(TextValue,"sylogtext")
|
||||
tvlog.rows = 16
|
||||
tvlog.readonly = "readonly"
|
||||
tvlog.wrap = "off"
|
||||
|
||||
function tvlog.cfgvalue(e,e)
|
||||
sylogtext = ""
|
||||
if a and nixio.fs.access(a) then
|
||||
sylogtext = luci.sys.exec("tail -n 100 %s"%a)
|
||||
end
|
||||
return sylogtext
|
||||
end
|
||||
|
||||
tvlog.write = function(e,e,e)
|
||||
end
|
||||
|
||||
local e = luci.http.formvalue("cbi.apply")
|
||||
if e then
|
||||
io.popen("/etc/init.d/aliddns restart")
|
||||
end
|
||||
|
||||
return t
|
4
luci-app-aliddns/files/root/etc/config/aliddns
Normal file
4
luci-app-aliddns/files/root/etc/config/aliddns
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
config base 'base'
|
||||
option enable '0'
|
||||
option time '10'
|
78
luci-app-aliddns/files/root/etc/init.d/aliddns
Normal file
78
luci-app-aliddns/files/root/etc/init.d/aliddns
Normal file
@ -0,0 +1,78 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=80
|
||||
NAME=aliddns
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Service status"
|
||||
|
||||
NE_TIPS='AliDDNS NOT ENABLED'
|
||||
|
||||
restart() {
|
||||
start
|
||||
}
|
||||
|
||||
uci_get_by_name() {
|
||||
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
uci_bool_by_name() {
|
||||
case "$(uci_get_by_name $1 $2)" in
|
||||
1|on|true|yes|enabled) return 0;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
add_hotplug() {
|
||||
cat <<EOF > "/etc/hotplug.d/iface/${START}-${NAME}"
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
[ "Z\$ACTION" = "Zifup" -a "Z\$INTERFACE" = "Zwan" ] || exit 0
|
||||
|
||||
DATE=\$(date +'%Y-%m-%d %H:%M:%S')
|
||||
( sleep 10 && ( echo "\$DATE IFUP-WAN" && /usr/sbin/aliddns ) >> /var/log/aliddns.log 2>&1 ) &
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x "/etc/hotplug.d/iface/${START}-${NAME}"
|
||||
}
|
||||
|
||||
start() {
|
||||
$(uci_bool_by_name base enable) || {
|
||||
stop
|
||||
return 0
|
||||
}
|
||||
|
||||
add_hotplug
|
||||
|
||||
sed -i "/${NE_TIPS}/d" /var/log/aliddns.log
|
||||
|
||||
time=$(uci_get_by_name base time 10)
|
||||
[ 0 -lt $time -a $time -lt 60 ] || time=10
|
||||
|
||||
[ -f /etc/crontabs/root ] || mkdir -p /etc/crontabs && touch /etc/crontabs/root
|
||||
sed -i '/aliddns/d' /etc/crontabs/root
|
||||
echo "*/$time * * * * /usr/sbin/aliddns >> /var/log/aliddns.log 2>&1" >> /etc/crontabs/root
|
||||
if [ "$(/etc/init.d/cron status)" = "running" ]; then
|
||||
/etc/init.d/cron reload
|
||||
fi
|
||||
|
||||
( /usr/sbin/aliddns >> /var/log/aliddns.log 2>&1 ) &
|
||||
}
|
||||
|
||||
stop() {
|
||||
rm -rf "/etc/hotplug.d/iface/${START}-${NAME}"
|
||||
sed -i '/aliddns/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
if [ "$(/etc/init.d/cron status)" = "running" ]; then
|
||||
/etc/init.d/cron reload
|
||||
fi
|
||||
echo "${NE_TIPS}" > /var/log/aliddns.log
|
||||
}
|
||||
|
||||
status() {
|
||||
if [ "$(/etc/init.d/cron status)" != "running" ]; then
|
||||
echo "inactive" && false
|
||||
else
|
||||
grep -q aliddns /etc/crontabs/root && echo "running" || echo "inactive" && false
|
||||
fi
|
||||
}
|
10
luci-app-aliddns/files/root/etc/uci-defaults/luci-aliddns
Normal file
10
luci-app-aliddns/files/root/etc/uci-defaults/luci-aliddns
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@aliddns[-1]
|
||||
add ucitrack aliddns
|
||||
set ucitrack.@aliddns[-1].init=aliddns
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
exit 0
|
286
luci-app-aliddns/files/root/usr/sbin/aliddns
Executable file
286
luci-app-aliddns/files/root/usr/sbin/aliddns
Executable file
@ -0,0 +1,286 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME=aliddns
|
||||
log_file=/var/log/$NAME.log
|
||||
|
||||
uci_get_by_name() {
|
||||
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
|
||||
uci_bool_by_name() {
|
||||
case "$(uci_get_by_name $1 $2)" in
|
||||
1|on|true|yes|enabled) return 0;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
intelnetip() {
|
||||
tmp_ip=`curl -sL --connect-timeout 3 members.3322.org/dyndns/getip`
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 api-ipv4.ip.sb/ip`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 v4.myip.la`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 whatismyip.akamai.com`
|
||||
fi
|
||||
echo -n $tmp_ip
|
||||
}
|
||||
|
||||
intelnetip6() {
|
||||
tmp_ip6=`curl -sL --connect-timeout 3 ipv6.whatismyip.akamai.com`
|
||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||
tmp_ip6=`curl -sL --connect-timeout 3 speed.neu6.edu.cn/getIP.php`
|
||||
fi
|
||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||
tmp_ip6=`curl -sL --connect-timeout 3 v6.ident.me`
|
||||
fi
|
||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||
tmp_ip6=`curl -sL --connect-timeout 3 api-ipv6.ip.sb/ip`
|
||||
fi
|
||||
echo -n $tmp_ip6
|
||||
}
|
||||
|
||||
resolve2ip() {
|
||||
# resolve2ip domain<string>
|
||||
domain=$1
|
||||
tmp_ip=`nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | tail -n1`
|
||||
fi
|
||||
if [ "Z$tmp_ip" == "Z" ]; then
|
||||
tmp_ip=`curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain"`
|
||||
fi
|
||||
echo -n $tmp_ip
|
||||
}
|
||||
|
||||
resolve2ip6() {
|
||||
# resolve2ip6 domain<string>
|
||||
domain=$1
|
||||
tmp_ip6=`nslookup $domain ns1.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1`
|
||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||
tmp_ip6=`nslookup $domain ns2.alidns.com 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1`
|
||||
fi
|
||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||
tmp_ip6=`nslookup $domain 114.114.115.115 2>/dev/null | sed '/^Server/d; /#53$/d' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})' | tail -n1`
|
||||
fi
|
||||
if [ "Z$tmp_ip6" == "Z" ]; then
|
||||
tmp_ip6=`curl -sL --connect-timeout 3 "119.29.29.29/d?dn=$domain&type=AAAA"`
|
||||
fi
|
||||
echo -n $tmp_ip6
|
||||
}
|
||||
|
||||
check_aliddns() {
|
||||
echo "$DATE WAN-IP: ${ip}"
|
||||
if [ "Z$ip" == "Z" ]; then
|
||||
echo "$DATE ERROR, cant get WAN-IP..."
|
||||
return 0
|
||||
fi
|
||||
current_ip=$(resolve2ip "$dm_real")
|
||||
if [ "Z$current_ip" == "Z" ]; then
|
||||
rrid='' # NO Resolve IP Means new Record_ID
|
||||
fi
|
||||
echo "$DATE DOMAIN-IP: ${current_ip}"
|
||||
if [ "Z$ip" == "Z$current_ip" ]; then
|
||||
echo "$DATE IP dont need UPDATE..."
|
||||
return 0
|
||||
else
|
||||
echo "$DATE UPDATING..."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_aliddns6() {
|
||||
echo "$DATE WAN6-IP: ${ip6}"
|
||||
if [ "Z$ip6" == "Z" ]; then
|
||||
echo "$DATE ERROR, cant get WAN6-IP..."
|
||||
return 0
|
||||
fi
|
||||
current_ip6=$(resolve2ip6 "$dm_real")
|
||||
|
||||
#urlencode current_ip6
|
||||
current_ip6_urlencode=$(urlencode "$current_ip6")
|
||||
if [ "Z$current_ip6_urlencode" == "Z" ]; then
|
||||
rrid6='' # NO Resolve IP Means new Record_ID
|
||||
fi
|
||||
echo "$DATE DOMAIN-IP6: ${current_ip6_urlencode}"
|
||||
if [ "Z$ip6" == "Z$current_ip6_urlencode" ]; then
|
||||
echo "$DATE IPv6 dont need UPDATE..."
|
||||
return 0
|
||||
else
|
||||
echo "$DATE UPDATING AAAA..."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
urlencode() {
|
||||
# urlencode url<string>
|
||||
out=''
|
||||
for c in $(echo -n $1 | sed 's/[^\n]/&\n/g'); do
|
||||
case $c in
|
||||
[a-zA-Z0-9._-]) out="$out$c" ;;
|
||||
*) out="$out$(printf '%%%02X' "'$c")" ;;
|
||||
esac
|
||||
done
|
||||
echo -n $out
|
||||
}
|
||||
|
||||
send_request() {
|
||||
# send_request action<string> args<string>
|
||||
local args="AccessKeyId=$ak_id&Action=$1&Format=json&$2&Version=2015-01-09"
|
||||
local hash=$(urlencode $(echo -n "GET&%2F&$(urlencode $args)" | openssl dgst -sha1 -hmac "$ak_sec&" -binary | openssl base64))
|
||||
curl -sSL --connect-timeout 10 "http://alidns.aliyuncs.com/?$args&Signature=$hash"
|
||||
}
|
||||
|
||||
get_recordid() {
|
||||
sed 's/RR/\n/g' | sed -n 's/.*RecordId[^0-9]*\([0-9]*\).*/\1\n/p' | sort -ru | sed /^$/d
|
||||
}
|
||||
|
||||
query_recordid() {
|
||||
send_request "DescribeSubDomainRecords" "SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&SubDomain=$dm_escape&Timestamp=$timestamp&Type=A"
|
||||
}
|
||||
|
||||
query_recordid6() {
|
||||
send_request "DescribeSubDomainRecords" "SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&SubDomain=$dm_escape&Timestamp=$timestamp&Type=AAAA"
|
||||
}
|
||||
|
||||
update_record() {
|
||||
send_request "UpdateDomainRecord" "RR=$sub_dm_escape&RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip"
|
||||
}
|
||||
|
||||
add_record() {
|
||||
send_request "AddDomainRecord&DomainName=$main_dm" "RR=$sub_dm_escape&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=A&Value=$ip"
|
||||
}
|
||||
|
||||
update_record6() {
|
||||
send_request "UpdateDomainRecord" "RR=$sub_dm_escape&RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=AAAA&Value=$ip6_escape"
|
||||
}
|
||||
|
||||
add_record6() {
|
||||
send_request "AddDomainRecord&DomainName=$main_dm" "RR=$sub_dm_escape&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp&Type=AAAA&Value=$ip6_escape"
|
||||
}
|
||||
|
||||
del_record() {
|
||||
send_request "DeleteDomainRecord" "RecordId=$1&SignatureMethod=HMAC-SHA1&SignatureNonce=$timestamp&SignatureVersion=1.0&Timestamp=$timestamp"
|
||||
}
|
||||
|
||||
do_ddns_record() {
|
||||
if uci_bool_by_name base clean ; then
|
||||
query_recordid | get_recordid | while read rr; do
|
||||
echo "$DATE Clean record $dm_show: $rr"
|
||||
del_record $rr >/dev/null
|
||||
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
||||
done
|
||||
rrid=''
|
||||
fi
|
||||
if [ "Z$rrid" == "Z" ]; then
|
||||
rrid=`query_recordid | get_recordid`
|
||||
fi
|
||||
if [ "Z$rrid" == "Z" ]; then
|
||||
rrid=`add_record | get_recordid`
|
||||
echo "$DATE ADD record $rrid"
|
||||
else
|
||||
update_record $rrid >/dev/null 2>&1
|
||||
echo "$DATE UPDATE record $rrid"
|
||||
fi
|
||||
if [ "Z$rrid" == "Z" ]; then
|
||||
# failed
|
||||
echo "$DATE # ERROR, Please Check Config/Time"
|
||||
else
|
||||
# save rrid
|
||||
uci set aliddns.base.record_id=$rrid
|
||||
uci commit aliddns
|
||||
echo "$DATE # UPDATED($ip)"
|
||||
fi
|
||||
}
|
||||
|
||||
do_ddns_record6() {
|
||||
if uci_bool_by_name base clean ; then
|
||||
query_recordid6 | get_recordid | while read rr; do
|
||||
echo "$DATE Clean record $dm_show: $rr"
|
||||
del_record $rr >/dev/null
|
||||
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
||||
done
|
||||
rrid6=''
|
||||
fi
|
||||
if [ "Z$rrid6" == "Z" ]; then
|
||||
rrid6=`query_recordid6 | get_recordid`
|
||||
fi
|
||||
if [ "Z$rrid6" == "Z" ]; then
|
||||
rrid6=`add_record6 | get_recordid`
|
||||
echo "$DATE ADD record $rrid6"
|
||||
else
|
||||
update_record6 $rrid6 >/dev/null 2>&1
|
||||
echo "$DATE UPDATE record $rrid6"
|
||||
fi
|
||||
if [ "Z$rrid6" == "Z" ]; then
|
||||
# failed
|
||||
echo "$DATE # ERROR, Please Check Config/Time"
|
||||
else
|
||||
# save rrid6
|
||||
uci set aliddns.base.record_id6=$rrid6
|
||||
uci commit aliddns
|
||||
echo "$DATE # UPDATED($ip6)"
|
||||
fi
|
||||
}
|
||||
|
||||
clean_log() {
|
||||
if [ $(cat $log_file 2>/dev/null | wc -l) -ge 16 ]; then
|
||||
rm -f $log_file && touch $log_file
|
||||
echo "$DATE Log Cleaned"
|
||||
fi
|
||||
}
|
||||
|
||||
[ -x /usr/bin/openssl -a -x /usr/bin/curl -a -x /bin/sed ] || {
|
||||
echo "Need [ openssl + curl + sed ]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ak_id=$(uci_get_by_name base app_key)
|
||||
ak_sec=$(uci_get_by_name base app_secret)
|
||||
rrid=$(uci_get_by_name base record_id)
|
||||
rrid6=$(uci_get_by_name base record_id6)
|
||||
main_dm=$(uci_get_by_name base main_domain)
|
||||
sub_dm=$(uci_get_by_name base sub_domain)
|
||||
|
||||
if [ "Z$sub_dm" == "Z@" -o "Z$sub_dm" == "Z" ]; then
|
||||
dm_real="$main_dm"
|
||||
else
|
||||
dm_real="$sub_dm.$main_dm"
|
||||
fi
|
||||
dm_show="$sub_dm.$main_dm"
|
||||
dm_escape=`urlencode "$sub_dm.$main_dm"`
|
||||
sub_dm_escape=`urlencode "$sub_dm"`
|
||||
|
||||
iface=$(uci_get_by_name base interface)
|
||||
if [ "Z$iface" == "Zinternet" -o "Z$iface" == "Z" ]; then
|
||||
ip=$(intelnetip)
|
||||
else
|
||||
ip=$(ubus call network.interface.$iface status | grep '"address"' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
|
||||
fi
|
||||
|
||||
DATE=$(date +'%Y-%m-%d %H:%M:%S')
|
||||
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")
|
||||
|
||||
clean_log
|
||||
check_aliddns || do_ddns_record
|
||||
|
||||
# exit if ipv6 not-enabled
|
||||
uci_bool_by_name base ipv6 || exit 0
|
||||
|
||||
iface6=$(uci_get_by_name base interface6)
|
||||
if [ "Z$iface6" == "Zinternet" -o "Z$iface6" == "Z" ]; then
|
||||
ip6=$(intelnetip6)
|
||||
else
|
||||
ip6=$(ubus call network.interface.$iface6 status | grep '"address"' | grep -oE '([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){4})' | head -1)
|
||||
fi
|
||||
ip6_escape=`urlencode "$ip6"`
|
||||
|
||||
clean_log
|
||||
check_aliddns6 || do_ddns_record6
|
12
luci-app-aliddns/tools/po2lmo/Makefile
Normal file
12
luci-app-aliddns/tools/po2lmo/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
INSTALL = install
|
||||
PREFIX = /usr/bin
|
||||
|
||||
po2lmo: src/po2lmo.o src/template_lmo.o
|
||||
$(CC) $(LDFLAGS) -o src/po2lmo src/po2lmo.o src/template_lmo.o
|
||||
|
||||
install:
|
||||
$(INSTALL) -m 755 src/po2lmo $(PREFIX)
|
||||
|
||||
clean:
|
||||
$(RM) src/po2lmo src/*.o
|
247
luci-app-aliddns/tools/po2lmo/src/po2lmo.c
Normal file
247
luci-app-aliddns/tools/po2lmo/src/po2lmo.c
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* lmo - Lua Machine Objects - PO to LMO conversion tool
|
||||
*
|
||||
* Copyright (C) 2009-2012 Jo-Philipp Wich <xm@subsignal.org>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "template_lmo.h"
|
||||
|
||||
static void die(const char *msg)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s input.po output.lmo\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void print(const void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
{
|
||||
if( fwrite(ptr, size, nmemb, stream) == 0 )
|
||||
die("Failed to write stdout");
|
||||
}
|
||||
|
||||
static int extract_string(const char *src, char *dest, int len)
|
||||
{
|
||||
int pos = 0;
|
||||
int esc = 0;
|
||||
int off = -1;
|
||||
|
||||
for( pos = 0; (pos < strlen(src)) && (pos < len); pos++ )
|
||||
{
|
||||
if( (off == -1) && (src[pos] == '"') )
|
||||
{
|
||||
off = pos + 1;
|
||||
}
|
||||
else if( off >= 0 )
|
||||
{
|
||||
if( esc == 1 )
|
||||
{
|
||||
switch (src[pos])
|
||||
{
|
||||
case '"':
|
||||
case '\\':
|
||||
off++;
|
||||
break;
|
||||
}
|
||||
dest[pos-off] = src[pos];
|
||||
esc = 0;
|
||||
}
|
||||
else if( src[pos] == '\\' )
|
||||
{
|
||||
dest[pos-off] = src[pos];
|
||||
esc = 1;
|
||||
}
|
||||
else if( src[pos] != '"' )
|
||||
{
|
||||
dest[pos-off] = src[pos];
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[pos-off] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (off > -1) ? strlen(dest) : -1;
|
||||
}
|
||||
|
||||
static int cmp_index(const void *a, const void *b)
|
||||
{
|
||||
uint32_t x = ((const lmo_entry_t *)a)->key_id;
|
||||
uint32_t y = ((const lmo_entry_t *)b)->key_id;
|
||||
|
||||
if (x < y)
|
||||
return -1;
|
||||
else if (x > y)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void print_uint32(uint32_t x, FILE *out)
|
||||
{
|
||||
uint32_t y = htonl(x);
|
||||
print(&y, sizeof(uint32_t), 1, out);
|
||||
}
|
||||
|
||||
static void print_index(void *array, int n, FILE *out)
|
||||
{
|
||||
lmo_entry_t *e;
|
||||
|
||||
qsort(array, n, sizeof(*e), cmp_index);
|
||||
|
||||
for (e = array; n > 0; n--, e++)
|
||||
{
|
||||
print_uint32(e->key_id, out);
|
||||
print_uint32(e->val_id, out);
|
||||
print_uint32(e->offset, out);
|
||||
print_uint32(e->length, out);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char line[4096];
|
||||
char key[4096];
|
||||
char val[4096];
|
||||
char tmp[4096];
|
||||
int state = 0;
|
||||
int offset = 0;
|
||||
int length = 0;
|
||||
int n_entries = 0;
|
||||
void *array = NULL;
|
||||
lmo_entry_t *entry = NULL;
|
||||
uint32_t key_id, val_id;
|
||||
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
|
||||
if( (argc != 3) || ((in = fopen(argv[1], "r")) == NULL) || ((out = fopen(argv[2], "w")) == NULL) )
|
||||
usage(argv[0]);
|
||||
|
||||
memset(line, 0, sizeof(key));
|
||||
memset(key, 0, sizeof(val));
|
||||
memset(val, 0, sizeof(val));
|
||||
|
||||
while( (NULL != fgets(line, sizeof(line), in)) || (state >= 2 && feof(in)) )
|
||||
{
|
||||
if( state == 0 && strstr(line, "msgid \"") == line )
|
||||
{
|
||||
switch(extract_string(line, key, sizeof(key)))
|
||||
{
|
||||
case -1:
|
||||
die("Syntax error in msgid");
|
||||
case 0:
|
||||
state = 1;
|
||||
break;
|
||||
default:
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
else if( state == 1 || state == 2 )
|
||||
{
|
||||
if( strstr(line, "msgstr \"") == line || state == 2 )
|
||||
{
|
||||
switch(extract_string(line, val, sizeof(val)))
|
||||
{
|
||||
case -1:
|
||||
state = 4;
|
||||
break;
|
||||
default:
|
||||
state = 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(extract_string(line, tmp, sizeof(tmp)))
|
||||
{
|
||||
case -1:
|
||||
state = 2;
|
||||
break;
|
||||
default:
|
||||
strcat(key, tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( state == 3 )
|
||||
{
|
||||
switch(extract_string(line, tmp, sizeof(tmp)))
|
||||
{
|
||||
case -1:
|
||||
state = 4;
|
||||
break;
|
||||
default:
|
||||
strcat(val, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if( state == 4 )
|
||||
{
|
||||
if( strlen(key) > 0 && strlen(val) > 0 )
|
||||
{
|
||||
key_id = sfh_hash(key, strlen(key));
|
||||
val_id = sfh_hash(val, strlen(val));
|
||||
|
||||
if( key_id != val_id )
|
||||
{
|
||||
n_entries++;
|
||||
array = realloc(array, n_entries * sizeof(lmo_entry_t));
|
||||
entry = (lmo_entry_t *)array + n_entries - 1;
|
||||
|
||||
if (!array)
|
||||
die("Out of memory");
|
||||
|
||||
entry->key_id = key_id;
|
||||
entry->val_id = val_id;
|
||||
entry->offset = offset;
|
||||
entry->length = strlen(val);
|
||||
|
||||
length = strlen(val) + ((4 - (strlen(val) % 4)) % 4);
|
||||
|
||||
print(val, length, 1, out);
|
||||
offset += length;
|
||||
}
|
||||
}
|
||||
|
||||
state = 0;
|
||||
memset(key, 0, sizeof(key));
|
||||
memset(val, 0, sizeof(val));
|
||||
}
|
||||
|
||||
memset(line, 0, sizeof(line));
|
||||
}
|
||||
|
||||
print_index(array, n_entries, out);
|
||||
|
||||
if( offset > 0 )
|
||||
{
|
||||
print_uint32(offset, out);
|
||||
fsync(fileno(out));
|
||||
fclose(out);
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(out);
|
||||
unlink(argv[2]);
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
return(0);
|
||||
}
|
328
luci-app-aliddns/tools/po2lmo/src/template_lmo.c
Normal file
328
luci-app-aliddns/tools/po2lmo/src/template_lmo.c
Normal file
@ -0,0 +1,328 @@
|
||||
/*
|
||||
* lmo - Lua Machine Objects - Base functions
|
||||
*
|
||||
* Copyright (C) 2009-2010 Jo-Philipp Wich <xm@subsignal.org>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "template_lmo.h"
|
||||
|
||||
/*
|
||||
* Hash function from http://www.azillionmonkeys.com/qed/hash.html
|
||||
* Copyright (C) 2004-2008 by Paul Hsieh
|
||||
*/
|
||||
|
||||
uint32_t sfh_hash(const char *data, int len)
|
||||
{
|
||||
uint32_t hash = len, tmp;
|
||||
int rem;
|
||||
|
||||
if (len <= 0 || data == NULL) return 0;
|
||||
|
||||
rem = len & 3;
|
||||
len >>= 2;
|
||||
|
||||
/* Main loop */
|
||||
for (;len > 0; len--) {
|
||||
hash += sfh_get16(data);
|
||||
tmp = (sfh_get16(data+2) << 11) ^ hash;
|
||||
hash = (hash << 16) ^ tmp;
|
||||
data += 2*sizeof(uint16_t);
|
||||
hash += hash >> 11;
|
||||
}
|
||||
|
||||
/* Handle end cases */
|
||||
switch (rem) {
|
||||
case 3: hash += sfh_get16(data);
|
||||
hash ^= hash << 16;
|
||||
hash ^= data[sizeof(uint16_t)] << 18;
|
||||
hash += hash >> 11;
|
||||
break;
|
||||
case 2: hash += sfh_get16(data);
|
||||
hash ^= hash << 11;
|
||||
hash += hash >> 17;
|
||||
break;
|
||||
case 1: hash += *data;
|
||||
hash ^= hash << 10;
|
||||
hash += hash >> 1;
|
||||
}
|
||||
|
||||
/* Force "avalanching" of final 127 bits */
|
||||
hash ^= hash << 3;
|
||||
hash += hash >> 5;
|
||||
hash ^= hash << 4;
|
||||
hash += hash >> 17;
|
||||
hash ^= hash << 25;
|
||||
hash += hash >> 6;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
uint32_t lmo_canon_hash(const char *str, int len)
|
||||
{
|
||||
char res[4096];
|
||||
char *ptr, prev;
|
||||
int off;
|
||||
|
||||
if (!str || len >= sizeof(res))
|
||||
return 0;
|
||||
|
||||
for (prev = ' ', ptr = res, off = 0; off < len; prev = *str, off++, str++)
|
||||
{
|
||||
if (isspace(*str))
|
||||
{
|
||||
if (!isspace(prev))
|
||||
*ptr++ = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
*ptr++ = *str;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ptr > res) && isspace(*(ptr-1)))
|
||||
ptr--;
|
||||
|
||||
return sfh_hash(res, ptr - res);
|
||||
}
|
||||
|
||||
lmo_archive_t * lmo_open(const char *file)
|
||||
{
|
||||
int in = -1;
|
||||
uint32_t idx_offset = 0;
|
||||
struct stat s;
|
||||
|
||||
lmo_archive_t *ar = NULL;
|
||||
|
||||
if (stat(file, &s) == -1)
|
||||
goto err;
|
||||
|
||||
if ((in = open(file, O_RDONLY)) == -1)
|
||||
goto err;
|
||||
|
||||
if ((ar = (lmo_archive_t *)malloc(sizeof(*ar))) != NULL)
|
||||
{
|
||||
memset(ar, 0, sizeof(*ar));
|
||||
|
||||
ar->fd = in;
|
||||
ar->size = s.st_size;
|
||||
|
||||
fcntl(ar->fd, F_SETFD, fcntl(ar->fd, F_GETFD) | FD_CLOEXEC);
|
||||
|
||||
if ((ar->mmap = mmap(NULL, ar->size, PROT_READ, MAP_SHARED, ar->fd, 0)) == MAP_FAILED)
|
||||
goto err;
|
||||
|
||||
idx_offset = ntohl(*((const uint32_t *)
|
||||
(ar->mmap + ar->size - sizeof(uint32_t))));
|
||||
|
||||
if (idx_offset >= ar->size)
|
||||
goto err;
|
||||
|
||||
ar->index = (lmo_entry_t *)(ar->mmap + idx_offset);
|
||||
ar->length = (ar->size - idx_offset - sizeof(uint32_t)) / sizeof(lmo_entry_t);
|
||||
ar->end = ar->mmap + ar->size;
|
||||
|
||||
return ar;
|
||||
}
|
||||
|
||||
err:
|
||||
if (in > -1)
|
||||
close(in);
|
||||
|
||||
if (ar != NULL)
|
||||
{
|
||||
if ((ar->mmap != NULL) && (ar->mmap != MAP_FAILED))
|
||||
munmap(ar->mmap, ar->size);
|
||||
|
||||
free(ar);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void lmo_close(lmo_archive_t *ar)
|
||||
{
|
||||
if (ar != NULL)
|
||||
{
|
||||
if ((ar->mmap != NULL) && (ar->mmap != MAP_FAILED))
|
||||
munmap(ar->mmap, ar->size);
|
||||
|
||||
close(ar->fd);
|
||||
free(ar);
|
||||
|
||||
ar = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lmo_catalog_t *_lmo_catalogs = NULL;
|
||||
lmo_catalog_t *_lmo_active_catalog = NULL;
|
||||
|
||||
int lmo_load_catalog(const char *lang, const char *dir)
|
||||
{
|
||||
DIR *dh = NULL;
|
||||
char pattern[16];
|
||||
char path[PATH_MAX];
|
||||
struct dirent *de = NULL;
|
||||
|
||||
lmo_archive_t *ar = NULL;
|
||||
lmo_catalog_t *cat = NULL;
|
||||
|
||||
if (!lmo_change_catalog(lang))
|
||||
return 0;
|
||||
|
||||
if (!dir || !(dh = opendir(dir)))
|
||||
goto err;
|
||||
|
||||
if (!(cat = malloc(sizeof(*cat))))
|
||||
goto err;
|
||||
|
||||
memset(cat, 0, sizeof(*cat));
|
||||
|
||||
snprintf(cat->lang, sizeof(cat->lang), "%s", lang);
|
||||
snprintf(pattern, sizeof(pattern), "*.%s.lmo", lang);
|
||||
|
||||
while ((de = readdir(dh)) != NULL)
|
||||
{
|
||||
if (!fnmatch(pattern, de->d_name, 0))
|
||||
{
|
||||
snprintf(path, sizeof(path), "%s/%s", dir, de->d_name);
|
||||
ar = lmo_open(path);
|
||||
|
||||
if (ar)
|
||||
{
|
||||
ar->next = cat->archives;
|
||||
cat->archives = ar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir(dh);
|
||||
|
||||
cat->next = _lmo_catalogs;
|
||||
_lmo_catalogs = cat;
|
||||
|
||||
if (!_lmo_active_catalog)
|
||||
_lmo_active_catalog = cat;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
if (dh) closedir(dh);
|
||||
if (cat) free(cat);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lmo_change_catalog(const char *lang)
|
||||
{
|
||||
lmo_catalog_t *cat;
|
||||
|
||||
for (cat = _lmo_catalogs; cat; cat = cat->next)
|
||||
{
|
||||
if (!strncmp(cat->lang, lang, sizeof(cat->lang)))
|
||||
{
|
||||
_lmo_active_catalog = cat;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static lmo_entry_t * lmo_find_entry(lmo_archive_t *ar, uint32_t hash)
|
||||
{
|
||||
unsigned int m, l, r;
|
||||
uint32_t k;
|
||||
|
||||
l = 0;
|
||||
r = ar->length - 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
m = l + ((r - l) / 2);
|
||||
|
||||
if (r < l)
|
||||
break;
|
||||
|
||||
k = ntohl(ar->index[m].key_id);
|
||||
|
||||
if (k == hash)
|
||||
return &ar->index[m];
|
||||
|
||||
if (k > hash)
|
||||
{
|
||||
if (!m)
|
||||
break;
|
||||
|
||||
r = m - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
l = m + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int lmo_translate(const char *key, int keylen, char **out, int *outlen)
|
||||
{
|
||||
uint32_t hash;
|
||||
lmo_entry_t *e;
|
||||
lmo_archive_t *ar;
|
||||
|
||||
if (!key || !_lmo_active_catalog)
|
||||
return -2;
|
||||
|
||||
hash = lmo_canon_hash(key, keylen);
|
||||
|
||||
for (ar = _lmo_active_catalog->archives; ar; ar = ar->next)
|
||||
{
|
||||
if ((e = lmo_find_entry(ar, hash)) != NULL)
|
||||
{
|
||||
*out = ar->mmap + ntohl(e->offset);
|
||||
*outlen = ntohl(e->length);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void lmo_close_catalog(const char *lang)
|
||||
{
|
||||
lmo_archive_t *ar, *next;
|
||||
lmo_catalog_t *cat, *prev;
|
||||
|
||||
for (prev = NULL, cat = _lmo_catalogs; cat; prev = cat, cat = cat->next)
|
||||
{
|
||||
if (!strncmp(cat->lang, lang, sizeof(cat->lang)))
|
||||
{
|
||||
if (prev)
|
||||
prev->next = cat->next;
|
||||
else
|
||||
_lmo_catalogs = cat->next;
|
||||
|
||||
for (ar = cat->archives; ar; ar = next)
|
||||
{
|
||||
next = ar->next;
|
||||
lmo_close(ar);
|
||||
}
|
||||
|
||||
free(cat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
92
luci-app-aliddns/tools/po2lmo/src/template_lmo.h
Normal file
92
luci-app-aliddns/tools/po2lmo/src/template_lmo.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* lmo - Lua Machine Objects - General header
|
||||
*
|
||||
* Copyright (C) 2009-2012 Jo-Philipp Wich <xm@subsignal.org>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _TEMPLATE_LMO_H_
|
||||
#define _TEMPLATE_LMO_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fnmatch.h>
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if (defined(__GNUC__) && defined(__i386__))
|
||||
#define sfh_get16(d) (*((const uint16_t *) (d)))
|
||||
#else
|
||||
#define sfh_get16(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
|
||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
||||
#endif
|
||||
|
||||
|
||||
struct lmo_entry {
|
||||
uint32_t key_id;
|
||||
uint32_t val_id;
|
||||
uint32_t offset;
|
||||
uint32_t length;
|
||||
} __attribute__((packed));
|
||||
|
||||
typedef struct lmo_entry lmo_entry_t;
|
||||
|
||||
|
||||
struct lmo_archive {
|
||||
int fd;
|
||||
int length;
|
||||
uint32_t size;
|
||||
lmo_entry_t *index;
|
||||
char *mmap;
|
||||
char *end;
|
||||
struct lmo_archive *next;
|
||||
};
|
||||
|
||||
typedef struct lmo_archive lmo_archive_t;
|
||||
|
||||
|
||||
struct lmo_catalog {
|
||||
char lang[6];
|
||||
struct lmo_archive *archives;
|
||||
struct lmo_catalog *next;
|
||||
};
|
||||
|
||||
typedef struct lmo_catalog lmo_catalog_t;
|
||||
|
||||
|
||||
uint32_t sfh_hash(const char *data, int len);
|
||||
uint32_t lmo_canon_hash(const char *data, int len);
|
||||
|
||||
lmo_archive_t * lmo_open(const char *file);
|
||||
void lmo_close(lmo_archive_t *ar);
|
||||
|
||||
|
||||
extern lmo_catalog_t *_lmo_catalogs;
|
||||
extern lmo_catalog_t *_lmo_active_catalog;
|
||||
|
||||
int lmo_load_catalog(const char *lang, const char *dir);
|
||||
int lmo_change_catalog(const char *lang);
|
||||
int lmo_translate(const char *key, int keylen, char **out, int *outlen);
|
||||
void lmo_close_catalog(const char *lang);
|
||||
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
Subproject commit 9e2f3e5eba0a9ab64433414d63fe7eeb221a5d2e
|
11
luci-app-argon-config/.github/workflows/build.sh
vendored
Executable file
11
luci-app-argon-config/.github/workflows/build.sh
vendored
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i 's/git\.openwrt\.org\/project\/luci/github\.com\/openwrt\/luci/g' ./feeds.conf.default
|
||||
./scripts/feeds update luci
|
||||
./scripts/feeds install luci
|
||||
mv ./bin/luci-app-argon-config ./package/
|
||||
make defconfig
|
||||
make package/luci-app-argon-config/compile V=s -j$(nproc) BUILD_LOG=1
|
||||
|
||||
tar -cJf logs.tar.xz logs
|
||||
mv logs.tar.xz bin
|
41
luci-app-argon-config/.github/workflows/check.yml
vendored
Normal file
41
luci-app-argon-config/.github/workflows/check.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags-ignore:
|
||||
- 'release-*'
|
||||
paths:
|
||||
- 'luci-app-argon-config/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build the IPK
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Prepare
|
||||
run: |
|
||||
mkdir -p bin/luci-app-argon-config
|
||||
cp -rf ./luasrc ./po ./root ./Makefile ./bin/luci-app-argon-config
|
||||
- name: Docker Build
|
||||
run: |
|
||||
docker pull openwrtorg/sdk:x86-64-21.02-SNAPSHOT
|
||||
docker run --rm -u root -v "$(pwd)"/bin/:/home/build/openwrt/bin -v ${{ github.workspace }}/.github/workflows:/home/build/workflows openwrtorg/sdk:x86-64-21.02-SNAPSHOT /bin/sh /home/build/workflows/build.sh
|
||||
- name: Upload app
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: luci-app-argon-config
|
||||
path: ./bin/packages/x86_64/base/*argon-config*
|
||||
if-no-files-found: error
|
||||
- name: Upload Log
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: buildlog
|
||||
path: bin/logs.tar.xz
|
39
luci-app-argon-config/.github/workflows/release.yml
vendored
Normal file
39
luci-app-argon-config/.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'release-*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build the IPK
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
- name: Prepare
|
||||
run: |
|
||||
mkdir -p bin/luci-app-argon-config
|
||||
cp -rf ./luasrc ./po ./root ./Makefile ./bin/luci-app-argon-config
|
||||
- name: Docker Build
|
||||
run: |
|
||||
docker pull openwrtorg/sdk:x86-64-21.02-SNAPSHOT
|
||||
docker run --rm -u root -v "$(pwd)"/bin/:/home/build/openwrt/bin -v ${{ github.workspace }}/.github/workflows:/home/build/workflows openwrtorg/sdk:x86-64-21.02-SNAPSHOT /bin/sh /home/build/workflows/build.sh
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -x
|
||||
assets=()
|
||||
for asset in ./bin/packages/x86_64/base/*argon-config*.ipk; do
|
||||
assets+=("-a" "$asset")
|
||||
done
|
||||
tag_name=$(basename ${{github.ref}})
|
||||
hub release create -p "${assets[@]}" -m "$tag_name" "$tag_name"
|
||||
- name: Upload Log
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: buildlog
|
||||
path: bin/logs.tar.xz
|
19
luci-app-argon-config/Makefile
Normal file
19
luci-app-argon-config/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-argon-config
|
||||
PKG_VERSION:=0.9
|
||||
PKG_RELEASE:=20220424
|
||||
|
||||
PKG_MAINTAINER:=jerrykuku <jerrykuku@qq.com>
|
||||
|
||||
LUCI_TITLE:=LuCI page for Argon Config
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+luci-compat +luci-lib-ipkg +luci-theme-argon
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/argon
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
4
luci-app-argon-config/README.md
Normal file
4
luci-app-argon-config/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# luci-app-argon-config
|
||||
Argon Theme Config Plugin
|
||||
|
||||
You can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.
|
10
luci-app-argon-config/luasrc/controller/argon-config.lua
Normal file
10
luci-app-argon-config/luasrc/controller/argon-config.lua
Normal file
@ -0,0 +1,10 @@
|
||||
module("luci.controller.argon-config", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access('/www/luci-static/argon/css/cascade.css') then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "system", "argon-config"}, form("argon-config"), _("Argon Config"), 90)
|
||||
page.acl_depends = { "luci-app-argon-config" }
|
||||
end
|
217
luci-app-argon-config/luasrc/model/cbi/argon-config.lua
Normal file
217
luci-app-argon-config/luasrc/model/cbi/argon-config.lua
Normal file
@ -0,0 +1,217 @@
|
||||
local nxfs = require 'nixio.fs'
|
||||
local wa = require 'luci.tools.webadmin'
|
||||
local opkg = require 'luci.model.ipkg'
|
||||
local sys = require 'luci.sys'
|
||||
local http = require 'luci.http'
|
||||
local nutil = require 'nixio.util'
|
||||
local name = 'argon'
|
||||
local uci = require 'luci.model.uci'.cursor()
|
||||
|
||||
local fstat = nxfs.statvfs(opkg.overlay_root())
|
||||
local space_total = fstat and fstat.blocks or 0
|
||||
local space_free = fstat and fstat.bfree or 0
|
||||
local space_used = space_total - space_free
|
||||
|
||||
local free_byte = space_free * fstat.frsize
|
||||
|
||||
local primary, dark_primary, blur_radius, blur_radius_dark, blur_opacity, mode
|
||||
if nxfs.access('/etc/config/argon') then
|
||||
primary = uci:get_first('argon', 'global', 'primary')
|
||||
dark_primary = uci:get_first('argon', 'global', 'dark_primary')
|
||||
blur_radius = uci:get_first('argon', 'global', 'blur')
|
||||
blur_radius_dark = uci:get_first('argon', 'global', 'blur_dark')
|
||||
blur_opacity = uci:get_first('argon', 'global', 'transparency')
|
||||
blur_opacity_dark = uci:get_first('argon', 'global', 'transparency_dark')
|
||||
mode = uci:get_first('argon', 'global', 'mode')
|
||||
bing_background = uci:get_first('argon', 'global', 'bing_background')
|
||||
end
|
||||
|
||||
function glob(...)
|
||||
local iter, code, msg = nxfs.glob(...)
|
||||
if iter then
|
||||
return nutil.consume(iter)
|
||||
else
|
||||
return nil, code, msg
|
||||
end
|
||||
end
|
||||
|
||||
local transparency_sets = {
|
||||
0,
|
||||
0.1,
|
||||
0.2,
|
||||
0.3,
|
||||
0.4,
|
||||
0.5,
|
||||
0.6,
|
||||
0.7,
|
||||
0.8,
|
||||
0.9,
|
||||
1
|
||||
}
|
||||
|
||||
-- [[ 模糊设置 ]]--
|
||||
br = SimpleForm('config', translate('Argon Config'), translate('Here you can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.[Chrome is recommended]'))
|
||||
br.reset = false
|
||||
br.submit = false
|
||||
s = br:section(SimpleSection)
|
||||
|
||||
o = s:option(ListValue, 'bing_background', translate('Wallpaper Source'))
|
||||
o:value('0', translate('Built-in'))
|
||||
o:value('1', translate('Bing Wallpapers'))
|
||||
o.default = bing_background
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, 'mode', translate('Theme mode'))
|
||||
o:value('normal', translate('Follow System'))
|
||||
o:value('light', translate('Force Light'))
|
||||
o:value('dark', translate('Force Dark'))
|
||||
o.default = mode
|
||||
o.rmempty = false
|
||||
o.description = translate('You can choose Theme color mode here')
|
||||
|
||||
o = s:option(Value, 'primary', translate('[Light mode] Primary Color'), translate('A HEX Color ; ( Default: #5e72e4 )'))
|
||||
o.default = primary
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
|
||||
|
||||
o = s:option(ListValue, 'transparency', translate('[Light mode] Transparency'), translate('0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: 0.5 )'))
|
||||
for _, v in ipairs(transparency_sets) do
|
||||
o:value(v)
|
||||
end
|
||||
o.default = blur_opacity
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'blur', translate('[Light mode] Frosted Glass Radius'), translate('Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )'))
|
||||
o.default = blur_radius
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'dark_primary', translate('[Dark mode] Primary Color'), translate('A HEX Color ; ( Default: #483d8b )'))
|
||||
o.default = dark_primary
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(ListValue, 'transparency_dark', translate('[Dark mode] Transparency'), translate('0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )'))
|
||||
for _, v in ipairs(transparency_sets) do
|
||||
o:value(v)
|
||||
end
|
||||
o.default = blur_opacity_dark
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, 'blur_dark', translate('[Dark mode] Frosted Glass Radius'), translate('Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )'))
|
||||
o.default = blur_radius_dark
|
||||
o.datatype = ufloat
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Button, 'save', translate('Save Changes'))
|
||||
o.inputstyle = 'reload'
|
||||
|
||||
function br.handle(self, state, data)
|
||||
if (state == FORM_VALID and data.blur ~= nil and data.blur_dark ~= nil and data.transparency ~= nil and data.transparency_dark ~= nil and data.mode ~= nil) then
|
||||
nxfs.writefile('/tmp/aaa', data)
|
||||
for key, value in pairs(data) do
|
||||
uci:set('argon','@global[0]',key,value)
|
||||
end
|
||||
uci:commit('argon')
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
ful = SimpleForm('upload', translate('Upload (Free: ') .. wa.byte_format(free_byte) .. ')', translate("You can upload files such as jpg,png,gif,webp,mp4,webm files, To change the login page background."))
|
||||
ful.reset = false
|
||||
ful.submit = false
|
||||
|
||||
sul = ful:section(SimpleSection, '', translate("Upload file to '/www/luci-static/argon/background/'"))
|
||||
fu = sul:option(FileUpload, '')
|
||||
fu.template = 'argon-config/other_upload'
|
||||
um = sul:option(DummyValue, '', nil)
|
||||
um.template = 'argon-config/other_dvalue'
|
||||
|
||||
local dir, fd
|
||||
dir = '/www/luci-static/argon/background/'
|
||||
nxfs.mkdir(dir)
|
||||
http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fd then
|
||||
if not meta then
|
||||
return
|
||||
end
|
||||
|
||||
if meta and chunk then
|
||||
fd = nixio.open(dir .. meta.file, 'w')
|
||||
end
|
||||
|
||||
if not fd then
|
||||
um.value = translate('Create upload file error.')
|
||||
return
|
||||
end
|
||||
end
|
||||
if chunk and fd then
|
||||
fd:write(chunk)
|
||||
end
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
um.value = translate('File saved to') .. ' "/www/luci-static/argon/background/' .. meta.file .. '"'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if http.formvalue('upload') then
|
||||
local f = http.formvalue('ulfile')
|
||||
if #f <= 0 then
|
||||
um.value = translate('No specify upload file.')
|
||||
end
|
||||
end
|
||||
|
||||
local function getSizeStr(size)
|
||||
local i = 0
|
||||
local byteUnits = {' kB', ' MB', ' GB', ' TB'}
|
||||
repeat
|
||||
size = size / 1024
|
||||
i = i + 1
|
||||
until (size <= 1024)
|
||||
return string.format('%.1f', size) .. byteUnits[i]
|
||||
end
|
||||
|
||||
local inits, attr = {}
|
||||
for i, f in ipairs(glob(dir .. '*')) do
|
||||
attr = nxfs.stat(f)
|
||||
if attr then
|
||||
inits[i] = {}
|
||||
inits[i].name = nxfs.basename(f)
|
||||
inits[i].mtime = os.date('%Y-%m-%d %H:%M:%S', attr.mtime)
|
||||
inits[i].modestr = attr.modestr
|
||||
inits[i].size = getSizeStr(attr.size)
|
||||
inits[i].remove = 0
|
||||
inits[i].install = false
|
||||
end
|
||||
end
|
||||
|
||||
form = SimpleForm('filelist', translate('Background file list'), nil)
|
||||
form.reset = false
|
||||
form.submit = false
|
||||
|
||||
tb = form:section(Table, inits)
|
||||
nm = tb:option(DummyValue, 'name', translate('File name'))
|
||||
mt = tb:option(DummyValue, 'mtime', translate('Modify time'))
|
||||
sz = tb:option(DummyValue, 'size', translate('Size'))
|
||||
btnrm = tb:option(Button, 'remove', translate('Remove'))
|
||||
btnrm.render = function(self, section, scope)
|
||||
self.inputstyle = 'remove'
|
||||
Button.render(self, section, scope)
|
||||
end
|
||||
|
||||
btnrm.write = function(self, section)
|
||||
local v = nxfs.unlink(dir .. nxfs.basename(inits[section].name))
|
||||
if v then
|
||||
table.remove(inits, section)
|
||||
end
|
||||
return v
|
||||
end
|
||||
|
||||
return br, ful, form
|
@ -0,0 +1,7 @@
|
||||
<%+cbi/valueheader%>
|
||||
<% if self:cfgvalue(section) ~= false then %>
|
||||
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
|
||||
<% else %>
|
||||
-
|
||||
<% end %>
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,8 @@
|
||||
<%+cbi/valueheader%>
|
||||
<span style="color: red">
|
||||
<%
|
||||
local val = self:cfgvalue(section) or self.default or ""
|
||||
write(pcdata(val))
|
||||
%>
|
||||
</span>
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,5 @@
|
||||
<%+cbi/valueheader%>
|
||||
<label class="cbi-value" style="display:inline-block; width: 130px" for="ulfile"><%:Choose local file:%></label>
|
||||
<input class="cbi-input-file" style="width: 400px" type="file" id="ulfile" name="ulfile" accept="image/png, image/jpeg, image/gif, image/webp, video/mp4, video/webm"/>
|
||||
<input type="submit" class="btn cbi-button cbi-input-apply" name="upload" value="<%:Upload%>" />
|
||||
<%+cbi/valuefooter%>
|
179
luci-app-argon-config/po/es/argon-config.po
Normal file
179
luci-app-argon-config/po/es/argon-config.po
Normal file
@ -0,0 +1,179 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: 2021-03-15 21:25-0300\n"
|
||||
"PO-Revision-Date: 2022-04-23 15:21-0300\n"
|
||||
"Last-Translator: Franco Castillo <castillofrancodamian@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 3.0.1\n"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr ""
|
||||
"0 transparente - 1 opaco; (Sugerencia: negro translúcido preestablecido: 0.5)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid ""
|
||||
"0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: "
|
||||
"0.5 )"
|
||||
msgstr ""
|
||||
"0 transparente - 1 opaco; (Sugerencia: transparente: 0 o translúcido "
|
||||
"preestablecido: 0.5)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr "Un color HEX; (Predeterminado: #483d8b)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr "Un color HEX; (Predeterminado: #5e72e4)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/controller/argon-config.lua:8
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid "Argon Config"
|
||||
msgstr "Configuración de Argon"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:195
|
||||
msgid "Background file list"
|
||||
msgstr "Lista de archivos de fondo"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:60
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr "Fondos de Bing"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:59
|
||||
msgid "Built-in"
|
||||
msgstr "Integrado"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:2
|
||||
msgid "Choose local file:"
|
||||
msgstr "Elija un archivo local:"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:149
|
||||
msgid "Create upload file error."
|
||||
msgstr "Crear archivo de error de carga."
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:200
|
||||
msgid "File name"
|
||||
msgstr "Nombre del archivo"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:159
|
||||
msgid "File saved to"
|
||||
msgstr "Archivo guardado en"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:65
|
||||
msgid "Follow System"
|
||||
msgstr "Seguir el sistema"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:67
|
||||
msgid "Force Dark"
|
||||
msgstr "Forzar oscuro"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:66
|
||||
msgid "Force Light"
|
||||
msgstr "Forzar claro"
|
||||
|
||||
#: applications/luci-app-argon-config/root/usr/share/rpcd/acl.d/luci-app-argon-config.json:3
|
||||
msgid "Grant UCI access for luci-app-argon-config"
|
||||
msgstr "Otorgar acceso UCI para luci-app-argon-config"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid ""
|
||||
"Here you can set the blur and transparency of the login page of argon theme, "
|
||||
"and manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr ""
|
||||
"Aquí puede configurar el desenfoque y la transparencia de la página de "
|
||||
"inicio de sesión del tema argon y administrar las imágenes de fondo y los "
|
||||
"videos. [Se recomienda Chrome]"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid ""
|
||||
"Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr ""
|
||||
"El valor más grande se verá más borroso; (Sugerencia: claro: 1 o desenfoque "
|
||||
"predeterminado: 10)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:201
|
||||
msgid "Modify time"
|
||||
msgstr "Modificar la hora"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:167
|
||||
msgid "No specify upload file."
|
||||
msgstr "No especificar archivo de carga."
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:203
|
||||
msgid "Remove"
|
||||
msgstr "Eliminar"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:110
|
||||
msgid "Save Changes"
|
||||
msgstr "Guardar cambios"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:202
|
||||
msgid "Size"
|
||||
msgstr "Tamaño"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:64
|
||||
msgid "Theme mode"
|
||||
msgstr "Modo del tema"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:4
|
||||
msgid "Upload"
|
||||
msgstr "Cargar"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid "Upload (Free:"
|
||||
msgstr "Cargar (Libre:"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:128
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr "Subir archivo a '/www/luci-static/argon/background/'"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:58
|
||||
msgid "Wallpaper Source"
|
||||
msgstr "Fuente del fondo de pantalla"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:70
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr "Puede elegir el modo de color del tema aquí"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid ""
|
||||
"You can upload files such as jpg,png,gif,webp,mp4,webm files, To change the login page "
|
||||
"background."
|
||||
msgstr ""
|
||||
"Puede cargar archivos como jpg, png, gif, webp, mp4, webm, para cambiar el fondo de la "
|
||||
"página de inicio de sesión."
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr "[Modo oscuro] Radio de vidrio esmerilado"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr "[Modo oscuro] Color primario"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr "[Modo oscuro] Transparencia"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr "[Modo claro] Radio de vidrio esmerilado"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr "[Modo claro] Color primario"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr "[Modo claro] Transparencia"
|
||||
|
||||
#~ msgid "Luci Argon theme config"
|
||||
#~ msgstr "Configuración del tema Luci Argon"
|
155
luci-app-argon-config/po/templates/argon-config.pot
Normal file
155
luci-app-argon-config/po/templates/argon-config.pot
Normal file
@ -0,0 +1,155 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid ""
|
||||
"0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: "
|
||||
"0.5 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/controller/argon-config.lua:8
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid "Argon Config"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:195
|
||||
msgid "Background file list"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:60
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:59
|
||||
msgid "Built-in"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:2
|
||||
msgid "Choose local file:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:149
|
||||
msgid "Create upload file error."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:200
|
||||
msgid "File name"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:159
|
||||
msgid "File saved to"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:65
|
||||
msgid "Follow System"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:67
|
||||
msgid "Force Dark"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:66
|
||||
msgid "Force Light"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/root/usr/share/rpcd/acl.d/luci-app-argon-config.json:3
|
||||
msgid "Grant UCI access for luci-app-argon-config"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid ""
|
||||
"Here you can set the blur and transparency of the login page of argon theme, "
|
||||
"and manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid ""
|
||||
"Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:201
|
||||
msgid "Modify time"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:167
|
||||
msgid "No specify upload file."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:203
|
||||
msgid "Remove"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:110
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:202
|
||||
msgid "Size"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:64
|
||||
msgid "Theme mode"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:4
|
||||
msgid "Upload"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid "Upload (Free:"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:128
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:58
|
||||
msgid "Wallpaper Source"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:70
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid ""
|
||||
"You can upload files such as jpg,png,gif,webp,mp4,webm files, To change the login page "
|
||||
"background."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr ""
|
129
luci-app-argon-config/po/zh-cn/argon-config.po
Normal file
129
luci-app-argon-config/po/zh-cn/argon-config.po
Normal file
@ -0,0 +1,129 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: dingpengyu <jerrykuku@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: zh_CN\n"
|
||||
"X-Generator: Poedit 2.3.1\n"
|
||||
|
||||
msgid "Argon Config"
|
||||
msgstr "Argon 主题设置"
|
||||
|
||||
msgid "Here you can set the blur and transparency of the login page of argon theme, and manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr "在这里你可以设置argon 主题的登录页面的模糊和透明度,并管理背景图片与视频。[建议使用 Chrome]"
|
||||
|
||||
msgid "Wallpaper Source"
|
||||
msgstr "壁纸来源"
|
||||
|
||||
msgid "Built-in"
|
||||
msgstr "内建"
|
||||
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr "Bing 壁纸"
|
||||
|
||||
msgid "Theme mode"
|
||||
msgstr "主题模式"
|
||||
|
||||
msgid "Follow System"
|
||||
msgstr "跟随系统"
|
||||
|
||||
msgid "Force Light"
|
||||
msgstr "强制亮色"
|
||||
|
||||
msgid "Force Dark"
|
||||
msgstr "强制暗色"
|
||||
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr "你可以选择喜欢的主题模式"
|
||||
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr "[亮色模式] 主色调"
|
||||
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr "[暗色模式] 主色调"
|
||||
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr "十六进制颜色值 ( 预设为:#5e72e4 )"
|
||||
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr "十六进制颜色值 ( 预设为:#483d8b )"
|
||||
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr "[亮色模式] 透明度"
|
||||
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr "[暗色模式] 透明度"
|
||||
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: 0.5 )"
|
||||
msgstr "0最透明 - 1不透明 ; ( 建议: 透明 0 或 半透明预设 0.5 )"
|
||||
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr "0最透明 - 1不透明 ; ( 建议: 黑色半透明 0.5 )"
|
||||
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr "[亮色模式] 毛玻璃模糊半径"
|
||||
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr "[暗色模式] 毛玻璃模糊半径"
|
||||
|
||||
msgid "Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr "值越大越模糊; ( 建议: 清透 1 或 模糊预设 10 )"
|
||||
|
||||
msgid "You can upload files such as jpg,png,gif,webp,mp4,webm files, To change the login page background."
|
||||
msgstr "你可以上传jpg、png、gif、webp或mp4、webm文件,以创建自己喜欢的登录界面"
|
||||
|
||||
msgid "Save Changes"
|
||||
msgstr "保存更改"
|
||||
|
||||
msgid "Choose local file:"
|
||||
msgstr "选择本地文件:"
|
||||
|
||||
msgid "Couldn't open file:"
|
||||
msgstr "无法打开文件:"
|
||||
|
||||
msgid "Create upload file error."
|
||||
msgstr "创建上传文件失败。"
|
||||
|
||||
msgid "File name"
|
||||
msgstr "文件名"
|
||||
|
||||
msgid "File saved to"
|
||||
msgstr "文件保存到"
|
||||
|
||||
msgid "FileTransfer"
|
||||
msgstr "文件传输"
|
||||
|
||||
msgid "Install"
|
||||
msgstr "安装"
|
||||
|
||||
msgid "Attributes"
|
||||
msgstr "属性"
|
||||
|
||||
msgid "Modify time"
|
||||
msgstr "修改时间"
|
||||
|
||||
msgid "No specify upload file."
|
||||
msgstr "未指定上传文件。"
|
||||
|
||||
msgid "Path on Route:"
|
||||
msgstr "路由根目录:"
|
||||
|
||||
msgid "Remove"
|
||||
msgstr "移除"
|
||||
|
||||
msgid "Size"
|
||||
msgstr "大小"
|
||||
|
||||
msgid "Upload (Free:"
|
||||
msgstr "上传 (剩余空间:"
|
||||
|
||||
msgid "Background file list"
|
||||
msgstr "背景文件列表"
|
||||
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr "文件将上传到'/www/luci-static/argon/background/'"
|
165
luci-app-argon-config/po/zh-tw/argon-config.po
Normal file
165
luci-app-argon-config/po/zh-tw/argon-config.po
Normal file
@ -0,0 +1,165 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Victor Tseng <palatis@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: zh_TW\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 3.2.2\n"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "0 transparent - 1 opaque ; ( Suggest: Black translucent preset: 0.5 )"
|
||||
msgstr "0 全透明 - 1 不透明(建議:黑色半透明 0.5)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid ""
|
||||
"0 transparent - 1 opaque ; ( Suggest: transparent: 0 or translucent preset: 0.5 )"
|
||||
msgstr "0 全透明 - 1 不透明(建議:全透明 0,或半透明 0.5)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "A HEX Color ; ( Default: #483d8b )"
|
||||
msgstr "十六進制顏色(預設 #483d8b)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "A HEX Color ; ( Default: #5e72e4 )"
|
||||
msgstr "十六進制顏色(預設 #5e72e4)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/controller/argon-config.lua:8
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid "Argon Config"
|
||||
msgstr "Argon 設定"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:195
|
||||
msgid "Background file list"
|
||||
msgstr "背景檔案清單"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:60
|
||||
msgid "Bing Wallpapers"
|
||||
msgstr "必應桌布"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:59
|
||||
msgid "Built-in"
|
||||
msgstr "內建"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:2
|
||||
msgid "Choose local file:"
|
||||
msgstr "選擇本地檔案:"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:149
|
||||
msgid "Create upload file error."
|
||||
msgstr "建立上傳檔案錯誤。"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:200
|
||||
msgid "File name"
|
||||
msgstr "檔案名稱"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:159
|
||||
msgid "File saved to"
|
||||
msgstr "檔案已儲存至"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:65
|
||||
msgid "Follow System"
|
||||
msgstr "跟隨系統配色"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:67
|
||||
msgid "Force Dark"
|
||||
msgstr "強制深色"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:66
|
||||
msgid "Force Light"
|
||||
msgstr "強制淺色"
|
||||
|
||||
#: applications/luci-app-argon-config/root/usr/share/rpcd/acl.d/luci-app-argon-config.json:3
|
||||
msgid "Grant UCI access for luci-app-argon-config"
|
||||
msgstr "為 luci-app-argon-config 授予 UCI 權限"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:53
|
||||
msgid ""
|
||||
"Here you can set the blur and transparency of the login page of argon theme, and "
|
||||
"manage the background pictures and videos.[Chrome is recommended]"
|
||||
msgstr ""
|
||||
"您可以在此設定登入畫面的模糊度、透明度、以及管理背景圖片與影片(推薦使用 "
|
||||
"Chrome)。"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid "Larger value will more blurred ; ( Suggest: clear: 1 or blur preset: 10 )"
|
||||
msgstr "數值越大越模糊(建議:清晰 1,或模糊程度 10)"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:201
|
||||
msgid "Modify time"
|
||||
msgstr "修改時間"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:167
|
||||
msgid "No specify upload file."
|
||||
msgstr "沒有選擇要上傳的檔案。"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:203
|
||||
msgid "Remove"
|
||||
msgstr "移除"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:110
|
||||
msgid "Save Changes"
|
||||
msgstr "保存變更"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:202
|
||||
msgid "Size"
|
||||
msgstr "容量"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:64
|
||||
msgid "Theme mode"
|
||||
msgstr "佈景主題模式"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/view/argon-config/other_upload.htm:4
|
||||
msgid "Upload"
|
||||
msgstr "上傳"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid "Upload (Free:"
|
||||
msgstr "上傳(剩餘空間:"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:128
|
||||
msgid "Upload file to '/www/luci-static/argon/background/'"
|
||||
msgstr "上傳檔案至「/www/luci-static/argon/background」"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:58
|
||||
msgid "Wallpaper Source"
|
||||
msgstr "桌布來源"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:70
|
||||
msgid "You can choose Theme color mode here"
|
||||
msgstr "您可以在此選擇佈景主題的顏色模式"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:124
|
||||
msgid ""
|
||||
"You can upload files such as jpg,png,gif,mp4,webm files, To change the login page "
|
||||
"background."
|
||||
msgstr "您可以上傳諸如 jpg、png、gif、mp4、webm 等類型的檔案來更換登入畫面的背景。"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:105
|
||||
msgid "[Dark mode] Frosted Glass Radius"
|
||||
msgstr "《深色模式》模糊效果半徑"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:92
|
||||
msgid "[Dark mode] Primary Color"
|
||||
msgstr "《深色模式》主色彩"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:97
|
||||
msgid "[Dark mode] Transparency"
|
||||
msgstr "《深色模式》透明度"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:87
|
||||
msgid "[Light mode] Frosted Glass Radius"
|
||||
msgstr "《淺色模式》模糊效果半徑"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:72
|
||||
msgid "[Light mode] Primary Color"
|
||||
msgstr "《淺色模式》主色彩"
|
||||
|
||||
#: applications/luci-app-argon-config/luasrc/model/cbi/argon-config.lua:79
|
||||
msgid "[Light mode] Transparency"
|
||||
msgstr "《淺色模式》透明度"
|
1
luci-app-argon-config/po/zh_Hans
Symbolic link
1
luci-app-argon-config/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
1
luci-app-argon-config/po/zh_Hant
Symbolic link
1
luci-app-argon-config/po/zh_Hant
Symbolic link
@ -0,0 +1 @@
|
||||
zh-tw
|
9
luci-app-argon-config/root/etc/config/argon
Normal file
9
luci-app-argon-config/root/etc/config/argon
Normal file
@ -0,0 +1,9 @@
|
||||
config global
|
||||
option primary '#5e72e4'
|
||||
option dark_primary '#483d8b'
|
||||
option blur '10'
|
||||
option blur_dark '10'
|
||||
option transparency '0.5'
|
||||
option transparency_dark '0.5'
|
||||
option mode 'normal'
|
||||
option bing_background '0'
|
6
luci-app-argon-config/root/etc/uci-defaults/luci-argon-config
Executable file
6
luci-app-argon-config/root/etc/uci-defaults/luci-argon-config
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i 's/cbi.submit\"] = true/cbi.submit\"] = \"1\"/g' /usr/lib/lua/luci/dispatcher.lua
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-argon-config": {
|
||||
"description": "Grant UCI access for luci-app-argon-config",
|
||||
"read": {
|
||||
"uci": [ "argon" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "argon" ]
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit ca78417d1b5665fe0c3e4c4a743e24dd325911f5
|
21
luci-app-autotimeset/LICENSE
Normal file
21
luci-app-autotimeset/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2020 johnrosen1
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
22
luci-app-autotimeset/Makefile
Normal file
22
luci-app-autotimeset/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright (C) 2019-2023 sirpdboy https://github.com/sirpdboy/luci-app-autotimeset
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for Scheduled Time setting
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=2.0.2
|
||||
PKG_RELEASE:=20230718
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/autotimeset
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
113
luci-app-autotimeset/README.md
Normal file
113
luci-app-autotimeset/README.md
Normal file
@ -0,0 +1,113 @@
|
||||
[![若部分图片无法正常显示,请挂上机场浏览或点这里到末尾看修复教程](https://visitor-badge-deno.deno.dev/sirpdboy.sirpdboy.svg)](#解决-github-网页上图片显示失败的问题) [![](https://img.shields.io/badge/TG群-点击加入-FFFFFF.svg)](https://t.me/joinchat/AAAAAEpRF88NfOK5vBXGBQ)
|
||||
|
||||
[autotimeset 定时设置插件](https://github.com/sirpdboy/luci-app-autotimeset)
|
||||
|
||||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明1.jpg)
|
||||
|
||||
请 **认真阅读完毕** 本页面,本页面包含注意事项和如何使用。
|
||||
|
||||
## 功能说明:
|
||||
|
||||
### 定时设置2.0版
|
||||
#### 2023.5.23 定时设置2.0版:定时执行任务设置和开机启动任务设置二合一版,并增加自定义脚本功能。
|
||||
|
||||
### 定时设置1.9版
|
||||
#### 2023.4.1 定时设置1.9版:加入定时断网重连、定时检测WAN3重启等服务。
|
||||
|
||||
### 定时设置1.6版
|
||||
#### 2023.1.15 定时设置1.6版:重新代码制作优化。在之前的版本上新增加:定时清理内存、定时清理系统垃圾、定时断网、定时重启网络共享、定时重拨 等 8大功能
|
||||
|
||||
### 定时设置1.4版
|
||||
#### 2021.2.7 新增功能定时重启网络。现包括:定时重启、定时关机、定时重启网络,各功能可一起使用。
|
||||
|
||||
### 定时设置1.3版
|
||||
#### 2020.10.6 原来重定关机正式改名为定时设置,实现定时重启和定时关机功能二合一。
|
||||
|
||||
### 定时关机1.1版
|
||||
#### 2020.7.19 定时关机功能,彻底解决需要保存二次才生效的问题。
|
||||
|
||||
### 定时关机1.0版
|
||||
#### 2019.2.24 定时关机功能借鉴前辈们的开源代码首发。
|
||||
|
||||
## 编译使用方法 [![](https://img.shields.io/badge/-编译使用方法-F5F5F5.svg)](#编译使用方法-)
|
||||
|
||||
将luci-app-autotimeset添加至 LEDE/OpenWRT 源码的方法。
|
||||
|
||||
### 下载源码方法一:
|
||||
编辑源码文件夹根目录feeds.conf.default并加入如下内容:
|
||||
|
||||
```Brach
|
||||
# feeds获取源码:
|
||||
src-git autotimeset https://github.com/sirpdboy/luci-app-autotimeset
|
||||
```
|
||||
```Brach
|
||||
# 更新feeds,并安装主题:
|
||||
scripts/feeds update autotimeset
|
||||
scripts/feeds install luci-app-autotimeset
|
||||
```
|
||||
|
||||
### 下载源码方法二:
|
||||
```Brach
|
||||
# 下载源码
|
||||
git clone https://github.com/sirpdboy/luci-app-autotimeset package/luci-app-autotimeset
|
||||
make menuconfig
|
||||
```
|
||||
### 配置菜单
|
||||
```Brach
|
||||
make menuconfig
|
||||
# 找到 LuCI -> Applications, 选择 luci-app-autotimeset, 保存后退出。
|
||||
```
|
||||
### 编译
|
||||
```Brach
|
||||
# 编译固件
|
||||
make package/luci-app-autotimeset/compile V=s
|
||||
```
|
||||
|
||||
## 说明 [![](https://img.shields.io/badge/-说明-F5F5F5.svg)](#说明-)
|
||||
|
||||
源码来源:https://github.com/sirpdboy/luci-app-autotimeset
|
||||
|
||||
|
||||
|
||||
## 使用与授权相关说明
|
||||
|
||||
- 本人开源的所有源码,任何引用需注明本处出处,如需修改二次发布必告之本人,未经许可不得做于任何商用用途。
|
||||
|
||||
|
||||
# My other project
|
||||
|
||||
- 网络速度测试 :https://github.com/sirpdboy/NetSpeedTest
|
||||
|
||||
- 任务设置(定时和开机二合一)插件 : https://github.com/sirpdboy/luci-app-autotimeset
|
||||
|
||||
- 关机功能插件 : https://github.com/sirpdboy/luci-app-poweroffdevice
|
||||
|
||||
- opentopd主题 : https://github.com/sirpdboy/luci-theme-opentopd
|
||||
|
||||
- kucat 主题: https://github.com/sirpdboy/luci-theme-kucat
|
||||
|
||||
- 家长控制: https://github.com/sirpdboy/luci-theme-parentcontrol
|
||||
|
||||
- 系统高级设置 : https://github.com/sirpdboy/luci-app-advanced
|
||||
|
||||
- ddns-go动态域名: https://github.com/sirpdboy/luci-app-ddns-go
|
||||
|
||||
- 进阶设置(系统高级设置+主题设置kucat/agron/opentopd): https://github.com/sirpdboy/luci-app-advancedplus
|
||||
|
||||
- 设置向导: https://github.com/sirpdboy/luci-app-wizard
|
||||
|
||||
- 分区扩容: https://github.com/sirpdboy/luci-app-partexp
|
||||
|
||||
- lukcy大吉: https://github.com/sirpdboy/luci-app-lukcy
|
||||
|
||||
## 捐助
|
||||
|
||||
![screenshots](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/说明3.jpg)
|
||||
|
||||
| <img src="https://img.shields.io/badge/-支付宝-F5F5F5.svg" href="#赞助支持本项目-" height="25" alt="图飞了😂"/> | <img src="https://img.shields.io/badge/-微信-F5F5F5.svg" height="25" alt="图飞了😂" href="#赞助支持本项目-"/> |
|
||||
| :-----------------: | :-------------: |
|
||||
|![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/支付宝.png) | ![xm1](https://raw.githubusercontent.com/sirpdboy/openwrt/master/doc/微信.png) |
|
||||
|
||||
<a href="#readme">
|
||||
<img src="https://img.shields.io/badge/-返回顶部-orange.svg" alt="图飞了😂" title="返回顶部" align="right"/>
|
||||
</a>
|
35
luci-app-autotimeset/luasrc/controller/autotimeset.lua
Normal file
35
luci-app-autotimeset/luasrc/controller/autotimeset.lua
Normal file
@ -0,0 +1,35 @@
|
||||
module("luci.controller.autotimeset",package.seeall)
|
||||
local fs=require"nixio.fs"
|
||||
local http=require"luci.http"
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/autotimeset") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "control"}, firstchild(), "Control", 44).dependent = false
|
||||
entry({"admin", "control", "autotimeset"}, alias("admin", "control", "autotimeset", "base"), _("Scheduled Setting"), 20).dependent = true
|
||||
entry({"admin", "control", "autotimeset", "base"}, cbi("autotimeset/base"), _("Scheduled Setting"), 1).leaf = true
|
||||
entry({"admin", "control", "autotimeset", "log"}, form("autotimeset/log"), _("Log"), 2).leaf = true
|
||||
entry({"admin","control","autotimeset","dellog"},call("dellog"))
|
||||
entry({"admin","control","autotimeset","getlog"},call("getlog"))
|
||||
end
|
||||
|
||||
|
||||
function getlog()
|
||||
logfile="/etc/autotimeset/autotimeset.log"
|
||||
if not fs.access(logfile) then
|
||||
http.write("")
|
||||
return
|
||||
end
|
||||
local f=io.open(logfile,"r")
|
||||
local a=f:read("*a") or ""
|
||||
f:close()
|
||||
a=string.gsub(a,"\n$","")
|
||||
http.prepare_content("text/plain; charset=utf-8")
|
||||
http.write(a)
|
||||
end
|
||||
|
||||
function dellog()
|
||||
fs.writefile("/etc/autotimeset/autotimeset.log","")
|
||||
http.prepare_content("application/json")
|
||||
http.write('')
|
||||
end
|
56
luci-app-autotimeset/luasrc/model/cbi/autotimeset.lua
Normal file
56
luci-app-autotimeset/luasrc/model/cbi/autotimeset.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local o=require"luci.dispatcher"
|
||||
local e=require("luci.model.ipkg")
|
||||
local s=require"nixio.fs"
|
||||
local e=luci.model.uci.cursor()
|
||||
local m,s,e
|
||||
|
||||
m=Map("autotimeset",translate("Scheduled Setting"),translate("Timing settings include: timing restart, timing shutdown, timing restart network, all functions can be used together."))
|
||||
|
||||
s=m:section(TypedSection,"stime","")
|
||||
s.addremove=true
|
||||
s.anonymous=true
|
||||
s.template = "cbi/tblsection"
|
||||
|
||||
e=s:option(ListValue,"stype",translate("Scheduled Type"))
|
||||
e:value(1,translate("Scheduled Reboot"))
|
||||
e:value(2,translate("Scheduled Poweroff"))
|
||||
e:value(3,translate("Scheduled ReNetwork"))
|
||||
e:value(4,translate("Scheduled RestartSamba"))
|
||||
e:value(5,translate("Scheduled Restartwan"))
|
||||
e:value(6,translate("Scheduled Closewan"))
|
||||
e:value(7,translate("Scheduled Clearmem"))
|
||||
e:value(8,translate("Scheduled Sysfree"))
|
||||
e:value(9,translate("Scheduled DisReconn"))
|
||||
e.default=2
|
||||
|
||||
week=s:option(ListValue,"week",translate("Week Day"))
|
||||
week.rmempty = true
|
||||
week:value('*',translate("Everyday"))
|
||||
week:value(0,translate("Sunday"))
|
||||
week:value(1,translate("Monday"))
|
||||
week:value(2,translate("Tuesday"))
|
||||
week:value(3,translate("Wednesday"))
|
||||
week:value(4,translate("Thursday"))
|
||||
week:value(5,translate("Friday"))
|
||||
week:value(6,translate("Saturday"))
|
||||
week.default='*'
|
||||
|
||||
e=s:option(Value,"hour",translate("Hour"))
|
||||
e.datatype = "range(0,23)"
|
||||
e.rmempty = false
|
||||
e.default = 4
|
||||
|
||||
e=s:option(Value,"minute",translate("Minute"))
|
||||
e.datatype = "range(0,59)"
|
||||
e.rmempty = false
|
||||
e.default = 0
|
||||
|
||||
e=s:option(Flag,"enable",translate("Enable"))
|
||||
e.rmempty = false
|
||||
e.default=0
|
||||
|
||||
m.apply_on_parse = true
|
||||
m.on_after_apply = function(self,map)
|
||||
io.popen("/etc/init.d/autotimeset start")
|
||||
end
|
||||
return m
|
83
luci-app-autotimeset/luasrc/model/cbi/autotimeset/base.lua
Normal file
83
luci-app-autotimeset/luasrc/model/cbi/autotimeset/base.lua
Normal file
@ -0,0 +1,83 @@
|
||||
local o=require"luci.dispatcher"
|
||||
local e=require("luci.model.ipkg")
|
||||
local s=require"nixio.fs"
|
||||
local e=luci.model.uci.cursor()
|
||||
local m,s,e
|
||||
|
||||
m=Map("autotimeset",translate("Scheduled task/startup task settings"),translate("<b>The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts</b></br>") ..
|
||||
translate("N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours.") ..
|
||||
translate(" <input class=\"cbi-button cbi-button-apply\" type=\"button\" value=\"" ..
|
||||
translate("Test/Verify Settings") ..
|
||||
" \" onclick=\"window.open('https://tool.lu/crontab/')\"/>"))
|
||||
|
||||
s = m:section(TypedSection, 'global')
|
||||
s.anonymous=true
|
||||
|
||||
e=s:option(TextValue, "customscript" ,translate("Edit Custom Script"))
|
||||
e.description = translate("Only by editing the content of the custom script well and scheduling the custom script task can it be executed effectively.")
|
||||
e.rows = 5
|
||||
e.default = '#!/bin/sh'
|
||||
e.rmempty = false
|
||||
|
||||
s=m:section(TypedSection,"stime","")
|
||||
s.addremove=true
|
||||
s.anonymous=true
|
||||
s.template = "cbi/tblsection"
|
||||
|
||||
e=s:option(ListValue,"stype",translate("Scheduled Type"))
|
||||
e:value(1,translate("Scheduled Reboot"))
|
||||
e:value(2,translate("Scheduled Poweroff"))
|
||||
e:value(3,translate("Scheduled ReNetwork"))
|
||||
e:value(4,translate("Scheduled RestartSamba"))
|
||||
e:value(5,translate("Scheduled Restartwan"))
|
||||
e:value(6,translate("Scheduled Closewan"))
|
||||
e:value(7,translate("Scheduled Clearmem"))
|
||||
e:value(8,translate("Scheduled Sysfree"))
|
||||
e:value(9,translate("Scheduled DisReconn"))
|
||||
e:value(10,translate("Scheduled DisRereboot"))
|
||||
e:value(11,translate("Scheduled Restartmwan3"))
|
||||
e:value(12,translate("Scheduled Customscript"))
|
||||
e.default=2
|
||||
|
||||
e=s:option(ListValue,"ttype",translate("Task Type"))
|
||||
e:value(0,translate("Scheduled task execution"))
|
||||
e:value(1,translate("Startup task"))
|
||||
e.default=0
|
||||
|
||||
e=s:option(Value,"delay",translate("Startup delay time"))
|
||||
e.default=10
|
||||
|
||||
e=s:option(Value,"month",translate("Month(0~11)"))
|
||||
e.rmempty = false
|
||||
e.default = '*'
|
||||
|
||||
week=s:option(Value,"week",translate("Week Day(0~6)"))
|
||||
week.rmempty = true
|
||||
week:value('*',translate("Everyday"))
|
||||
week:value(0,translate("Sunday"))
|
||||
week:value(1,translate("Monday"))
|
||||
week:value(2,translate("Tuesday"))
|
||||
week:value(3,translate("Wednesday"))
|
||||
week:value(4,translate("Thursday"))
|
||||
week:value(5,translate("Friday"))
|
||||
week:value(6,translate("Saturday"))
|
||||
week.default='*'
|
||||
|
||||
e=s:option(Value,"hour",translate("Hour(0~23)"))
|
||||
e.rmempty = false
|
||||
e.default = 0
|
||||
|
||||
e=s:option(Value,"minute",translate("Minute(0~59)"))
|
||||
e.rmempty = false
|
||||
e.default = 0
|
||||
|
||||
e=s:option(Flag,"enable",translate("Enable"))
|
||||
e.rmempty = false
|
||||
e.default=0
|
||||
|
||||
m.apply_on_parse = true
|
||||
m.on_after_apply = function(self,map)
|
||||
luci.sys.exec("/etc/init.d/autotimeset start")
|
||||
end
|
||||
|
||||
return m
|
13
luci-app-autotimeset/luasrc/model/cbi/autotimeset/log.lua
Normal file
13
luci-app-autotimeset/luasrc/model/cbi/autotimeset/log.lua
Normal file
@ -0,0 +1,13 @@
|
||||
local fs = require "nixio.fs"
|
||||
local uci = require"luci.model.uci".cursor()
|
||||
local f, t
|
||||
f = SimpleForm("logview")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
t=f:field(TextValue,"conf")
|
||||
|
||||
t.rmempty=true
|
||||
t.rows=20
|
||||
t.template="autotimeset/log"
|
||||
t.readonly="readonly"
|
||||
return f
|
54
luci-app-autotimeset/luasrc/view/autotimeset/log.htm
Normal file
54
luci-app-autotimeset/luasrc/view/autotimeset/log.htm
Normal file
@ -0,0 +1,54 @@
|
||||
<%+cbi/valueheader%>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="apply_update_button" value="<%:Clear Log%>" onclick="apply_del_log()"/>
|
||||
<input type="checkbox" name="NAME" value="reverse" onclick="reverselog()" style="vertical-align:middle;height:auto;"><%:Reverse%></input>
|
||||
<textarea id="cbid.logview.1.conf" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" > </textarea>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var islogreverse=false;
|
||||
|
||||
function createAndDownloadFile(fileName,content){
|
||||
var aTag=document.createElement('a');
|
||||
var blob=new Blob([content]);
|
||||
aTag.download=fileName;
|
||||
aTag.href=URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(blob);
|
||||
}
|
||||
|
||||
function apply_del_log(){
|
||||
XHR.get('<%=url([[admin]],[[control]],[[autotimeset]],[[dellog]])%>',null,function(x,data){
|
||||
var lv=document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML="";
|
||||
}
|
||||
);
|
||||
return
|
||||
}
|
||||
|
||||
function reverselog(){
|
||||
var lv=document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML=lv.innerHTML.split('\n').reverse().join('\n')
|
||||
if (islogreverse){
|
||||
islogreverse=false;
|
||||
}else{
|
||||
islogreverse=true;
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
XHR.poll(3,'<%=url([[admin]],[[control]],[[autotimeset]],[[getlog]])%>',null,
|
||||
function(x,data){
|
||||
var lv=document.getElementById('cbid.logview.1.conf');
|
||||
lv.innerHTML=""
|
||||
if (x.responseText && lv){
|
||||
if (islogreverse){
|
||||
lv.innerHTML=x.responseText.split('\n').reverse().join('\n')+lv.innerHTML;
|
||||
}else{
|
||||
lv.innerHTML+=x.responseText;
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
91
luci-app-autotimeset/po/zh-cn/autotimeset.po
Normal file
91
luci-app-autotimeset/po/zh-cn/autotimeset.po
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
msgid "<b>The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts</b></br>"
|
||||
msgstr "<b>任务设置包括定时任务执行和开机启动任务执行,预置:重启、关机、重启网络、释放内存、系统清理、网络共享、关闭网络、自动检测断网重连、自动检测断网重启、MWAN3负载均衡检测重连、自定义脚本等10多个功能.</b></br>"
|
||||
|
||||
msgid "N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours."
|
||||
msgstr "N1-N5连续,N1,N3,N5不连续,*/N表示每N小时或每N分钟。月份范围0-11,星期范围0~6,小时范围0~23,分钟范围0~59,不可用72小时或者90分钟等连续范围。"
|
||||
|
||||
msgid "Scheduled task/startup task settings"
|
||||
msgstr "定时执行任务/开机启动任务设置"
|
||||
|
||||
msgid "Scheduled Setting"
|
||||
msgstr "任务设置"
|
||||
|
||||
msgid "Test/Verify Settings"
|
||||
msgstr "测试/验证设置"
|
||||
|
||||
msgid "Scheduled Type"
|
||||
msgstr "任务名称"
|
||||
|
||||
msgid "Task Type"
|
||||
msgstr "任务类型"
|
||||
|
||||
msgid "Scheduled task execution"
|
||||
msgstr "定时执行任务"
|
||||
|
||||
msgid "Startup task"
|
||||
msgstr "开机启动任务"
|
||||
|
||||
msgid "Startup delay time"
|
||||
msgstr "延迟时间【开机用】"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Scheduled Reboot"
|
||||
msgstr "重启机器"
|
||||
|
||||
msgid "Scheduled Poweroff"
|
||||
msgstr "关闭机器"
|
||||
|
||||
msgid "Scheduled ReNetwork"
|
||||
msgstr "重启网络"
|
||||
|
||||
msgid "Scheduled RestartSamba"
|
||||
msgstr "重启网络共享"
|
||||
|
||||
msgid "Scheduled Restartwan"
|
||||
msgstr "重启WAN"
|
||||
|
||||
msgid "Scheduled Closewan"
|
||||
msgstr "关闭网络"
|
||||
|
||||
msgid "Scheduled Clearmem"
|
||||
msgstr "释放内存"
|
||||
|
||||
msgid "Scheduled Sysfree"
|
||||
msgstr "系统清理(会重启机器)"
|
||||
|
||||
msgid "Scheduled DisReconn"
|
||||
msgstr "检测断网重连"
|
||||
|
||||
msgid "Scheduled DisRereboot"
|
||||
msgstr "检测断网重启"
|
||||
|
||||
msgid "Scheduled Restartmwan3"
|
||||
msgstr "检测MWAN3失联重启服务"
|
||||
|
||||
msgid "Edit Custom Script"
|
||||
msgstr "编辑自定义脚本"
|
||||
|
||||
msgid "Scheduled Customscript"
|
||||
msgstr "自定义脚本"
|
||||
|
||||
msgid "Only by editing the content of the custom script well and scheduling the custom script task can it be executed effectively."
|
||||
msgstr "编辑好自定义脚本内容,自定义脚本任务才能有效执行。"
|
||||
|
||||
msgid "Month(0~11)"
|
||||
msgstr "月份(0~11)【定时用】"
|
||||
|
||||
msgid "Week Day(0~6)"
|
||||
msgstr "星期(0~6)【定时用】"
|
||||
|
||||
msgid "Everyday"
|
||||
msgstr "每天【定时用】"
|
||||
|
||||
msgid "Hour(0~23)"
|
||||
msgstr "小时(0~23)【定时用】"
|
||||
|
||||
msgid "Minute(0~59)"
|
||||
msgstr "分钟(0~59)【定时用】"
|
||||
|
1
luci-app-autotimeset/po/zh_Hans
Symbolic link
1
luci-app-autotimeset/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
@ -0,0 +1 @@
|
||||
#!/bin/sh
|
75
luci-app-autotimeset/root/etc/config/autotimeset
Normal file
75
luci-app-autotimeset/root/etc/config/autotimeset
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
config global
|
||||
option enabled '0'
|
||||
option customscript '#!/bin/sh'
|
||||
|
||||
config stime
|
||||
option hour '*/4'
|
||||
option stype '7'
|
||||
option week '*'
|
||||
option minute '0'
|
||||
option month '*'
|
||||
option enable '0'
|
||||
option ttype '0'
|
||||
option delay '10'
|
||||
|
||||
config stime
|
||||
option minute '0'
|
||||
option month '*'
|
||||
option hour '*/5'
|
||||
option enable '0'
|
||||
option week '1,3,5'
|
||||
option ttype '1'
|
||||
option delay '10'
|
||||
option stype '1'
|
||||
|
||||
config stime
|
||||
option week '*'
|
||||
option month '*'
|
||||
option enable '0'
|
||||
option ttype '0'
|
||||
option delay '10'
|
||||
option stype '10'
|
||||
option hour '0'
|
||||
option minute '*/5'
|
||||
|
||||
config stime
|
||||
option week '*'
|
||||
option minute '0'
|
||||
option stype '2'
|
||||
option hour '1'
|
||||
option month '*'
|
||||
option enable '0'
|
||||
option ttype '0'
|
||||
option delay '10'
|
||||
|
||||
config stime
|
||||
option week '*'
|
||||
option minute '0'
|
||||
option hour '3'
|
||||
option month '*'
|
||||
option enable '0'
|
||||
option ttype '0'
|
||||
option delay '10'
|
||||
option stype '6'
|
||||
|
||||
config stime
|
||||
option week '*'
|
||||
option hour '0'
|
||||
option minute '*/5'
|
||||
option month '*'
|
||||
option stype '11'
|
||||
option ttype '1'
|
||||
option delay '20'
|
||||
option enable '0'
|
||||
|
||||
config stime
|
||||
option month '*'
|
||||
option week '*'
|
||||
option hour '0'
|
||||
option enable '0'
|
||||
option minute '*/5'
|
||||
option stype '12'
|
||||
option ttype '1'
|
||||
option delay '30'
|
||||
|
117
luci-app-autotimeset/root/etc/init.d/autotimeset
Normal file
117
luci-app-autotimeset/root/etc/init.d/autotimeset
Normal file
@ -0,0 +1,117 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#copyright by sirpdboy
|
||||
|
||||
START=95
|
||||
STOP=10
|
||||
TMP=/etc/autotimeset
|
||||
LOG=$TMP/autotimeset.log
|
||||
TT=/etc/init.d/autotimesetrun
|
||||
CR=/etc/crontabs/root
|
||||
[ ! -d $TMP ] && mkdir -p $TMP 2>/dev/null
|
||||
[ -s $LOG ] && echo ' ' >> $LOG
|
||||
run_autotimeset()
|
||||
{
|
||||
ssum=$(grep -c stime /etc/config/autotimeset)
|
||||
customscript=$(uci -q get autotimeset.@global[0].customscript ) || customscript='#!/bin/sh'
|
||||
script=`echo $customscript | grep '#!/bin/sh'` >/dev/null 2>&1
|
||||
[ $script ] && echo $script > /etc/autotimeset/timesetcustomscript || {
|
||||
echo '#!/bin/sh' >/etc/autotimeset/timesetcustomscript
|
||||
echo $customscript >>/etc/autotimeset/timesetcustomscript
|
||||
}
|
||||
echo 'start(){' >>$TT
|
||||
for i in $(seq 0 $((ssum-1)))
|
||||
do
|
||||
enable=$(uci -q get autotimeset.@stime[$i].enable )
|
||||
if [ "x$enable" = "x1" ]; then
|
||||
month=$(uci -q get autotimeset.@stime[$i].month ) || month="*"
|
||||
stype=$(uci -q get autotimeset.@stime[$i].stype )
|
||||
week=$(uci -q get autotimeset.@stime[$i].week ) || week="*"
|
||||
minute=$(uci -q get autotimeset.@stime[$i].minute ) || minute="00"
|
||||
hour=$(uci -q get autotimeset.@stime[$i].hour ) || hour="*"
|
||||
ttype=$(uci -q get autotimeset.@stime[$i].ttype ) || ttype=0
|
||||
delay=$(uci -q get autotimeset.@stime[$i].delay ) || delay=10
|
||||
[ "x$hour" = "x0" ] && hour="00"
|
||||
[ "x$minute" = "x0" ] && minute="00"
|
||||
case "$stype" in
|
||||
1)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler reboot Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler reboot Startup_task" >>$TT
|
||||
;;
|
||||
2)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler poweroff Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler poweroff Startup_task" >>$TT
|
||||
;;
|
||||
3)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler network Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler network Startup_task" >>$TT
|
||||
;;
|
||||
4)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler restartsamba Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler restartsamba Startup_task" >>$TT
|
||||
;;
|
||||
5)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler restartwan Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler restartwan Startup_task" >>$TT
|
||||
;;
|
||||
6)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler closewan Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler closewan Startup_task" >>$TT
|
||||
;;
|
||||
7)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler clearmem Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler clearmem Startup_task" >>$TT
|
||||
;;
|
||||
8)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler sysfree Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler reboot Startup_task" >>$TT
|
||||
;;
|
||||
9)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler disreconn Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler disreconn Startup_task" >>$TT
|
||||
;;
|
||||
10)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler disrereboot Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler disrereboot Startup_task" >>$TT
|
||||
;;
|
||||
|
||||
11)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler restartmwan3 Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler restartmwan3 Startup_task" >>$TT
|
||||
;;
|
||||
12)
|
||||
local cmd="$minute $hour * $month $week /usr/bin/timesethandler customscript Scheduled_task"
|
||||
[ $ttype = '0' ] && echo "$cmd" >> $CR || echo "sleep $delay && /usr/bin/timesethandler customscript Startup_task" >>$TT
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
echo '}' >>$TT
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
del_cru
|
||||
[ -n "`tail -c1 $CR`" ] && echo >> $CR
|
||||
run_autotimeset
|
||||
/etc/init.d/cron reload
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
del_cru
|
||||
/etc/init.d/cron reload
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
start
|
||||
}
|
||||
|
||||
del_cru()
|
||||
{
|
||||
echo -e '#!/bin/sh /etc/rc.common\n\nSTART=99\n' > $TT
|
||||
sed -i '/timesethandler/d' $CR >/dev/null 2>&1
|
||||
}
|
||||
|
6
luci-app-autotimeset/root/etc/init.d/autotimesetrun
Normal file
6
luci-app-autotimeset/root/etc/init.d/autotimesetrun
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
start(){
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
chmod +x /etc/init.d/autotimeset /usr/bin/timesethandler
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@autotimeset[-1]
|
||||
add ucitrack autotimeset
|
||||
set ucitrack.@autotimeset[-1].init=autotimeset
|
||||
commit ucitrack
|
||||
EOF
|
||||
rm -rf /tmp/luci-modulecache /tmp/luci-indexcache*
|
||||
exit 0
|
14
luci-app-autotimeset/root/etc/uci-defaults/luci--autotimeset
Normal file
14
luci-app-autotimeset/root/etc/uci-defaults/luci--autotimeset
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
chmod +x /etc/init.d/autotimeset /usr/bin/timesethandler /etc/init.d/autotimesetrun
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@autotimeset[-1]
|
||||
add ucitrack autotimeset
|
||||
set ucitrack.@autotimeset[-1].init="autotimeset"
|
||||
commit ucitrack
|
||||
delete ucitrack.@autotimesetrun[-1]
|
||||
add ucitrack autotimesetrun
|
||||
set ucitrack.@autotimesetrun[-1].init=autotimesetrun
|
||||
commit ucitrack
|
||||
EOF
|
||||
rm -rf /tmp/luci-modulecache /tmp/luci-indexcache*
|
||||
exit 0
|
127
luci-app-autotimeset/root/usr/bin/timesethandler
Normal file
127
luci-app-autotimeset/root/usr/bin/timesethandler
Normal file
@ -0,0 +1,127 @@
|
||||
#!/bin/sh
|
||||
# author 2021 jjm2473
|
||||
# author 2020-2023 sirpdboy
|
||||
TMP_T=/var/autotimeset/autotimeset.tmp
|
||||
LOG=/etc/autotimeset/autotimeset.log
|
||||
log(){
|
||||
echo "$(date +'%Y-%m-%d %H:%M:%S') $*" >> $LOG
|
||||
}
|
||||
|
||||
limit_log() {
|
||||
local logf=$1
|
||||
[ ! -f "$logf" ] && return
|
||||
local sc=100
|
||||
[ -n "$2" ] && sc=$2
|
||||
local count=$(grep -c "" $logf)
|
||||
if [ $count -gt $sc ];then
|
||||
let count=count-$sc
|
||||
sed -i "1,$count d" $logf
|
||||
fi
|
||||
}
|
||||
|
||||
remwan3() {
|
||||
while true; do
|
||||
status=$(/usr/sbin/mwan3 status | grep error)
|
||||
if [ -z $status ]; then
|
||||
log "Mwan3 is OK"
|
||||
exit 1
|
||||
else
|
||||
log "mwan3 restarting ..."
|
||||
/usr/sbin/mwan3 restart
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
disreconnwan() {
|
||||
i=0
|
||||
PingA=114.114.114.114
|
||||
PingB=223.5.5.5
|
||||
while [[ $i -lt 5 ]]
|
||||
do
|
||||
if /bin/ping -c 1 $PingA >/dev/null
|
||||
then
|
||||
PingErr=0
|
||||
break
|
||||
else
|
||||
if /bin/ping -c 1 $PingB >/dev/null
|
||||
then
|
||||
PingErr=0
|
||||
break
|
||||
else
|
||||
i=$(($i + 1))
|
||||
PingErr=1
|
||||
sleep 10
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
trigger() {
|
||||
case "$1" in
|
||||
reboot)
|
||||
reboot
|
||||
;;
|
||||
poweroff)
|
||||
poweroff
|
||||
;;
|
||||
network)
|
||||
/etc/init.d/network restart
|
||||
;;
|
||||
clearmem)
|
||||
sync && echo 3 > /proc/sys/vm/drop_caches
|
||||
;;
|
||||
sysfree)
|
||||
cd /overlay
|
||||
rm -rf `ls | egrep -v '(upper|.fs_state)'`
|
||||
cd upper
|
||||
rm -rf `ls | egrep -v '(etc)'`
|
||||
cd etc
|
||||
rm -rf `ls | egrep -v '(config|ssr|bench.log|shadow)'`
|
||||
rm -rf /var/luci-modulecache
|
||||
rm -rf /var/luci-indexcache
|
||||
rm -rf /tmp/cache/*
|
||||
reboot
|
||||
;;
|
||||
restartsamba)
|
||||
/etc/init.d/ksmdb restart
|
||||
/etc/init.d/samba restart
|
||||
/etc/init.d/samba4 restart
|
||||
;;
|
||||
restartwan)
|
||||
ifup wan
|
||||
log "Redial succeeded!"
|
||||
;;
|
||||
closewan)
|
||||
ifdown wan
|
||||
;;
|
||||
disreconn)
|
||||
disreconnwan
|
||||
if [ $PingErr = 1 ]; then
|
||||
ifup wan
|
||||
log "Redial succeeded!"
|
||||
fi
|
||||
;;
|
||||
disrereboot)
|
||||
disreconnwan
|
||||
if [ $PingErr = 1 ]; then
|
||||
log "Reboot succeeded!"
|
||||
reboot
|
||||
fi
|
||||
;;
|
||||
restartmwan3)
|
||||
[ -s /usr/sbin/mwan3 ] && remwan3
|
||||
;;
|
||||
customscript)
|
||||
script=`cat /etc/autotimeset/timesetcustomscript ` >/dev/null 2>&1
|
||||
[ $script ] && source /etc/autotimeset/timesetcustomscript
|
||||
log "CustomScript succeeded!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
limit_log $LOG 500
|
||||
PingErr=0
|
||||
log "Scheduled operation $2: $1" && trigger $1
|
||||
|
119
luci-app-autotimeset/root/usr/bin/timesetsecurity
Normal file
119
luci-app-autotimeset/root/usr/bin/timesetsecurity
Normal file
@ -0,0 +1,119 @@
|
||||
#! /bin/bash
|
||||
|
||||
#允许尝试错误的次数
|
||||
tryErrNum=10
|
||||
#允许尝试错误在多长时间范围,单位秒,与tryErrNum一起生效
|
||||
tryTimeOut=300
|
||||
#需要被封禁的多个ip字符串,逗号隔开,这里为空
|
||||
dropIpList=""
|
||||
#logread里面标识字符串,Bad password attempt for 是ssh root登录密码错误log,luci: failed login on 是登录web错误log
|
||||
errStr=("Bad password attempt for" "luci: failed login on")
|
||||
#查询logread 日志的时间间隔,单位秒
|
||||
timesleep=30
|
||||
|
||||
#从根据字符串从日志里面提取要封禁的ip,追加到 dropIpList 变量
|
||||
getdropip() {
|
||||
#对过滤的日志倒叙
|
||||
lines=$(logread | grep $1 | sed -n '1!G;h;$p')
|
||||
linesNum=$(echo -n "$lines" | wc -l)
|
||||
#定义字典变量
|
||||
declare -A dict
|
||||
#
|
||||
if [ "$linesNum" -gt "$tryErrNum" ];then
|
||||
while read line;
|
||||
do
|
||||
ip=$(echo -n "$line" | awk '{print $NF}' | awk -F":" '{print $1}')
|
||||
time=$(echo -n "$line" | awk '{print $4}' | awk -F":" '{sum += $1*3600 + $2*60 + $3};END {print sum}')
|
||||
ok=${dict[$ip]}
|
||||
if [ -z $ok ];then
|
||||
dict[$ip]=1
|
||||
time=$(date | awk '{print $4}' | awk -F":" '{sum += $1*3600 + $2*60+ $3};END {print sum}')
|
||||
dict[${ip}_endtime]=$time
|
||||
else
|
||||
if [ ${dict[$ip]} -lt "$tryErrNum" ];then
|
||||
dict[$ip]=$(expr ${dict[$ip]} + 1)
|
||||
dict[${ip}_starttime]=$time
|
||||
fi
|
||||
fi
|
||||
done < <(echo -n "$lines")
|
||||
|
||||
for key in ${!dict[@]};
|
||||
do
|
||||
if ! [[ "$key" =~ "starttime" ]] && ! [[ "$key" =~ "endtime" ]];then
|
||||
if [ ${dict[$key]} -eq "$tryErrNum" ];then
|
||||
timeDiff=$(expr ${dict[${key}_endtime]} - ${dict[${key}_starttime]})
|
||||
if [ "$timeDiff" -gt 0 ] && [ "$timeDiff" -lt "$tryTimeOut" ];then
|
||||
#追加需要封禁的ip到变量
|
||||
dropIpList=$dropIpList,$key
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
#errStr 字符串遍历,分别从log里面匹配,提取要封禁ip
|
||||
startGetDropIp(){
|
||||
i=0
|
||||
while :
|
||||
do
|
||||
errstr=${errStr[$i]}
|
||||
if [ -z "$errstr" ];then
|
||||
break
|
||||
fi
|
||||
i=$(expr $i + 1)
|
||||
|
||||
getdropip $errstr
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
#初始化ipset iptable
|
||||
intEnv(){
|
||||
ipset list BlockIpList
|
||||
if ! [ "$?" == 0 ];
|
||||
then
|
||||
ipset create BlockIpList hash:net timeout 300
|
||||
iptables -I INPUT -m set --match-set BlockIpList src -p tcp -m tcp --dport 22 -j DROP
|
||||
iptables -I INPUT -m set --match-set BlockIpList src -p tcp -m tcp --dport 80 -j DROP
|
||||
iptables -I INPUT -s 192.168.0.0/16 -j ACCEPT
|
||||
fi
|
||||
}
|
||||
#把要封禁的ip添加到ipset BlockIpList集合
|
||||
ipsetAddIp(){
|
||||
dropIpListNew=""
|
||||
for ip in $(echo -n "$dropIpList" | sed 's/,/ /g')
|
||||
do
|
||||
ipset add BlockIpList $ip
|
||||
if [ "$?" -eq 0 ];then
|
||||
dropIpListNew=$dropIpListNew,$ip
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
sendlogger(){
|
||||
if [ -n "$dropIpListNew" ];then
|
||||
echo -e "autotimeset:MyOpenwrt IP封禁提醒:$dropIpListNew"
|
||||
logger -p warn -t "autotimeset" ",定时设置提醒: IP封禁:$dropIpListNew ---- 时间:`date `"
|
||||
fi
|
||||
}
|
||||
|
||||
#检查当前进程是否存在
|
||||
PocessNum=$(ps | grep timesetsecurity | grep -v grep | wc -l)
|
||||
if [ "$PocessNum" -gt 2 ];then
|
||||
#已经存在进程,直接退出当前进程
|
||||
kill -9 $$
|
||||
else
|
||||
intEnv
|
||||
|
||||
while :
|
||||
do
|
||||
sleep $timesleep
|
||||
dropIpList=""
|
||||
startGetDropIp
|
||||
ipsetAddIp
|
||||
sendlogger
|
||||
done
|
||||
fi
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-autotimeset": {
|
||||
"description": "Grant UCI access for luci-app-autotimeset",
|
||||
"read": {
|
||||
"uci": [ "autotimeset" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "autotimeset" ]
|
||||
}
|
||||
}
|
||||
}
|
674
luci-app-autoupdate/LICENSE
Normal file
674
luci-app-autoupdate/LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
11
luci-app-autoupdate/Makefile
Normal file
11
luci-app-autoupdate/Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI Support for AutoBuild Firmware/AutoUpdate.sh
|
||||
LUCI_DEPENDS:=+curl +wget +bash
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=20210221
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
5
luci-app-autoupdate/luasrc/controller/autoupdate.lua
Normal file
5
luci-app-autoupdate/luasrc/controller/autoupdate.lua
Normal file
@ -0,0 +1,5 @@
|
||||
module("luci.controller.autoupdate",package.seeall)
|
||||
|
||||
function index()
|
||||
entry({"admin","system","autoupdate"},cbi("autoupdate"),_("AutoUpdate"),99)
|
||||
end
|
55
luci-app-autoupdate/luasrc/model/cbi/autoupdate.lua
Normal file
55
luci-app-autoupdate/luasrc/model/cbi/autoupdate.lua
Normal file
@ -0,0 +1,55 @@
|
||||
require("luci.sys")
|
||||
|
||||
m=Map("autoupdate",translate("AutoUpdate"),translate("AutoUpdate LUCI supports one-click firmware upgrade and scheduled upgrade"))
|
||||
|
||||
s=m:section(TypedSection,"login","")
|
||||
s.addremove=false
|
||||
s.anonymous=true
|
||||
|
||||
o = s:option(Flag, "enable", translate("Enable AutoUpdate"),translate("Automatically update firmware during the specified time"))
|
||||
o.default = 0
|
||||
o.optional = false
|
||||
|
||||
week=s:option(ListValue,"week",translate("xWeek Day"))
|
||||
week:value(7,translate("Everyday"))
|
||||
week:value(1,translate("Monday"))
|
||||
week:value(2,translate("Tuesday"))
|
||||
week:value(3,translate("Wednesday"))
|
||||
week:value(4,translate("Thursday"))
|
||||
week:value(5,translate("Friday"))
|
||||
week:value(6,translate("Saturday"))
|
||||
week:value(0,translate("Sunday"))
|
||||
week.default=0
|
||||
|
||||
hour=s:option(Value,"hour",translate("xHour"))
|
||||
hour.datatype = "range(0,23)"
|
||||
hour.rmempty = false
|
||||
|
||||
pass=s:option(Value,"minute",translate("xMinute"))
|
||||
pass.datatype = "range(0,59)"
|
||||
pass.rmempty = false
|
||||
|
||||
local github_url = luci.sys.exec("grep Github= /bin/openwrt_info | cut -c8-100")
|
||||
o=s:option(Value,"github",translate("Github Url"))
|
||||
o.default=github_url
|
||||
|
||||
luci.sys.call ( "/usr/share/autoupdate/Check_Update.sh > /dev/null")
|
||||
local cloud_version = luci.sys.exec("cat /tmp/cloud_version")
|
||||
local current_version = luci.sys.exec("grep CURRENT_Version= /etc/openwrt_ver | cut -c17-100")
|
||||
local current_model = luci.sys.exec("jsonfilter -e '@.model.id' < /etc/board.json | tr ',' '_'")
|
||||
local firmware_type = luci.sys.exec("grep CURRENT_Model= /etc/openwrt_ver | cut -c15-100")
|
||||
local luci_edition = luci.sys.exec("grep NEI_Luci= /etc/openwrt_ver | cut -c10-100")
|
||||
|
||||
button_upgrade_firmware = s:option (Button, "_button_upgrade_firmware", translate("Upgrade to Latested Version"),
|
||||
translatef("若有更新可点击上方 手动更新 后请耐心等待至路由器重启.") .. "<br><br>当前固件版本: " .. current_version .. "<br>云端固件版本: " .. cloud_version.. "<br><br>设备名称: " .. current_model .. "<br>内核版本: " .. luci_edition .. "<br>固件类型: " .. firmware_type)
|
||||
button_upgrade_firmware.inputtitle = translate ("Do Upgrade")
|
||||
button_upgrade_firmware.write = function()
|
||||
luci.sys.call ("bash /bin/AutoUpdate.sh -u > /dev/null")
|
||||
end
|
||||
|
||||
local e=luci.http.formvalue("cbi.apply")
|
||||
if e then
|
||||
io.popen("/etc/init.d/autoupdate restart")
|
||||
end
|
||||
|
||||
return m
|
41
luci-app-autoupdate/po/zh-cn/autoupdate.po
Normal file
41
luci-app-autoupdate/po/zh-cn/autoupdate.po
Normal file
@ -0,0 +1,41 @@
|
||||
msgid "AutoUpdate"
|
||||
msgstr "定时更新"
|
||||
|
||||
msgid "xWeek Day"
|
||||
msgstr "更新时间"
|
||||
|
||||
msgid "Everyday"
|
||||
msgstr "每天"
|
||||
|
||||
msgid "Day"
|
||||
msgstr "天"
|
||||
|
||||
msgid "xHour"
|
||||
msgstr "时 [0~23]"
|
||||
|
||||
msgid "xMinute"
|
||||
msgstr "分 [0~59]"
|
||||
|
||||
msgid "Check Update"
|
||||
msgstr "检查更新"
|
||||
|
||||
msgid "Enable AutoUpdate"
|
||||
msgstr "启用定时更新"
|
||||
|
||||
msgid "AutoUpdate LUCI supports one-click firmware upgrade and scheduled upgrade"
|
||||
msgstr "定时更新 LUCI 支持手动更新以及定时更新固件"
|
||||
|
||||
msgid "Do Upgrade"
|
||||
msgstr "手动更新"
|
||||
|
||||
msgid "Upgrade to Latested Version"
|
||||
msgstr "更新固件"
|
||||
|
||||
msgid "Automatically update firmware during the specified time"
|
||||
msgstr "在指定时间段自动检测云端版本,若有新版本自动更新固件"
|
||||
|
||||
msgid "Github Url"
|
||||
msgstr "Github 地址"
|
||||
|
||||
msgid "Please wait patiently after clicking Do Upgrade button"
|
||||
msgstr "点击手动更新按钮后请耐心等待至路由器重启"
|
1
luci-app-autoupdate/po/zh_Hans
Symbolic link
1
luci-app-autoupdate/po/zh_Hans
Symbolic link
@ -0,0 +1 @@
|
||||
zh-cn
|
7
luci-app-autoupdate/root/etc/config/autoupdate
Normal file
7
luci-app-autoupdate/root/etc/config/autoupdate
Normal file
@ -0,0 +1,7 @@
|
||||
config login
|
||||
option enable '0'
|
||||
option forceupdate '0'
|
||||
option week '7'
|
||||
option hour '23'
|
||||
option minute '0'
|
||||
|
48
luci-app-autoupdate/root/etc/init.d/autoupdate
Normal file
48
luci-app-autoupdate/root/etc/init.d/autoupdate
Normal file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash /etc/rc.common
|
||||
START=99
|
||||
|
||||
run_autoupdate()
|
||||
{
|
||||
local enable
|
||||
config_get_bool enable $1 enable
|
||||
if [ $enable == "1" ]; then
|
||||
local minute
|
||||
local hour
|
||||
config_get week $1 week
|
||||
config_get minute $1 minute
|
||||
config_get hour $1 hour
|
||||
[ "$week" == 7 ] && week="*"
|
||||
sed -i '/AutoUpdate/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
echo "$minute $hour * * $week bash /bin/AutoUpdate.sh -u" >> /etc/crontabs/root
|
||||
else
|
||||
sed -i '/AutoUpdate/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
fi
|
||||
if [ -f /bin/AutoUpdate.sh ] && [ -f /bin/openwrt_info ];then
|
||||
custom_github_url="$(uci get autoupdate.@login[0].github)"
|
||||
current_github_url="$(grep Github= /bin/openwrt_info | cut -c8-100)"
|
||||
[[ -n "${custom_github_url}" ]] && {
|
||||
[[ "${custom_github_url}" != "${current_github_url}" ]] && {
|
||||
sed -i "s?${current_github_url}?${custom_github_url}?g" /bin/openwrt_info
|
||||
}
|
||||
}
|
||||
fi
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
config_load autoupdate
|
||||
config_foreach run_autoupdate login
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
sed -i '/AutoUpdate/d' /etc/crontabs/root >/dev/null 2>&1
|
||||
}
|
||||
|
||||
restart()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
10
luci-app-autoupdate/root/etc/uci-defaults/autoupdate
Normal file
10
luci-app-autoupdate/root/etc/uci-defaults/autoupdate
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@autoupdate[-1]
|
||||
add ucitrack autoupdate
|
||||
set ucitrack.@autoupdate[-1].init=autoupdate
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
exit 0
|
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# https://github.com/Hyy2001X/AutoBuild-Actions
|
||||
# AutoBuild Module by Hyy2001
|
||||
|
||||
rm -f /tmp/cloud_version
|
||||
rm -f /tmp/Version_Tags
|
||||
if [[ -f /bin/openwrt_info ]]; then
|
||||
chmod +x /bin/openwrt_info
|
||||
bash /bin/AutoUpdate.sh -w
|
||||
else
|
||||
echo "未检测到openwrt_info文件,无法运行更新程序!" > /tmp/cloud_version
|
||||
exit 1
|
||||
fi
|
||||
[[ ! -f /tmp/Version_Tags ]] && echo "未检测到云端版本,请检查网络,或您的仓库为私库,或您修改的Github地址有错误,或发布已被删除,或再次刷新网页试试!" > /tmp/cloud_version && exit 1
|
||||
chmod +x /tmp/Version_Tags && source /tmp/Version_Tags
|
||||
if [[ -n "${CLOUD_Version}" ]];then
|
||||
if [[ "${CURRENT_Version}" -eq "${CLOUD_Version}" ]];then
|
||||
Checked_Type="已是最新"
|
||||
echo "${CLOUD_Version} [${Checked_Type}]" > /tmp/cloud_version
|
||||
elif [[ "${CURRENT_Version}" -gt "${CLOUD_Version}" ]];then
|
||||
Checked_Type="发现更高版本固件可更新"
|
||||
echo "${CLOUD_Version} [${Checked_Type}]" > /tmp/cloud_version
|
||||
elif [[ "${CURRENT_Version}" -lt "${CLOUD_Version}" ]];then
|
||||
Checked_Type="云端最高版本固件,低于您现在所安装的版本"
|
||||
echo "${CLOUD_Version} [${Checked_Type}]" > /tmp/cloud_version
|
||||
fi
|
||||
else
|
||||
echo "没检测到云端固件,您可能把云端固件删除了,或格式不对称,比如爱快虚拟机安装EIF格式都会变成Legacy引导!" > /tmp/cloud_version
|
||||
fi
|
||||
exit 0
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-autoupdate": {
|
||||
"description": "Grant UCI access for luci-app-autoupdate",
|
||||
"read": {
|
||||
"uci": [ "autoupdate" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "autoupdate" ]
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
Subproject commit e0280b19010f2ac8ec616b5cde429825d1466872
|
2
luci-app-beardropper/.gitattributes
vendored
Normal file
2
luci-app-beardropper/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
2
luci-app-beardropper/.gitignore
vendored
Normal file
2
luci-app-beardropper/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
.DS_Store
|
622
luci-app-beardropper/LICENSE
Normal file
622
luci-app-beardropper/LICENSE
Normal file
@ -0,0 +1,622 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
22
luci-app-beardropper/Makefile
Normal file
22
luci-app-beardropper/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2020 Nate Ding
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_Title:=LuCI Support for BearDropper
|
||||
LUCI_PKGARCH=all
|
||||
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=20200522
|
||||
|
||||
PKG_MAINTANINER:=Nate Ding <natelol@github.com>
|
||||
PKG_LICENSE:=GLPv3
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
59
luci-app-beardropper/README.md
Normal file
59
luci-app-beardropper/README.md
Normal file
@ -0,0 +1,59 @@
|
||||
luci-app-beardropper
|
||||
===
|
||||
|
||||
[Preview][preview]
|
||||
---
|
||||
luci-app-beardropper, a log examination script w/ iptables firewall rule generation response.
|
||||
|
||||
This is the LuCI app built for the elegant firewall rule generation on-the-fly script [bearDropper][bearDropper], only a few modifications were made to work with Luci.
|
||||
|
||||
|
||||
|
||||
Targets/Devices
|
||||
---
|
||||
Written in shell scripts, so it shall work all good on all devices.
|
||||
|
||||
|
||||
Config
|
||||
---
|
||||
The config file path is: `/etc/config/beardropper` and this is the uci configuration format.
|
||||
|
||||
|
||||
|
||||
Compile
|
||||
---
|
||||
RECOMMENDED!!!! (推荐使用右边的feeds---->)You can use [natelol feeds][feeds]
|
||||
|
||||
|
||||
OR
|
||||
|
||||
|
||||
0. Go under `openwrt/`
|
||||
|
||||
1. Make your own local feeds, say a folder `mkdir yourfeeds`
|
||||
|
||||
2. Clone master under feeds to have `git clone https://github.com/natelol/luci-app-beardropper yourefeeds/luci-app-beardropper`
|
||||
|
||||
3. Append `src-link yourfeeds /path/to/openwrt/yourfeeds` in the file `openwrt/feeds.conf(.default)`
|
||||
|
||||
4. Run following scripts under `openwrt`:
|
||||
|
||||
```bash
|
||||
# Update feeds
|
||||
./scripts/feeds update -a
|
||||
./scripts/feeds install -a
|
||||
|
||||
# M select luci-app-beardropper in LuCI -> 3. Applications also 2. Modules->Translations if you want translations together
|
||||
make menuconfig
|
||||
# compile
|
||||
make package/feeds/luci-app-beardropper/compile V=99
|
||||
```
|
||||
|
||||
Logs
|
||||
---
|
||||
`2020-05-21` Added a new tab listing the blocked IPs.
|
||||
|
||||
|
||||
[preview]: https://github.com/natelol/luci-app-beardropper/tree/master/preview
|
||||
[bearDropper]: https://github.com/robzr/bearDropper
|
||||
[feeds]: https://github.com/natelol/natelol
|
19
luci-app-beardropper/luasrc/controller/beardropper.lua
Executable file
19
luci-app-beardropper/luasrc/controller/beardropper.lua
Executable file
@ -0,0 +1,19 @@
|
||||
module("luci.controller.beardropper", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/beardropper") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services", "beardropper"}, alias("admin", "services", "beardropper", "setting"),_("BearDropper"), 20).dependent = true
|
||||
entry({"admin", "services", "beardropper", "status"}, call("act_status"))
|
||||
entry({"admin", "services", "beardropper", "setting"}, cbi("beardropper/setting"), _("Setting"), 30).leaf= true
|
||||
entry({"admin", "services", "beardropper", "log"}, form("beardropper/log"),_("Log"),40).leaf= true
|
||||
--entry:
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
e.running = luci.sys.call("pgrep -f /usr/sbin/beardropper >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
17
luci-app-beardropper/luasrc/model/cbi/beardropper/log.lua
Normal file
17
luci-app-beardropper/luasrc/model/cbi/beardropper/log.lua
Normal file
@ -0,0 +1,17 @@
|
||||
f = SimpleForm("logview")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
t = f:field(TextValue, "conf")
|
||||
t.rmempty = true
|
||||
t.rows = 20
|
||||
function t.cfgvalue()
|
||||
local logs = luci.util.execi("logread | grep authpriv | grep beardropper")
|
||||
local s = ""
|
||||
for line in logs do
|
||||
s = line .. "\n" .. s
|
||||
end
|
||||
return s
|
||||
end
|
||||
t.readonly="readonly"
|
||||
|
||||
return f
|
54
luci-app-beardropper/luasrc/model/cbi/beardropper/setting.lua
Executable file
54
luci-app-beardropper/luasrc/model/cbi/beardropper/setting.lua
Executable file
@ -0,0 +1,54 @@
|
||||
|
||||
m = Map("beardropper", translate("BearDropper"),
|
||||
translate("luci-app-beardropper, the LuCI app built with the elegant firewall rule generation on-the-fly script bearDropper. <br /> <br /> Should you have any questions, please refer to the repo: ")..[[<a href="https://github.com/NateLol/luci-app-bearDropper" target="_blank">luci-app-beardropper</a>]]
|
||||
)
|
||||
m:chain("luci")
|
||||
|
||||
m:section(SimpleSection).template="beardropper/status"
|
||||
|
||||
s = m:section(TypedSection, "beardropper", translate(""))
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
-- TABS
|
||||
s:tab("options", translate("Options"))
|
||||
s:tab("blocked", translate("Blocked IP"))
|
||||
|
||||
o = s:taboption("options", Flag, "enabled",translate("Enabled"))
|
||||
o.default = 0
|
||||
|
||||
-- OPTIONS
|
||||
o = s:taboption("options", ListValue, "defaultMode", translate("Running Mode"))
|
||||
o.default = "follow"
|
||||
o:value("follow", translate("Follow"))
|
||||
o:value("entire", translate("Entire"))
|
||||
o:value("today", translate("Today"))
|
||||
o:value("wipe", translate("Wipe"))
|
||||
|
||||
|
||||
o = s:taboption("options", Value, "attemptCount", translate("Attempt Tolerance"), translate("failure attempts from a given IP required to trigger a ban"))
|
||||
|
||||
o = s:taboption("options", Value, "attemptPeriod", translate("Attempt Cycle"), translate("time period during which attemptCount must be exceeded in order to trigger a ban <br> Format: 1w2d3h4m5s represents 1week 2days 3hours 4minutes 5 seconds"))
|
||||
|
||||
o = s:taboption("options", Value, "banLength", translate("Ban Period"), translate("how long a ban exist once the attempt threshold is exceeded"))
|
||||
|
||||
o = s:taboption("options", ListValue, "logLevel", translate("Log Level"))
|
||||
o.default = "1"
|
||||
o:value("0", translate("Silent"))
|
||||
o:value("1", translate("Default"))
|
||||
o:value("2", translate("Verbose"))
|
||||
o:value("3", translate("Debug"))
|
||||
|
||||
|
||||
o = s:taboption("blocked", Value, "blocked", translate("Blocked IP List"))
|
||||
o.template="cbi/tvalue"
|
||||
o.rows=40
|
||||
o.wrap="off"
|
||||
o.readonly="true"
|
||||
function o.cfgvalue(e, e)
|
||||
return luci.sys.exec("cat /tmp/beardropper.bddb | awk /'=1/'| awk -F '=' '{print $1}' | awk '{print substr($0,6)}' | awk 'gsub(/_/,\":\",$0)'")
|
||||
end
|
||||
|
||||
|
||||
|
||||
return m
|
22
luci-app-beardropper/luasrc/view/beardropper/status.htm
Executable file
22
luci-app-beardropper/luasrc/view/beardropper/status.htm
Executable file
@ -0,0 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[beardropper]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('beardropper_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>BearDropper <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>BearDropper <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="beardropper_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user